Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
An input sequence is given. Each stage of the iteration finds another sequence by calculating difference between n-i and n-i-1 number. We continue the process and at the end of the last iteration (iteration: n-1) we find only 1 number. What is the mathematical formulation for finding the last number as shown in the image?
Basically, the mathematical formulation is finding the n-1'th derivative of the degree-n-1 polynomial passing through all points (i,arr[i]). That derivative is guaranteed to be a constant. This is equivalent to the coefficient of the term with exponent n-1, divided by (n-1)!.
This method is a special case of what is known as Neville's Algorithm.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm developing a little 2D game and i have to predict when and where things will collide.
So, i've got four Vector2 :
A position
B position
A linear velocity
B linear velocity
I have to find if they intersect, where they intersect and at what time from now.
I've found many math solutions but i could't translate them into code.
The visualization of the problem, numbers are velocities
You want to compute the minimum of
norm((A+t*vA)-(B+t*vB))=norm((A-B)+t*(vA-vB))
Taking the square of these Euclidean norms
norm((A-B)+t*(vA-vB))^2 = norm(A-B)^2 + 2*t*dot(A-B,vA-vB) + t^2*norm(vA-vB)^2
gives you a simple quadratic function in t where the minimum has the value
min_dist =norm(A-B)^2 - dot(A-B,vA-vB)^2/norm(vA-vB)^2
at time
t = -dot(A-B,vA-vB)/norm(vA-vB)^2
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
the "mixedDesign" function was written by the professor for this homework, but I think the argument "sd" is standard as I've found it on other functions but with no description of what the value should actually describe. What am I actually saying when I designate a value for sd? Professor says 0.1 is "too low". Is there a standard value for this argument?
simdata <- mixedDesign(B=c(2, 2), W=2, n=10, M=Means,
SD=0.1, R=.42, empirical = TRUE, long = TRUE)
I'm aware that standard deviation is 34.1% either side of the mean!
Many thanks in advance!
A bit of googling leads here:
SD: Matrix specifying the cell standard deviations of crossing between- and within-subject factors (dimensions: prod(B)-by-prod(W) matrix)
(for pure within-subjects designs, it is possible to input a vector of size prod(W) as an alternative to a 1-by-prod(W) matrix) OR
a scalar (single number) that will be the standard deviation of all cells
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Number of digits that are present in the maximum number that is formed using three digits?
Maximum factorial that is formed by three digits?
This was a question asked on a site.
I am not able to understand is there any thing tricky i am not getting?
i have tried 3 and 720 but it is incorrect
The maximum factorial which can be formed using 3 digits is 999!.
The answer can be easily obtained from wolfram alpha.
Number of digits in 999!.
999!=Answer
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've passed by this article:
http://gauravtiwari.org/2011/12/11/claim-for-a-prime-number-formula/
and this paper:
http://www.m-hikari.com/ams/ams-2012/ams-73-76-2012/kaddouraAMS73-76-2012.pdf
They say that there is a formula that when I give it (n) then it returns nth prime number. Where in other articles they say that no formula discovered so far that does such thing.
If the formula exists indeed, then why from time to time they discover the largest prime number known ever, It would be very simple using the formula to find a larger one.
I just want to ensure that such formula exists or not.
Conceptually it is very simple to test that a given number n is a prime number: just check for all smaller numbers 'm' (larger than 1) whether 'm' divides 'n' without remainder. If
such an 'm' exists 'n' is not a prime number.
Then, to find the k-th prime number you just iterate this procedure until you found the k-th number which is a prime. So yes, such a formula exists.
But, executing the above procedure is very inefficient. So even having this formula (and in real cases you would use more intelligent variants), it can take literally ages before you get an answer. And that is why more efficient variants and tricks are used to find large prime numbers.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I know that (a*b)%M = (a%M * b%M)%M
But what if the equation was :( (a*b)/c )%M ..I dont think I can use the above logic here also..And here M is a non-prime number ..You may assume that (a*b)/c will NEVER end up in a floating value..
For eg:
If a=10 b=9 and c=6,M=4 then (a*b)/c=15 and 15%4=3
but if I use the property as it is with multiplications then ((10%4*9%4)/(6%4))%4= (2*1)/2=1
Please tell me how to solve this kind of problem??
If c and M were relatively prime, you could multiply c^-1%M and the math should work. However, if GCD(c,M)>1, then c^-1%M doesn't exist, and there is no easy way to do it that I know of.
As far as what c^-1%M is, its the number such that c*c^-1%M=1. For example, if c=2 and M=9, 2*5%9=10%9=1, so c^-1%M=5.
You can calculate c^-1%M with the extended euclidean algorithm -- you get ac+bM=1, so ac=1+(-b)M and ac%M=1.