Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 57
Default Can someone simplyfy this?

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) the angle (A) could be between 0,90

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

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

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

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


cheers
Nobby
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Can someone simplyfy this?


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

can you clarify, please


--
robert111
------------------------------------------------------------------------
robert111's Profile: http://www.excelforum.com/member.php...o&userid=31996
View this thread: http://www.excelforum.com/showthread...hreadid=568952

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Can someone simplyfy this?

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 947
Default Can someone simplyfy this?

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

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


"nobbyknownowt" wrote in message
...

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) the
angle (A) could be between 0,90

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

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

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

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


cheers
Nobby




--
nobbyknownowt



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 947
Default Can someone simplyfy this?

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" wrote in message
...
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




  #6   Report Post  
Member
 
Posts: 57
Default

Hello all, thanks for taking the time and trouble to reply.

robert111 a=1431 A=? Sorry, poor choice of identifiers. a stemmed from a measurement while A was shortened from Alpha.

Ken can goal seek work automatically as part of an algoritm?

Dana . Sounds like just what I need, but what do i do with the code? Sorry but my limited excel knowledge stumps me.
Where do I put it? on theworksheet via view code or in a macro and then can I run it automatically as part of an algorithm. Ideally I want to find the angle then use that angle as part of the next calculation.

Heres hoping
Nobby
  #7   Report Post  
Member
 
Posts: 57
Default

Can anyone help???

Help I have kindly been given this code.

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 + (a + (b - f) * Tan(x) - p * Cos(x)) / _
(f - b + a * Tan(x) - 2 * p * Sin(x))
Loop
Find_x = x
End Function

But not told what to do with it in order to get the result on a worklsheet.

Any advice will help me move onto the next step of the worksheet

Tanks
Nobby
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
simplyfy and help on errors jerry Excel Discussion (Misc queries) 2 October 7th 05 08:04 PM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"