Calculating the shortest distance between n GPS points [closed] - math

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have for example 4 points: A (latitute1, longitude1), B (latitute2, longitude2), C (latitute3, longitude3), D (latitute4, longitude4).
If I am a driver and I go from point A, I need an algorithm that calculates the most efficient way for me to visit all the points B, C, D starting from A. So that the distance is the smallest possible.
The algorithm should tell me the most effective order: A --> C --> B --> D (for example).
What matters is the total distance traveled is the lowest possible.
Thanks so much!!! :)

Maybe look into Dijkstras algorithm?
https://en.m.wikipedia.org/wiki/Dijkstra%27s_algorithm

Related

Vector2 intersection [closed]

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

Mathematical formula required [closed]

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.

Maximum factorial that is formed by three digits? [closed]

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

Normal calculation for Splines [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to implement a revolve tool for 2d splines in 3d. The geometry computation already works but the normals are a bit tricky.
The problem is the angle between 2 points like the following image:
Here P1 is the previous point P2 the current point and P3 the next point.
How would I calculate the vector N.
Are you looking for the inverse angle bisector?
dir1 = normalize(p1 - p2)
dir2 = normalize(p3 - p2)
n = normalize(-dir1 - dir2)

Is it NP hard to find a minimum dominating set containing some desired vertices? [closed]

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
For a connected undirected graph, G = (V, E)
And a desired vertex set D, D is a subset of V (i.e. D \in V)
Is it NP-hard to find a minimum dominating set, containing the desired vertex set D?
Yes, it is a NP-hard problem. Please refer to the following document to read the reduction. Feel free to ask if you have problems in understanding the proof.
http://www.cs.iastate.edu/~chaudhur/cs611/Sp07/notes/lec22.pdf
To explain a bit more on your problem, i.e. adding the restriction D is a subset of V.....think like this -- when you are trying to prove your problem is NP, you reduce a known NP problem to a specific instance of your problem. Your specific instance of the problem can be a case when D=V...and you can prove your problem is also NP. Hope this helps.

Resources