## Self-contained infinite series – Mathematics Stack Exchange

What do you call such an infinite sequence? $$(x_n) _ {n in Bbb N}: forall a = (x_i, x_ {i + 1}, x_ {i + 2}, …, x_ {i + j}) exists b = (x_k, x_ {k + 1}, x_ {k + 2}, …, x_ {k + j}); i not = k: a = b$$

For example, the 2-adic rating of 2n, https://oeis.org/A001511

In other words, every part of the sequence has a copy of itself in the sequence. In fact, each part would have an infinite number of copies of itself. I thought that was a fractal sequence, but that's not the case.

## mathematics – Align TextureRegion After Rotating 180 Deg LibGDX

I'm trying to rotate a texture area 180 degrees and align it with the other half, but I could not do that successfully because I got confused with the coordinates after the rotation.
So I draw the first half with this code:

``````batch.draw(pitchTexture,w/4f-pitchTexture.width/4f,h/2.5f-pitchTexture.height/2.5f,pitchTexture.width.toFloat()/2f,pitchTexture.height.toFloat()/2f)
``````

I did that completely with trial and error and it looks like what's alright for me:

So with this code I try to draw the rotated 2nd half and align it to the 1st so it looks like a complete box. But I could not calculate the correct x, y and originX origin is the wrong way to do that.

``````        batch.draw(pitchTextureRegion,?,?,pitchTexture.width/2f ,pitchTexture.height/2f,pitchTexture.width.toFloat()/2f,pitchTexture.height.toFloat()/2f,1f,1f,180f);
// not sure about originX and originY
``````

## Discrete Mathematics – When and how can I change the conclusion in inference rules?

I have seen people who have changed the conclusion of the examples in the inference rules. My question is, when can I do this? If I have to prove P and Q, which should I choose?

Examples 1:
Premises {p → q, p ∨ q} Conclusion / Proof q ∨ r
But they manage to prove only q, but they add ¬r in the premises so we have

Final:
Prerequisites {p → q, p, q, ¬r} Termination q

Example 2:

Premises {p ∨ q, ¬q ∨ r, r → s} Conclusion: ¬p → s

Final:
they change it to {p ∨ q, ¬q ∨ r, r → s, ¬p} Conclusion s

Can I simplify this every time?

## Mathematics – Soundness: verification of the original certificates, premium for large primes

This is my first smart contract, and it's not finished yet, but the remaining parts are so complicated that I want to make sure I'm on the right track first. My concerns are:

