Re: Algebra problem
Erik-Jan van Kampen wrote:
> Derek Parnell wrote:
>
>> My high school algebra has deserted me
>>
>> Given the formula
>>
>> A^b + Cb = d
>>
>> how do I solve for 'b'?
>
>
> Hi Derek,
>
> From the Matlab 6.5 Symbolic Toolbox:
>
>>> solve(A^b+C*b-d,b)
>
> ans =
>
> -(lambertw(log(A)/C*exp(d*log(A)/C))*C-d*log(A))/log(A)/C
>
>>> help lambertw
>
> LAMBERTW Lambert's W function.
> W = LAMBERTW(X) is the solution to w*exp(w) = x.
> W = LAMBERTW(K,X) is the K-th branch of this multi-valued function.
> Reference: Robert M. Corless, G. H. Gonnet, D. E. G. Hare,
> D. J. Jeffrey, and D. E. Knuth, "On the Lambert W Function",
> Advances in Computational Mathematics, volume 5, 1996, pp. 329-359.
> Also available from:
> http://pineapple.apmaths.uwo.ca/~rmc/papers/LambertW/index.html
Interesting!
I just wrote a "brute force" lambertw() function in Euphoria, and
calculated the example that I gave in my other post:
constant
E = 2.718281828459045235
type nonnegative_atom (object x)
if atom(x) then
return x >= 0
end if
return 0
end type
function lambertw (nonnegative_atom x)
for w = 0 to x by 0.001 do
if w*power(E,w) >= x then
return w
end if
end for
return 0
end function
atom A, C, d
A = 2
C = 3
d = 5
? -(lambertw(log(A)/C*power(E,d*log(A)/C))*C - d*log(A)) / log(A) / C
Prints 0.9986988627 -- the correct result is 1.
Regards,
Juergen
|
Not Categorized, Please Help
|
|