Info
This question is closed. Reopen it to edit or answer.
Two points at a given distance in space: no solution
3 views (last 30 days)
Show older comments
Hello,
I am still trying to understand a problem I have (had for a bit too long now...), and I could have found a more relevant way to tackle it, hence my sending this new message. Could you please explain to me what is happening and how to rectify this when when entering
V = sym('V', [3, 1], 'real')
W = sym('W', [3, 1], 'real')
solve(sqrt(dot(V-W, V-W))==4, [V, W], 'ReturnConditions', true, 'Real', true)
I get no result...
A few things I noticed :
It works well if I remove W, that is to say if I write:
solve(sqrt(dot(V, V))==4, V, 'ReturnConditions', true, 'Real', true)
But it stops working once again if I take the square root off....
I really do not understand... I feel this is some kind of odd magic, which is, I have to say, rather problematic.
Could you please shed some light on this issue, and maybe help me move forward with my project?
Thank you for your help,
Regards,
Sacha Levy
0 Comments
Answers (2)
John D'Errico
on 6 May 2018
Edited: John D'Errico
on 6 May 2018
I'm not sure what you are trying to solve here, or why you are doing this as you are.
sqrt(dot(V-W, V-W))==4
Writing this in terms of mathematics is simple. It is just norm(V-W)==4.
The other version you wrote, without W in there is equivalent to solving for the locus of points that satisfy norm(V)==4.
If you remove the sqrt or not, this does not materially change the problem, at least in terms of mathematics. In any case, you are solving for a locus of points at some fixed distance from another point.
Given two points that lie at some fixed distance in space, we have infinitely many solutions, and there are two classes of solutions that are sort of symmetric with each other.
Thus, suppose we fix V at some location in space?
Then the locus of all solutions W lies on the surface of a sphere of radius 4 around the point V.
Now, suppose we allow V to float in space? Now we might envision an entire family of spheres, infinitely many such spheres. For any center point V, such a sphere of solutions exists. Thus W always lies on the surface of a sphere.
But suppose we swap points of view? Now, fix W at some location in space? Then V must lie on the surface of a sphere, with center point W.
So what does all of this have to do with what you saw? Suppose you tried to solve the problem:
solve(sqrt(dot(V-W, V-W))==4, V, 'ReturnConditions', true, 'Real', true)
Essentially that is equivalent to solving for the surface of a sphere in 3-dimensions, with center W. So while W is unknown and symbolic, it is implicitly held fixed, and we wish to solve for V, GIVEN W.
If you completely drop W from the relation,
solve(sqrt(dot(V, V))==4, V, 'ReturnConditions', true, 'Real', true)
That is just equivalent to setting W == 0. So the sphere has center at the origin.
But when you try to solve for both V and W at the same time, things get confusing. Which paradigm are we living in? Is V the center of the sphere? Or is it W?
Hmm. Lets look at this from two different points of view. First, as a mathematician, I look at it as if from the bleacher seats. I can see the solution is just an infinite family of spheres, and depending on your point of view, we can put either V or W at the center of those spheres.
But a solver cannot do that. A sphere is just a description of a locus of points, one that we happen to understand as something common to anyone who has ever played tennis, bowling, whatever. It is not a solution in itself. However you asked for a solution!!!!! What does a solution mean to a solver?
You have ONE equation here. ONE piece of information. But you have either 3 variables or 6 variables, depending on whether you include W. With one equation, you can solve for ONE unknown, in terms of the others at best. Here however, that solution involves two branches of an implicit surface. So MATLAB tries to return the solution in some analytical form, when really, just calling it a sphere should suffice.
So in the end, I'm not at all sure why you are bothering to solve this, or doing it in the way you are. The answer is just a sphere, or an infinite family of spheres.
0 Comments
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!