realpart strangeness, was: besselarray bug, was: Bessel plotting problem
Subject: realpart strangeness, was: besselarray bug, was: Bessel plotting problem
From: Richard Hennessy
Date: Thu, 12 Jun 2008 22:41:20 -0400
I think then the idea is not to tell draw where the points came from so I tried this and it works.
(%i2) expr:expand(sum((-1)^k*2^(-v-2*k)*z^(v+2*k)/(k!*gamma(v+k+1)),k,0,100))$
(%i3) myf(v,z):=''expr$
(%i21) mypoints:makelist([t/2, float(realpart(myf(1/6,t/2))), float(imagpart(myf(1/6,t/2)))], t, -30,30);
(%i20) draw3d(color=royalblue,point_size=1, points_joined=true,point_type = dot, points(mypoints));
Now draw has no idea that the points were coming from a complex valued function, so it works.
Rich
------------Original Message------------
From: Mario Rodriguez <biomates at telefonica.net>
To: "Robert Dodier" <robert.dodier at gmail.com>
Cc: "Maxima List" <maxima at math.utexas.edu>
Date: Thu, Jun-12-2008 2:56 PM
Subject: Re: [Maxima] realpart strangeness, was: besselarray bug, was: Bessel plotting problem
Robert Dodier escribi?:
> 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 origin of the problem is that draw expects the returned values of
functions defined by coerce-float-fun in plot.lisp to be always real
numbers, but sometimes they are and sometimes they are not.
The above complex result was returned by
(funcall fcn x)
where fcn was previously defined via coerce-float-fun
For example, this problem appears here:
draw2d(explicit(bessel_j(1/6,-t), t, 1, 3)) $
but not here:
draw2d(explicit(sqrt((%i+x/5)^3), x, 1, 3)) $
I suppose that draw should make some tests after calling functions
created by coerce-float-fun.
--
Mario Rodriguez Riotorto
http://www.telefonica.net/web2/biomates
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima