Can someone simplyfy this?

N

nobbyknownowt

Hi there all.
I have an equation as part of a long algorithm

a * cos (A) + (b-f) sin (A) - p * cos^2(A) = 0

The solution of which I need is A = 0

I have variables for a,b,f&p entered in cells (say a1,a2,a,3,a4) th
angle (A) could be between 0,90

Now then the result for say if a=1430 b=1651 f=7984 & p=600 would b
close to 7.5124035 (although that answer actually returns 0.0007670
and not 0)

I had originally thought it would be enough to run the equation in
spreadsheet with the variables in a box and then run the calculatio
900 times and vlookup the nearest to 0 bu0t have found that eve
withthe number setting set to no decimal places I need at least
decimal places. That would mean I would need to run the calculatio
900*900*900&^*&% alot of times.

I could round the number but then I'm likely to get more than on
answer.

Is there an easier way of doing this acurately without resorting t
lookup closest match???


cheers
Nobb
 
R

robert111

YOU SAY ANGLE a IS BETWEEN 0 AND 90 THEN SAY THE SOLUTION FOR A= 143
IS................

can you clarify, pleas
 
K

Ken Johnson

Hi,

I used Goal Seek and came up with an answer of A = 0.131116 which is in
radians and this converts to 7.512403516 degrees using
=DEGREES(0.131116).

Ken Johnson
 
D

Dana DeLouis

Would this work for you? It returns an answer in Degrees:
This needed about 4 loops. (I used 'x for your angle)

7.51240351575601

Sub TestiT()
Dim a, b, f, p
a = 1430
b = 1651
f = 7984
p = 600
Debug.Print Find_x(a, b, f, p)
End Sub

Function Find_x(a, b, f, p)
Dim x As Double
Dim t As Double
Dim j As Long
x = 0
t = 1
Do While x <> t
t = x
x = x + (Cos(x) * (a - p * Cos(x)) + (b - f) * Sin(x)) / _
(a * Sin(x) + Cos(x) * (f - b - 2 * p * Sin(x)))
Loop

'// x is in Radians
'// If Degrees is desired then
x = WorksheetFunction.Degrees(x)
Find_x = x
End Function
 
D

Dana DeLouis

A slight change reduces the number of Trig functions from 6 to 4.

In Radians:
Function Find_x(a, b, f, p)
Dim x As Double
Dim t As Double
Dim j As Long
x = 0
t = 1
Do While x <> t
t = x
x = x + (a + (b - f) * Tan(x) - p * Cos(x)) / _
(f - b + a * Tan(x) - 2 * p * Sin(x))
Loop
Find_x = x
End Function

--
HTH. :>)
Dana DeLouis
Windows XP, Office 2003


Dana DeLouis said:
Would this work for you? It returns an answer in Degrees:
This needed about 4 loops. (I used 'x for your angle)

7.51240351575601

Sub TestiT()
Dim a, b, f, p
a = 1430
b = 1651
f = 7984
p = 600
Debug.Print Find_x(a, b, f, p)
End Sub

<snip>
 
Top