Math - Need help solving two equations

Started by
14 comments, last by GameDev.net 19 years ago
Hi all, Can anyone think of an easy way to solve for t and r in the following two equations? t = 200 + r * |cos(600/r*t + 80) - cos(80)| 300 = r * [sin(600/r*t + 80) - sin(80)]
Advertisement
Hello, you seem relatively new so you may not have noticed. But questions that bear any resemblance to homework are frowned upon here. Anyway your question seems straight-forward enough, consider transposing the equations and looking into solving systems of linear equations .

I would not want to steal the joy of solving and the sense of accomplishment gained from solving mathematical equations from you..[smile]
Thanks for your reply, Daerax.

Quote:Original post by Daerax
But questions that bear any resemblance to homework are frowned upon here.


Actually this is not a homework problem, it's some fly paths of aircrafts that I am trying to program (but thanks for pointing it out, I'll try not doing it again...)

I was thinking of solving the equations using some numerical approximation methods as suggested to me (e.g. Newton's Method), but that's kind of messy so I was hoping someone may have some good ideas.

[Edited by - faculaganymede on March 29, 2005 12:23:45 PM]
Oh, now I feel stupid, Im apologize for saying that but I could not have known, it looked like your typical homework help question. Now Ill post more meaningfully.

When you say Newton's Method, Ill assume you mean the Newton-Raphson method for solving equations of the type f(x) = 0 and not the square root aproximation method [Newton] of which is a special case of NR.

I dont think numerical methods are necessary or even appropriate for the equations, simple algebra aught to do the trick [grin].

Having t = n, really messes things up:

So...the problem is not as simple as I thought...

[Edited by - Daerax on March 29, 2005 12:11:56 AM]
Just to clarify, I assume you are relying on the standard precedence rules so that 600/r*t = (600/r)*t? Also, keep in mind when you implement this numerically that standard sin(x) and cos(x) calls in a math library use radians, not degrees.

A complication for algebraic manipulation is that you have absolute value signs in the first equation. Solve the problem assuming the argument of the absolute value is nonnegative, and then solve the problem assuming it is negative. In the case of nonnegative, you have t = 200+r*(cos(A)-cos(80)) and 300 = r*(sin(A)-sin(80)), where A = 600*r/t. Consequently, cos(A) = (t-200)/r+cos(80) and sin(A) = 300/r+sin(80). Square and add together to obtain ((t-200)/r+cos(80))^2 + (300/r+sin(80))^2 = 1. Expand the left-hand side, use sin(80)^2+cos(80)^2 = 1, and multiply by r^2 to obtain [(t-200)^2+(300)^2] + r*[2*cos(80)*(t-200)+600*sin(80)] = 0. Solve for r and substitute into one of the original equations to obtain an expression in the single variable t. Now you can use a 1-dimensional root finder, which is a bit easier to implement than a 2-dimensional root finder. For each root t, compute the corresponding r, and verify that you have a solution to the original two equations. Repeat this process for t = 200-r*(cos(A)-cos(80)).

For informational purposes, a*sin(x) = b does not imply a*x = sin^{-1}(b). Similarly, a*cos(x) = b does not imply a*x = cos^{-1}(b).
Quote:Original post by Dave Eberly
...

For informational purposes, a*sin(x) = b does not imply a*x = sin^{-1}(b). Similarly, a*cos(x) = b does not imply a*x = cos^{-1}(b).


Proffessionally done, that should have been obvious, I tend to sloppily rush through things at times...Ill fix that, if only to reduce the misinformation on the board.
Im back for more! Since this left me unsettled.. I spent a few more minutes ( a few as in ~20) with the stuff and did a complete about face. This is not some trivial straight-forward to solve equation. Numerical methods, if even are what you gonna have to use.

As far as I can tell the equations with the given information are not solvable, at least not algebraically. I worked through Dave's suggestion and was unable to reconcile the results with the original given equation [as in even with that formulation the equation remained unsolvable]. I tried combinations of different trigonometric identities, exponential representations and natural logs all to no avail. As I can see the solution to the equation must be a surface. A method I considered but did not attempt to workout was to use the equation as given by Dave Eberly to create a t(r) and r(t) representation which will each be solved individually using numerical methods. consider a Maclaurins Series expansion of the equations [t(r) and r(t)], then solve with Newton Rhapson method or something, didnt really think that path through.

On a more logical note the equation seems to be a time varying sinusodial with a phase shift and angle difference, is this true? It then looks like the angular frequency is being divided by the amplitude of the wave? Does the equation v = ωr bear any relevance here? Just wondering as there seems to be not enough information.
As Daerax reported, it doesn't appear to be solvable through algebra. Trying to rewrite one unknown into the other (like you'd normally try with 2 unknowns in multiple equations) to solve it, doesn't quite get -me- anywhere. Maybe someone else can.

Not to let you down too much :P, if you'd have one unknown left in the equation and it's unsolvable through algebra, there are algorithms that can approach the solution. The Newton Raphson method can approach solutions for zero's [equation = 0]. If you aren't able to re-write the function in a single unknown, it won't help you though. And, ofcourse, an algorithm like that is suited only for a program (not for homework ;p, can't compile that into an exe).

If you (or Daerax or anyone for that matter) can rewrite the equation into a single unknown, Newton Raphson could be applied and your program's calculation may be saved :P.

Thanks everybody for your feedbacks.

Quote:Original post by DaeraxOn a more logical note the equation seems to be a time varying sinusodial with a phase shift and angle difference, is this true? It then looks like the angular frequency is being divided by the amplitude of the wave? Does the equation v = ùr bear any relevance here? Just wondering as there seems to be not enough information.

The two equations were derived from four equations, one of them is v=w*r. The equations represent two aircrafts moving toward one another, there's changes in relative elevation and azimuth angles.

I've found out that I may not need to make the various conditions/parameters in my program as complicated as I currently have. But, when I have time, I will try to solve the two equations. Thanks so much for all your good suggestions.

Hello again, I meant to post this earlier but lost track of this thread. I hope it is not too late for I think that it would be best if you went ahead and persued the other methods you thought of in your attempt to meet your goals. I say this for the following reasons:

I dont think your equation makes much sense physically [the tangled complication seems reason enough [grin]], perhaps you should relook at your choice and methods of derivation? I went ahead and wrote your equations in terms of ft,r(t) = 0 (thanks to the work done my Dave Eberly) and performing expansion of terms where neccessary. Attempting to find f(t) = 0 had results which made little sense, there were an infinite number of solutions. I think based on this, implementing Newton-Raphson method would be a waste.

It doesnt make sense physically that the angular velocity of the waveform would be divided by its amplitude, especially not when the equations are related in the manner they are. Anyway, thats my take on this; good luck and I again apologize for my presumption earlier.

This topic is closed to new replies.

Advertisement