Re: Algebra problem
- Posted by Al Getz <Xaxo at aol.com> Jul 07, 2005
- 582 views
Hi there, This looked interesting so i entered two forms of the solution into my Scientific Calculator programmed in Euphoria of course :) My first thought was to simply use a numerical solver to try this, but then i decided to use the other solution also and compare results. For reference the calculator's built in solver has this simple syntax: x=Solve(LeftSide,RightSide,x,guess,max_iterations,errorlimit) where x is the var being solved for LeftSide is the left side of the equation (A^b+C*b) RightSide is the right side of the equation (D) (d made cap D for clarity) guess is the initial guess max_iterations is the max number of iter's to attempt to find the solution errorlimit is the desired max error of the value of x returned I entered these lines exactly like this: A=2 C=3 D=5 b1=Solve(A^b+C*b,D,b,1,100,1e-6) lambertw(X)=Solve(w*e^w,X,w,1,100,1e-6) b2=-(lambertw(ln(A)/C*e^(D*ln(A)/C))*C-D*ln(A))/ln(A)/C (i copy and pasted the right side of this last line assuming it was correct) then selected all six lines and hit "In Place Eval" and i got two answers...b1 is using the direct built in solver, and b2 is using the built in solver to calculate lambertw(X) to whatever precision the errorlimit is set to and then find the solution given in the previous post. Using the direct built in solver, b1=1 exactly (to 16 digits). Using the alternate solution, b2=0.999999673312148. From examining the alternate solution for other error limits, i could quickly see that the precision of the answer depended mostly on the error in calculating lambertw(X). If i decreased the error limit, i got a better answer. Actually i entered a second form for lambertw(X) also and got the same results as for the previous lambertw(X)...the higher the accuracy in calculating lambertw the better the final answer. I havent investigated the numerical stability of either method any further however, and one should keep in mind that functions like this can get quickly out of hand when dealing with the limit of 16 digits on most computers without additional numerical support. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"