float to float exponent, was: Problem with plotting function defined condionally



On 6/7/08, Olive <not0read0765 at yopmail.com> wrote:

> > My problem is not really to plot croot but I want to define a function
>  > croot that I can use to define more complex function to be plotted, for
>  > example I want to be able to write plot2d(croot(x^2),[x,-5,-5]). I
>  > always end up with this simplification problem; don't you know a work
>  > around that would force maxima to compute croot without any simplification?
>
> I answer to myself; the following definition works (for plot2d):
>
>  croot(x) := if x>0 then x^(0.3333333333333333) else
>  -(-x)^(0.3333333333333333) $

I'm glad that you found something which works, although it is
discouraging that you had to resort to such a non-obvious tactic.

After thinking about this some more, I think this is the origin of the problem:

(<negative literal float>)^(1/3) => <negative literal float>
(<negative literal float>)^float(1/3) => (<negative literal
float>)^.3333333333333333

The second result makes sense because float(1/3) is
a rational number not quite equal to 1/3, and in general
(<negative literal float>)^(<random rational>) does not simplify.

plot2d wants to get a numerical result so it evaluates the expression
to plot with numer=true. But that changes foo^(1/3) to foo^(float(1/3))
which changes the way it is simplfiied ... Maybe there should be a
symbolic cube root function, just as there is a symbolic square root
function, which would not be susceptible to float?

It's easy to see what is going on here, but I don't see any clear path
out of it.

best

Robert Dodier