Logged In: YES
user_id=588346
The problem is in the function MUL2*, which uses f* to
multiply non-fixnums: (MUL2* -1 -150.5) returns -269521184.
The correction is to replace "f*" by "*" in MUL2* (in opers.lisp).
Maxima version: 5.9.0rc1
Maxima build date: 11:40 9/3/2002
host type: i686-pc-linux-gnu
lisp-implementation-type: Kyoto Common Lisp
lisp-implementation-version: GCL-2-5.0
(C2) display2D:false$
(C3) f(x):=x^3-10*x^2+28.5*x-21$
(C4) rhs(solve(f(x),x)[1]),rectform,numer;
RAT replaced 28.5 by 57//2 = 28.5
RAT replaced 28.5 by 57//2 = 28.5
RAT replaced 0.5 by 1//2 = 0.5
RAT replaced -4.18055555555556 by -301//72 =
-4.18055555555556
(D4) 3.897114317029973*%I+0.75
******** which is wrong *******
(C5) y:rhs(solve(f(x),x)[1]),rectform$
RAT replaced 28.5 by 57//2 = 28.5
(C6) y,numer;
(D6) 3.318006917974609
******* which is correct ******
M.At.Stanev reports with Maxima 5.5
(C1) f(x):=x^3-10*x^2+28.5*x-21;
(D1) ...
(C2) rhs(solve(f(x),x)[1]),rectform,numer;
(D2) 12.01301985645547*%I+10.38424295325536
Martin
Logged In: YES
user_id=588346
The problem is in the function MUL2*, which uses f* to
multiply non-fixnums: (MUL2* -1 -150.5) returns -269521184.
The correction is to replace "f*" by "*" in MUL2* (in opers.lisp).
Logged In: YES
user_id=651552
I replaced f* by * in mul2* in 5.9.0rc3, but got still different behaviour using the two
approaches - the difference is rather small now, so it might be ok, but I do not
understand why there is a difference...
(C1) f(x):=x^3-10*x^2+28.5*x-21$
(C2) rhs(solve(f(x),x)[1]),rectform,numer;
RAT replaced 28.5 by 57//2 = 28.5
RAT replaced 28.5 by 57//2 = 28.5
RAT replaced 0.5 by 1//2 = 0.5
RAT replaced -4.18055555555556 by -301//72 = -4.18055555555556
(D2) 2.220446049250313E-16 %I + 3.318006917974608
--------------------------------- whereas -----------------------------------
(C3) y:rhs(solve(f(x),x)[1]),rectform$
RAT replaced 28.5 by 57//2 = 28.5
(C4) y,numer;
(D4) 3.318006917974609
Logged In: YES
user_id=588346
First thing to note: in "foo,numer,rectform", the "numer" and
the "rectform" actually have very different meanings. Numer
sets the numer flag *during* the evaluation of foo, whereas
rectform simply calls rectform on the result of the evaluation
of foo. That is, "foo,numer,rectform" is equivalent to rectform
(ev(foo,numer)).
Thus, solve(...),numer,rectform calculates the roots with
numerical, not symbolic, intermediate results, then takes the
rectform of that. On the other hand, y:solve(...),rectform$
y,numer; calculates the solutions numerically, then takes the
symbolic rectform, then evaluates numerically.
So it is not surprising that the two results will be slightly
different.
Logged In: YES
user_id=28849
Closing this.
I think the results are what you might expect from numerical
roundoff.
Log in to post a comment.