"draw((x^3)^(1/3),x=(-1)..0)" gives an error:

Result is not real.

The root of this bug is from makeFloatFunction,
which takes an expression and makes it into a Lisp
function, in this case:

(DEFUN %E (x) (DECLARE (DOUBLE-FLOAT x)) (c_to_rf (EXPT (EXPT x 3) (/ 1 3))))

However, in Common Lisp, "expt is defined as b^x = e^x log b."
"The result is always the principal complex value"
when the first arg is negative.  So in CL, "(EXPT -1 (/ 1 3))"
doesn't return "-1" but a complex value.

There are things like "compiledFunction" that don't
have this problem, but as the documentation of MKFLCFN
says: "compiled Lisp functions ...  by-passes the compiler
and interpreter, thereby gaining several orders of magnitude."

So what's the correct fix? Add a special case for
EXPT to change "(EXPT a b)" into "(- (EXPT (- a) b))"
when (< a 0)?

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to