Message Boards Message Boards

0
|
5092 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to solve these simultaneous equations?

Posted 10 years ago

Hello community,

I am university student. I started to use Mathematica in few days ago. I want to solve the following simultaneous equations. I tried "Solve" and "NSolve", but I could not obtain answers. Do I make a mistake using these functions?

Please tell me how to solve these equations. Which functions are proper to solve these equations?

Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + Sqrt[ x^2 + y^2 + z^2]=-10.496

Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + Sqrt[ x^2 + y^2 + z^2]=-8.382

Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + Sqrt[ x^2 + y^2 + z^2] =-8.938
POSTED BY: rr003035
6 Replies

You can start by trying FindRoot

eq1 = Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -10.496;
eq2 = Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -8.382;
eq3 = Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + Sqrt[x^2 + y^2 + z^2] == -8.938;
FindRoot[{eq1, eq2, eq3}, {x, 1}, {y, 1}, {z, 1}]
{x -> 5.46311, y -> -2.52191, z -> -0.822461}

If you can setup your system as Ax=b, you can also try LinearSolve which obtain least squares approximation of solution. But your equations are not linear, so this would not work in this case. There might be other methods, but if NSolve fails, that is what I try next (btw, use the Reals option with NSolve and Solve helps sometimes finding a solution, but not in this case). May be someone else will have better answer for you.

POSTED BY: Nasser M. Abbasi

FindRoot issues a line search tolerance warning and doesn't find a very good solution:

eq1 = Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496;
eq2 = Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382;
eq3 = Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938;
sln = FindRoot[{eq1, eq2, eq3}, {x, 1}, {y, 1}, {z, 1}]

({eq1, eq2, eq3} /. a_ == b_ -> a - b ) /. sln
{42.602, 44.29, 48.0062}
POSTED BY: Frank Kampas

Given that Sqrt[] always returns a non-negative result, I don't see how there could be a solution.

POSTED BY: Frank Kampas

For setting up equations, use == , not =. However, they don't appear to have a solution.

NSolve[{Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496, 
  Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382, 
  Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938}, {x, y, z}]

{}

POSTED BY: Frank Kampas
Posted 10 years ago

Reduce thinks there's no solution:

eqs = {Sqrt[(-19.4 + x)^2 + (20.8 + y)^2 + (-11.4 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -10.496, 
  Sqrt[(-16.5 + x)^2 + (29.2 + y)^2 + (-6.7 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.382, 
  Sqrt[(-17.6 + x)^2 + (33.2 + y)^2 + (1.3 + z)^2] + 
    Sqrt[x^2 + y^2 + z^2] == -8.938}  
  In[3]:= Reduce[eqs]

During evaluation of In[3]:= Reduce::ratnz: Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. >>

Out[3]= False
POSTED BY: David Keith
Posted 10 years ago

Ah, Yes Frank -- While I was examining the trees you noticed the forest. ;-)

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract