Questions tagged [math]
Math involves the manipulation of numbers within a program. For general math questions, please ask on math.stackexchange.com. Note: If your question is about unexpected results in floating point calculations, please read https://stackoverflow.com/questions/588004/is-floating-point-math-broken first.
44,376
questions
-3
votes
1
answer
37
views
How do I make python give me the right solutions for a function and change the format of the zeros based on the sign?
I am trying to make a quadratic formula calculator. Everything seems fine, however, when I put in some functions, like x^2-2x+1 and x^2+2x+1, it gives me the same zeroes for them when they have ...
0
votes
0
answers
20
views
how to generate random coefficient from 0 to 5000 with winrate 0.95? [closed]
How to generate random coefficient from 0 to 5000 with winrate 0.95?
I mean that chance to generate 10 should be 9.5%
chance to generate 100 is 0.95, etc
function generateCoefficient(winRate = 0.95, ...
-3
votes
1
answer
24
views
Addition proof in lambda calculus [closed]
Don't understand this transition in the proof of add(m, n) = m + n: (λmn.λsz.m, s, (n, s, z)) = (λs.λz.sm(z)) , s, (λs.λz.sn(z))
Explain the logic of the transition (may be it is b-reduction or the ...
1
vote
1
answer
40
views
Exponential function for search algorithm
I implemented a linear function for a search algorithm, that boosts a document according to its time since upload. So the newer a document the more likely it will be presented for a given search term. ...
0
votes
0
answers
18
views
Calculation of a 5-d integral using Julia HCubature
I am calculating the integral above.
My code is
using HCubature
function FUN_trans(x)
return k1_FUN([1/x[1]-1, 1/x[2]-1, x[3], x[4], 1/x[5]-1]) / x[1] / x[1] / x[2] / x[2] / x[5] / x[5]
end
...
1
vote
1
answer
63
views
Finding largest root of a function in R
I have a function that is data generated and not a polynomial. For most data, it only has one root, but it can also have two roots, as in in the following plot:
uniroot() tends to fail because the ...
0
votes
0
answers
36
views
2D Canvas | Smooth camera without jitter
In my demo, you can see that the player's camera catches up with the player's position with a slight delay. It follows him until the player finally stops, gradually reducing the distance.
...
-1
votes
0
answers
20
views
How do I find a point set for which the Cech complex has persistent homology in dimension 1 but the Vietoris Rips complex does not?
The exercise I try to solve:
„Find a point set for which the Cech complex has persistent homology in dimension 1 but the Vietoris Rips complex does not. Verify your solution computationally by ...
0
votes
4
answers
96
views
Why is multiplication of integer O(n^2)?
I was wondering why multiplication of integers is O(n^2)? I've been taught addition and multiplication is considered 1 operation. Hence if I multiply an integer of n-digits with another integer of n-...
-2
votes
1
answer
44
views
Given a number N find the number just smaller than N such that it has a given digit x present in it x times [closed]
You will receive an input number N in string format and also a number x. Your task is to find the largest number that is smaller than N and contains the digit x exactly x times.
For example: N = ...
0
votes
1
answer
24
views
Trying to combine like terms in Sympy
Code
Am tring to combine the gamma terms above together (so that the final expression reads gamma**(alpha/(alpha-1))*(4alpha+1)+r, but have been unable to do so so far. I assumed all variables were ...
2
votes
1
answer
69
views
How can I add and subtract to a variable from multiple game objects without losing the accuracy?
I have more than 100(close to 200) enemy game objects in my scene and 5-6 being spawned every second. I'm using object pooling and the objects are not being instantiated every time but only when ...
0
votes
0
answers
19
views
ARPACK producing nonsense eigenvalues?
I am trying to use arpack from within rust and I am getting weird results.
In order to test if I was correctly interfacing with arpack, I decided to make a sparse symmetric tri-diagonal Toeplitz ...
0
votes
0
answers
30
views
Calculating a list of voxels within multiple overlapping Axis-Aligned-Bounding-Boxes, without looping over the same space
I have a method that returns a list of voxel coordinates within an AABB. Let's say a voxel is 1x1x1 cm, and a bounding box is 2x2x2, then it will return 8 voxels by looping over the dimensions of the ...
0
votes
0
answers
19
views
Modified accel asc algorithm
I wanted to make an accel asc algorithm that only outputs partitions that only have terms that are smaller than or equal to n. For example: if I want the partitions of 4, and n = 2, the wanted ...