I came up with 3.73250246, ignoring C
"medialint" wrote:
Something like this, though if C isn't worth mentioning then why put it in?
Sub LoopSolve()
Randomize
Dim myRandomNum As Single
Dim YRow As Long
Dim XAdd As Long
Dim CalcDiff As Single
YRow = 2
Worksheets("Sheet1").Cells(1, 1) = "Number"
Worksheets("Sheet1").Cells(1, 2) = "Difference"
Do
myRandomNum = Rnd * 1000
CalcDiff = Abs((1 / (myRandomNum ^ 0.5)) - (2 * Log(myRandomNum ^ 0.5) - 0.8))
Worksheets("Sheet1").Cells(YRow, 1 + XAdd) = myRandomNum
Worksheets("Sheet1").Cells(YRow, 2 + XAdd) = CalcDiff
YRow = YRow + 1
If YRow 65536 Then
YRow = 2
XAdd = XAdd + 2
End If
Loop Until CalcDiff < 0.001
End Sub
"mrmark " wrote:
I have a equation that you can solve only by trial an error, but I want
excel to do the work for me. The equation is this
1/(X^.5)=2Log(C*X^.5)-.8
Where c is some constant that isant worth mentioning ;)
and the Log is base 10.
Ok I need a macro that will keep trying values untill one side is equal
to the other up to .001 decimal places. I tried making some sort of
random function generator, but it seems like the random function kept
repeating certain values. Any advice/help is appericated.
-Mark
---
Message posted from http://www.ExcelForum.com/