• Is the missing division at line 117 an actual division or a modular multiplicative inverse? (BigNumber does not offer either `bn_div` Method is only for check I'm not sure what the discourse universe is for the elliptic curve.
• Should other operations be modular that are not modular?
• I've already moved the square root function and a coprimacy test out of the chain (hence the 7th through 10th parameters) `submitPrime`). Are there any other parts that can be easily removed from the chain and checked?
• The part of `ellipticCurveCheck` that I have written so far, does not use B at all. Should it?
• All BigNumber method names are qualified with the library name, which makes the code unwieldy. Does Solidity have an equivalent to Java? `import static` that I can use instead? Googling brings nothing to light.

NB: BigNumber is my personal fork, updated to work with Solidity 0.5.x and with tests running against 0.5.8.

``````pragma experimental ABIEncoderV2;
pragma solidity >=0.5.11 <0.6;

import "https://raw.githubusercontent.com/Pr0methean/solidity-BigNumber/2bddf04709f0e1ed649b37b5533264cef8c5cbfe/contracts/BigNumber.sol";
BigNumber.instance ZERO = BigNumber._new(hex"00",false,false);
BigNumber.instance ONE = BigNumber._new(hex"01",false,false);
BigNumber.instance TWO = BigNumber._new(hex"02",false,false);
BigNumber.instance THREE = BigNumber._new(hex"03",false,false);
BigNumber.instance FOUR = BigNumber._new(hex"04",false,false);
BigNumber.instance TWENTY_SEVEN = BigNumber._new(hex"1B",false,false);
BigNumber.instance BOUNTY_THRESHOLD = BigNumber._new(hex"010000000000000000000000000000000000000000000000000000000000000000",false,false);
mapping(bytes => BigNumber.instance) knownPrimes;
uint256 constant public bountyAmount = 1e12 wei;

constructor(bytes32) public {
owner = msg.sender;
knownPrimes(TWO.val) = TWO;
}

function selfDestruct() public {
require(msg.sender == owner, 'Only the owner can call this');
selfdestruct(owner);
}

function square(BigNumber.instance memory input) private view returns (BigNumber.instance memory) {
return BigNumber.bn_mul(input, input);
}

function cube(BigNumber.instance memory input) private view returns (BigNumber.instance memory) {
return BigNumber.bn_mul(square(input), input);
}

function mapContains(
mapping(bytes => BigNumber.instance) storage haystack,
BigNumber.instance memory needle)
private view returns (bool) {
return BigNumber.cmp(needle, haystack(needle.val), true) == 0;
}

function verifySquareRoot(BigNumber.instance memory input, BigNumber.instance memory sqrt) view private {
require(BigNumber.cmp(square(sqrt), input, false) <= 0, 'Square root too high');
BigNumber.instance memory sqrtPlusOne = BigNumber.prepare_add(sqrt, ONE);
BigNumber.instance memory nextSquare = BigNumber.bn_mul(sqrtPlusOne, sqrtPlusOne);
require(BigNumber.cmp(input, nextSquare, false) < 0, 'Square root too low');
}

/**
* Assert that prime and 4A^3 + 27B^2 are coprime, using certificate method from
* https://math.stackexchange.com/questions/2163034/proving-a-coprime-certificate-of-x-y.
* Do not inline (causes a "Stack too deep" error).
*/
function verifyCoprimality(
BigNumber.instance memory prime,
BigNumber.instance memory A,
BigNumber.instance memory B,
BigNumber.instance memory coprimeCertX,
BigNumber.instance memory coprimeCertY) private view {
require (BigNumber.cmp(ONE,
BigNumber.bn_mul(coprimeCertX, prime),
BigNumber.bn_mul(FOUR, cube(A)),
BigNumber.bn_mul(TWENTY_SEVEN, square(B))))),
true) == 0, 'Coprimality certificate verification failed');
}

/**
* assert q > 2*prime^(1/4) + prime^(1/2) + 1
* TODO: Does rounding the roots *before* adding affect this bounds check?
*/
function boundsCheckQ(
BigNumber.instance memory q,
BigNumber.instance memory sqrtPrime,
BigNumber.instance memory fourthRootPrime) private view {
require (BigNumber.cmp(q,
> 0, 'Requires q > 2 * ⁴√(prime) + √(prime) + 1');
}

/**
* assert My² = Mx³ + AMx + B
*/
function verifyPointOnCurve(
BigNumber.instance memory Mx,
BigNumber.instance memory My,
BigNumber.instance memory A,
BigNumber.instance memory B) private view {
require (BigNumber.cmp(square(My), expectedMySquared, false) == 0, 'Requires My² = Mx³ + AMx + B');
}

/**
* Only works for curves with no term in y, xy or x²
*
* Based on https://crypto.stanford.edu/pbc/notes/elliptic/explicit.html (a1 = a2 = a3 = 0)
*/
BigNumber.instance memory x1,
BigNumber.instance memory y1,
BigNumber.instance memory x2,
BigNumber.instance memory y2,
BigNumber.instance memory A) private view returns (BigNumber.instance memory x3, BigNumber.instance memory y3) {
BigNumber.instance memory run = BigNumber.prepare_sub(x2, x1);
BigNumber.instance memory rise;
BigNumber.instance memory slope;
if (BigNumber.cmp(ZERO, run, false) == 0) {
require (BigNumber.cmp(y2, y1, false) == 0, 'Attempt to add two points with same x and different y in elliptic curve');
run = BigNumber.bn_mul(y1, TWO);
} else {
rise = BigNumber.prepare_sub(y2, y1);
}
require(BigNumber.cmp(BigNumber.bn_mod(rise, run), ZERO, false) == 0, 'Elliptic curve cannot be computed in integer arithmetic');
// TODO: Need on-chain division to set slope = rise / run!
x3 = BigNumber.prepare_sub(BigNumber.prepare_sub(square(slope), x1), x2);
y3 = BigNumber.prepare_sub(BigNumber.bn_mul(slope, BigNumber.prepare_sub(x1, x3)), y1);
}

