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)
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

Answers (2)

John D'Errico
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.

Sacha Levy
Sacha Levy on 7 May 2018
Edited: Sacha Levy on 7 May 2018
Hello, Thank you for your detailed answer.
I did not spend time explaining the problem I chose; I think I had understood it rather well, and its solution are not what I am really looking for. I don't want to solve this, I know indeed what it means.
I am just trying to understand how Matlab (doesn't) work(s), because I have an arguably more interesting problem I do not manage to solve, and I believe that understanding how Matlab behaves in such a case could help me understand why I don't succeed in solving the true problem I have.
What I would have expected to see here was one vector whose coordinates are given by three arbitrary parameters, and another for which we have two parameters with conditions, and one expression depending on these parameters. I think this would be an accurate description of the solution, and I have some difficulties understanding why a solver couldn't do this. When you say it is unclear because we don't know whether the center of the sphere is V or W, I think this only relates to the way we describe the set of solution, which is also the way I have just implicitly used once again: first we choose a center, wherever in space, and then, for this point, the sphere whose radius is 4 completes the solution. But in the end, there isn't any sphere in the final result, just a set of couple of points, regardless of how we built it. We might as well have done it the other way round, the final set would be exactly the same.
Let me point out though that when you said that removing the square root doesn't change anything, it was precisely what was confusing to me: the problem is basically the same, but in one case Matlab gives a good description of the solution, in the other, it doesn't return anything!
I thought it would be more simple focusing on a simple problem like this, but you may want to know what I am truly trying to do. You might tell me it is the same thing... and I would answer this is indeed the same thing : I don't get the result I expect!
Basically, I want to find the positions of the vertices of a triangle (whose dimensions are known) assuming they are located on three spheres (which are known as well). I have a set of six equations : the three spheres, and the three edges. The unknown are the three vertices... I believe you know what Matlab tells me...
I hope I managed to make what I don't understand/succeed in doing a bit clearer... Thank you for your attention to this matter
Regards, Sacha Levy

This question is closed.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!