-
Change from exponent
Hey
I need to change this equasion around so that it doesnt use the exponent function. i know you can do it, i just how. Any suggestions, in desperate need of help. An example of what values my be in the variables are:
Best_A = 22.164
Best_B = 2.813
Best_h0 = 1.008
Y = 0.4
Code:
X = Best_A * (Y - Best_H0) ^ Best_B
Thanks
-
The result is imaginary.
VB math doesn't do imaginary numbers.
I'd suggest On Error Goto sub handling.
-
Re: Change from exponent
Quote:
Originally posted by CanucksRule
Best_A = 22.164
Best_B = 2.813
Best_h0 = 1.008
Y = 0.4
Code:
X = Best_A * (Y - Best_H0) ^ Best_B
You still can operate with imaginary numbers as long as you stick to the rules. For example, (Y - Best_H0) ^ Best_B could be expressed as:
(0.4 - 1.008)2.813 = (-0.608)2.813 = (-1)2.813 * (0.608)2.813 = (-1)2.813 * 0.247 (approx.)
Call x the first (imaginary) term and compute it as:
x = (-1)2.813
ln(x) = 2.813 ln(-1) = 2.813*i*Pi (because -1 = exp(i*Pi))
where i=Sqr(-1)
so:
x = exp(2.813*i*Pi) = cos(2.813*Pi) + i*sin(2.813*Pi) = 0.988 + i*0.154
And finally you get:
(0.988 + i*0.154)*0.247 = 0.244 + i*0.038 (approx.)
(and now multiply this by Best_A)