0
   

equation to solve

 
 
Reply Tue 13 Sep, 2011 08:23 am
Hi

I am new to this forum. I am struck with a problem .

I have following equation to solve please help.

X = COS (A) / - (SIN (A) * Y + Z )

here X , Y and Z are known constants , I have to find the angle A that satisfies this equation. In fact I am trying to write a small computer program to do this job (to find A once X,Y,Z are given)

Regards
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,820 • Replies: 10
No top replies

 
markr
 
  1  
Reply Tue 13 Sep, 2011 01:38 pm
@babalipk,
You'll likely find zero or two solutions. I can't come up with a closed form solution. A program to find one or both solutions (or determine that a solution doesn't exist) shouldn't be hard to write.
0 Replies
 
engineer
 
  1  
Reply Tue 13 Sep, 2011 02:55 pm
@babalipk,
X = COS (A) / - (SIN (A) * Y + Z )
-X (SIN (A) * Y + Z ) = COS (A)
X^2 (SIN (A) * Y + Z )^2 = COS^2 (A) = 1 - SIN^2 A

Simplify and now you have an equation in terms of Sin^2 A and Sin A. Solve via the quadratic formula.
markr
 
  1  
Reply Tue 13 Sep, 2011 08:18 pm
@engineer,
Nice!
0 Replies
 
babalipk
 
  1  
Reply Wed 14 Sep, 2011 10:47 am
@engineer,
Thanks for replies, however I am still confused , especially the signs (quadrants).

The Equation I showed earlier is in reality like this:


TAN(P) = COS (A) / - [ SIN (A)*COS(E) + TAN(L)*SIN(E)]

Here :

P : Can have any value between 0 to 360 Degrees
E : Typical value is around 23 Degrees.
L : Can assume values between -90 Degrees to +90 Degrees
A : Can have value between 0 - 360 degrees

I have sample data (all in Degrees):

P = 281.1531
E= 23.4374
L = 16.8666

AND

A = 199.9208

(Value of A is to be found , when P,E,L are given)

Now as per the suggestions received ,

As a first step I replaced COS A by SQRT (1 - SIN2 A)

COS A = COS (199.9208) = -0.94016
SQRT (1 - SIN A2) = SQRT( 1 -0.116091) = SQRT(0.8839)=0.94016

So there is sign change for COS(A) :: SQRT(1-SIN(A)2)



Similar confusion is with TAN Square required at a later step.

Because of this Sign changes (perhaps the Quadrant changes) Ia m finding it difficult to make this a generalized , to convert it into a computer program.


Can anybody explain this , any workaround, anything is missing,?

Any help?
AndyCharles
 
  0  
Reply Wed 14 Sep, 2011 10:51 am
@babalipk,
Hello there,

This is very nice question abot how to solve equation. Most equations with exponentials in them aren't soluble, especially when exponentials with different bases get added. Just take logarithm of both sides; in this case, natural log works well.

Thanks a lot
Andy Charles
0 Replies
 
markr
 
  1  
Reply Wed 14 Sep, 2011 08:12 pm
@babalipk,
In playing around with this a bit, I've found that the arcsins of the roots of the quadratic equation either provide valid solutions, or they need to be subtracted from pi to provide valid solutions. So, it may be as simple as coding up the quadratic formula and testing up to four values (depends on how many roots you get):
arcsin(root1), arcsin(root2), pi-arcsin(root1), and pi-arcsin(root2)
to determine up to two angles that solve your equation.

I don't guarantee that this is true for all cases. I just did a bit of experimentation.
babalipk
 
  1  
Reply Thu 15 Sep, 2011 10:06 am
@markr,
Yes, that's the case. I created the program and finally ended up into getting 4 answers, in really there is only one angle A for given value of P. Further because of lots of conversions I am losing bits means I am getting 156 while value needed is 158. That must to fine tuned through iterative process to arrive at an exact angle .

Anyway thanks a lot for the help.

Regards
markr
 
  1  
Reply Thu 15 Sep, 2011 01:14 pm
@babalipk,
I used Excel and didn't have any problems with precision. I'd expect double precision floating point to provide you with plenty of precision. You shouldn't have to iterate at all. What language are you using?

There may be only one angle that is appropriate for your application, but in general, there will be two solutions.
babalipk
 
  1  
Reply Fri 16 Sep, 2011 06:35 am
@markr,
Hi

Thanks for the update. Indeed I was making some silly mistakes in the calculation. Anyway now I got the program up and running. I code in C#.

The calculations are for some Astronomy function.

Thanks everybody.

Regards
engineer
 
  1  
Reply Fri 16 Sep, 2011 07:04 am
@babalipk,
Congrats. Welcome to A2K. Feel free to come back any time.
0 Replies
 
 

Related Topics

Amount of Time - Question by Randy Dandy
logical number sequence riddle - Question by feather
Calc help needed - Question by mjborowsky
HELP! The Product and Quotient Rules - Question by charsha
STRAIGHT LINES - Question by iqrasarguru
Possible Proof of the ABC Conjecture - Discussion by oralloy
Help with a simple math problem? - Question by Anonymous1234567890
How do I do this on a ti 84 calculator? - Question by Anonymous1234567890
 
  1. Forums
  2. » equation to solve
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.07 seconds on 12/22/2024 at 07:11:36