3 nonlinear equations with three unknowns

benlarsendk

New member
Joined
Sep 3, 2014
Messages
6
Hi!

I have this problem. This would not be such a problem if I used some kind of CAS, but since I am trying to write a code that can do it, I really need to know how wo solve it.
It is three equations of the circle, with three unknowns. The numbers are mostly random. But how do you solve for x and y in these equations?
Thank you and have a great day out there! :) :)

Capture.PNG
 
What do you actually want the code to do and what will be defined in the code. For example, the following pseudo code allows you to find the two real values of y0 (if they exist) for the first equation, given x0 and r
Code:
[B]input r and x[SUB]0[/SUB]
y[SUB]0[/SUB] = r * r - (x[SUB]0[/SUB] - 8) * (x[SUB]0[/SUB] - 8)
if y[SUB]0[/SUB] is less than zero then
  output there is no real valued solution
else
  y[SUB]0[/SUB] = square root of y[SUB]0[/SUB] 
  output one solution is 7 + y[SUB]0[/SUB]                          
  output the other solution is 7 - y[SUB]0[/SUB]                         
end if
end
[/B]

Of course you could have meant given the three equations what are the values of x0, y0, and r but that is a totally different question. So, just in case: Call the equations (1), (2) and (3) in order as given. Subtract equation (1) from (2). This will give you a linear equation in x0 and y0. Subtract equation (1) from (3). This will give you another linear equation in x0 and y0. You will now have two linear equation in two unknowns and can solve for x0 and y0 (either a unique solution or an infinite set of solutions). Given x0 and y0, that will then allow you to compute r.
 
Last edited:
If multiply out those squares you get
\(\displaystyle x_0^2- 16x_0+ 64+ y_0^2- 14y_0+ 49= r^2\)
\(\displaystyle x_0^2- 12x_0+ 36+ y_0^2- 10y_0+ 25= r^2+ 2\)
\(\displaystyle x_0^2- 4x_0+ 4+ y_0^2- 6y_0+ 9= r^2+ 3\)

Now, do you see that if you subtract one equation from another, all the squares will cancel, leaving you two linear equations in x and y?
 
Well the code is not the problem now - I am trying to describe through math how to solve it.
The circle is expanding, and at the point closest to center is (xa;ya), next point (xb;yb) and the last point (longest from center) (xb;yc).
The equation should end with r^2+[number] in () though. My mistake.

But how would you solve it, mathematicly?
 
I have tried expanding them (with new and correct numbers).
But I don't see how you would subtract them to get two linear equations - I might be dumb on the point, but is this some kind of matrix you are trying to make?
 
Well the code is not the problem now - I am trying to describe through math how to solve it.
The circle is expanding, and at the point closest to center is (xa;ya), next point (xb;yb) and the last point (longest from center) (xb;yc).
The equation should end with r^2+[number] in () though. My mistake.

But how would you solve it, mathematicly?
and
I have tried expanding them (with new and correct numbers).
But I don't see how you would subtract them to get two linear equations - I might be dumb on the point, but is this some kind of matrix you are trying to make?
Do you mean something different than what has been pointed out as the (start of a) solution as given by HallsofIvy? If so, I'm lost and not sure of what you mean. For example what do you mean by "The numbers are mostly random."? Which numbers? And again "(with new and correct numbers)" What numbers?

Yes, you can think of it as some kind of matrix where you are doing row reduction.
 
Last edited:
and

Do you mean something different than what has been pointed out as the (start of a) solution as given by HallsofIvy? If so, I'm lost and not sure of what you mean. For example what do you mean by "The numbers are mostly random."? Which numbers? And again "(with new and correct numbers)" What numbers?

Yes, you can think of it as some kind of matrix where you are doing row reduction.



The "random" numbers were just... numbers. The new numbers come from this description: Let us be on a football eld 100m x 100m. Let man a be at (60; 80), man b at(40; 80) and last man c at (10; 80). The di erence in time on arrival between a
and b is 0.059s, and between a and c is 0.147s. Our rexpand is in the second
equation 0:059  340 = 20 and in the third 0:147  340 = 50.
 
The "random" numbers were just... numbers. The new numbers come from this description: Let us be on a footballeld 100m x 100m. Let man a be at (60; 80), man b at(40; 80) and last man c at (10; 80). The dierence in time on arrival between a
and b is 0.059s, and between a and c is 0.147s. Our rexpand is in the second
equation 0:059 340 = 20 and in the third 0:147 340 = 50.

Since the speed of sound in air is about 340 m/s and one generally assumes cylindrically (circular) symmetry as a first approximation, what it looks like to me is that you have a sound going off at a ground location and you hear the sound at three different ground locations (or at least all at about the same height). You know the time difference between when the sound is heard at those locations and you would like to find out where the sound came from. At least something like that.

If that is the case, then what HallsofIvy started can be followed to its logical conclusion and a program could be developed to find the location based on that solution.
 
If multiply out those squares you get
\(\displaystyle x_0^2- 16x_0+ 64+ y_0^2- 14y_0+ 49= r^2\)
\(\displaystyle x_0^2- 12x_0+ 36+ y_0^2- 10y_0+ 25= r^2+ 2\)
\(\displaystyle x_0^2- 4x_0+ 4+ y_0^2- 6y_0+ 9= r^2+ 3\)

Now, do you see that if you subtract one equation from another, all the squares will cancel, leaving you two linear equations in x and y?

Subtracting the first equation from the second: \(\displaystyle 4x_0- 32+ 4y_0- 24= 2\) or \(\displaystyle 4x_0+ 4y_0= 58\)

Subtracting the second equation from the third: \(\displaystyle 8x_0- 32+ 4y_0- 16= 1\) or \(\displaystyle 8x_0+ 4y_0= 49\)
 
I still don't see how you would subtract equation 1 from two, and then two from three, in regards to the radius, and you would lose y0?
Udklip.PNG
 
HOW d'heck did you arrive at those equations? :confused:

These are the equations (use x, not x(o) and y, not y(o)...simpler):

x^2 - 16x + 64 + y^2 - 14y + 49 = r^2 [1]
x^2 - 12x + 36 + y^2 - 10y + 25 = r^2 + 2 [2]
x^2 - 4x + 4 + y^2 - 6y + 9 = r^2 + 3 [3]

Simplify above:
x^2 - 16x + y^2 - 14y = r^2 - 113 [1]
x^2 - 12x + y^2 - 10y = r^2 - 59 [2]
x^2 - 4x + y^2 -6y = r^2 - 10 [3]

Now the subtracting:
[2] - [1] : 4x + 4y = 54 [4] ....HallsofIvy shows 58 which is incorrect
I never was any good at arithmetic!

[3] - [2] : 8x + 4y = 49 [5]

...and finally:
[5] - [4] : 4x = -5 ; x = -5/4

Substitute in [4] or [5] to get y = 59/4

Btw, my previous post was showing you how to solve
through a computer program, with any variables (general case).
Was that what you were after...or only your original problem?
 
Top