function ellipticCurveCheck(
BigNumber.instance memory Mx,
BigNumber.instance memory My,
BigNumber.instance memory A,
BigNumber.instance memory B,
BigNumber.instance memory q) private view returns (bool) {
// Then M = (Mx, My) is a non-identity point on the elliptic curve y^2 = x^3 + Ax + B.
// Let kM be M added to itself k times using
// standard elliptic-curve addition. Then, if qM is the identity element I, then n is prime.
BigNumber.instance memory qMx;
BigNumber.instance memory qMy;
BigNumber.instance memory Nx = Mx;
BigNumber.instance memory Ny = My;
BigNumber.instance memory remainingQ = q;
while (BigNumber.cmp(remainingQ, ZERO, false) != 0) {
if (BigNumber.is_odd(remainingQ) != 0) {
(qMx, qMy) = ellipticCurvePointAdd(qMx, qMy, Nx, Ny, A);
}
remainingQ = BigNumber.right_shift(remainingQ, 1);
(Nx, Ny) = ellipticCurvePointAdd(Nx, Ny, Nx, Ny, A);
}
// TODO: Determine if qMx, qMy is an identity element
return false;
}

/**
* Use this method to submit an Atkin–Goldwasser–Kilian–Morain certificate to be verified and added to the list.
* A bounty of bountyAmount is paid to the sender if the prime is new to the list and sufficiently large. This type of
* certificate uses an elliptic curve of the form y² = x³ + Ax + B.
*
* Some additional off-chain-calculated parameters are required,
* to limit the gas cost of verification. coprimeCertX and coprimeCertY are such that
* coprimeCertX * prime + coprimeCertY * (4*A*A*A + 27*B*B) == 1.
*
* @param prime the prime number to add to the list
* @param Mx the x-coordinate of the certifying point
* @param My the y-coordinate of the certifying point
* @param A the elliptic curve's coefficient in x
* @param B the elliptic curve's constant term
* @param q a previously-submitted prime, or 2 for bootstrapping
* @param sqrtPrime the square root of prime, rounded down
* @param fourthRootPrime the fourth root of prime, rounded down
* @param coprimeCertX term in the prime for the coprimality certificate
* @param coprimeCertY term in 4A³ + 27B² for the coprimality certificate
*/
function submitPrime(
BigNumber.instance memory prime,
BigNumber.instance memory Mx,
BigNumber.instance memory My,
BigNumber.instance memory A,
BigNumber.instance memory B,
BigNumber.instance memory q,
BigNumber.instance memory sqrtPrime,
BigNumber.instance memory fourthRootPrime,
BigNumber.instance memory coprimeCertX,
BigNumber.instance memory coprimeCertY) public {
require (!prime.neg && !Mx.neg && !My.neg && !A.neg && !B.neg && !q.neg && !sqrtPrime.neg && !fourthRootPrime.neg,
'Inputs prime,Mx,My,A,B,q must be non-negative');
require (BigNumber.cmp(Mx, prime, false) < 0, 'Mx must be less than the prime');
require (BigNumber.cmp(My, prime, false) < 0, 'My must be less than the prime');
require (BigNumber.cmp(A, prime, false) < 0, 'A must be less than the prime');
require (BigNumber.cmp(B, prime, false) < 0, 'B must be less than the prime');
require (BigNumber.is_odd(prime) != 0, 'Not odd, and 2 is already claimed; therefore not prime');
require (mapContains(knownPrimes, q), 'Submit a primality certificate for q first');
verifySquareRoot(prime, sqrtPrime);
verifySquareRoot(sqrtPrime, fourthRootPrime);
verifyCoprimality(prime, A, B, coprimeCertX, coprimeCertY);
boundsCheckQ(q, sqrtPrime, fourthRootPrime);
verifyPointOnCurve(Mx, My, A, B);
require (ellipticCurveCheck(Mx, My, A, B, q), 'Elliptic-curve test failed');
knownPrimes(prime.val) = prime;
if (BigNumber.cmp(prime, BOUNTY_THRESHOLD, false) > 0) {
msg.sender.transfer(bountyAmount);
}
}
}
$$```$$
``````

## Mathematics – Calculation of the braking distance when turning

I have to calculate the motion of an object that slows down to approach its destination when turning, The calculation of the linear braking distance and the deceleration is simple. However, if the object does not point to the target and has a limited rotational speed, it becomes more complicated. For example, imagine it points 90 degrees off the target: turning it will increase the distance to the target.

The tropic increases the distance to the target, but decelerating makes the following turning radius narrower, and I'm not sure how to account for both factors.

Basically, I have the following information:

• Start position, angle and speed
• target position
• delay
• rotation speed

and I have to calculate that distance (or time) to the goal. What is the calculation for this?

I can also see that the startup speed may not be solvable if it's too high. In this case it would be useful to calculate the maximum possible speed as well.

## Volume Geometry – Stack Exchange Mathematics

Each side of a tetrahedron with side length $$p$$ is lengthened along the corners by the length $$p$$,

Now all 12 points create a new body of which I'm looking for the volume depending on the volume of the tetrahedron in the middle.

Image of the solid

I have so far:

The V of the T is
$$V = frac { sqrt {2}} {12} p ^ 3$$

The big body is made up of 4 big triangles named $$LT's$$, 4 small triangles, named $$ST's$$ and 6 rectangles called $$R's$$, The hexagon generated by the middle vertices is called $$H$$ respectively.
I know that the length of
The small triangles of the larger body must be too $$p$$,

I could perhaps try to find the volume with the formula:
$$V = frac {h} {3} (H + sqrt {H * ST} + ST)$$
from where $$h$$ is the height of the truncated pyramid.

#### Stack Exchange network

The Stack Exchange network consists of 175 Q & A communities, including Stack Overflow, the largest and most trusted online community where developers can learn, share, and build a career.

Visit Stack Exchange

## Mathematics – formula for enemy health

I'm doing a fantasy card game. I need a formula to challenge the user and increase the difficulty the user will have the more health he has. The user has an infinite amount of time to cast a card, and there is currently no way for the user to generate health or mana

## Mathematics Lessons – Data Science Training In Noida

Data Science Training In Noida: – Data science knowledge is the fate of artificial intelligence. So it's important to understand the value of data science and the way your organization benefits from it. Data Science is a mix of gears, system learning ideas, and algorithms designed to discover hidden patterns from raw data. In addition to exploratory analysis, Data Scientist uses numerous superior machine reading algorithms to find out the prevalence of a particular event in the future. A data scientist seems to be looking at information from multiple angles. Therefore, DataScience is used in particular to make predictions and selections using Prescriptive Analytics, Predictive Causal Analytics, and Machine Mastering.

## Mathematics – Quick Approach to a Truncated Gaussian Distribution?

I'm doing some Procgen stuff and I need a truncated Gaussian distribution. Basically, I need a way to do the same:

``````import random
def truncated_gaussian(mean, deviation, min, max):
while True:
val = random.gauss(mean, deviation)
if min < val < max: return val
``````

except without so much wasted effort. It looks like it's pretty complicated rightbut I do not need statistical randomness, just an approximation to the video game quality.

Does anyone know a trick to do this job?