realpart strangeness, was: besselarray bug, was: Bessel plotting problem



On 6/10/08, Richard Hennessy <rvh2007 at comcast.net> wrote:

> I downloaded the new bessel.lisp and still get an error.
>
>  (%i75) draw2d(parametric(realpart(bessel_j(1/6,-(sqrt(1)*t^3)/3)*sqrt(t)), imagpart(bessel_j(1/6,-(sqrt(1)*t)/3)*sqrt(t)), t, -3, 3))$
>
> Maxima encountered a Lisp error:
>
>  Error in > [or a callee]: ((MTIMES SIMP) 0.32163376045133785
>                             ((MPLUS SIMP) 0.22273258887231484
>                              ((MTIMES SIMP) 0.12859472014273318 $%I))) is not of type (OR
>                                                                                        RATIONAL
>                                                                                        LISP:FLOAT).

OK -- there are 2 errors here.

The less serious is that draw2d doesn't handle non-float values gracefully.

The more serious is that realpart (and imagpart) assumes that any
function it doesn;t recognize (which includes Bessel functions) is
purely real. Yikes. Should return a noun expression in that case.
This bug was reported before:
http://sourceforge.net/tracker/index.php?func=detail&aid=1238141&group_id=4933&atid=104933

I'm pretty sure there are other bugs in the basic functions for complex
variables, realpart, imagpart, conjugate, carg, and cabs, maybe others.
I hope someone can take the time to review those functions & resolve
any existing or new bug reports.

As a work-around, try writing 'realpart(...), 'imagpart(...) in the expressions
to be plotted, and try plot2d instead of draw2d.

HTH

Robert Dodier