Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 947
Default formula code

Hi. For discussion, these types of problems need to have some type of
checking. We note that different values of a,b,f, & p can make this harder
to solve.
If we make our first guess 0, then we note that for this problem, there is
no need to calculate the big equation for the next value. It simplifies to
just:
x = (p - a) / (b - f)

So, instead of starting out with x=0, it would be better to use x= (p - a)
/ (b - f). This reduces the number of loops by 1.
However, it is now clearer to see that there will be an error if b = f !!
The closer b is to f, then x will tend to be a large number. The code will
zero in on a very large angle x.
Your code will have to adjust if you think b=f, p=a, x is a large number,
....etc.
A slight improvement, but not complete, might be something like this:

Function Find_x(a, b, f, p)
Dim x As Double
Dim t As Double

On Error Resume Next
x = (p - a) / (b - f)
If x = 0 Then x = 1 'try different value

Do
t = x
x = x + (a + (b - f) * Tan(x) - p * Cos(x)) / _
(f - b + a * Tan(x) - 2 * p * Sin(x))
Loop Until Round(x - t, 16) = 0
Find_x = x
End Function

One example might be that if b =f, then the loop equation could be reduced
to :
x = x + (p*Cos(x) - a)/(2*p*Sin(x) - a*Tan(x))

Again, lots of variations to account for different values.
--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


 
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
Formula Help Price Code natei6 Excel Worksheet Functions 1 March 4th 06 02:29 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Formula for Extracting Alphabetic Part of a Product Code ob3ron02 Excel Worksheet Functions 1 October 29th 04 06:07 PM


All times are GMT +1. The time now is 09:42 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"