plotting a parametric integral



El vie, 09-10-2009 a las 02:10 +0400, Stanislav Maslovski escribi?:
> Hello,
> 
> I am trying to plot this simple Fourier integral in Maxima 5.17.1:
> 
> (%i1) display2d : false$
> 
> (%i2) f(k):=integrate(exp(%i*k*x)*sin(x)/x,x,minf,inf)$
> 
> (%i3) [f(0), f(1), f(3/2)];
> 
> (%o3) [%pi,%pi,0]
> 
> So far so good.
> 
> (%i4) plot2d(f,[x,-3,3]);
> 
> (%o4) 
> (%i5) Warning: empty y range [0:0], adjusting to [-1:1]
> 
> Theoretically, f(k) must be equal to %pi for k in [-1;1] and 0
> outside. The plot does not show anything in [-1;1].
> 

Hello,

The draw package has a similar problem. When the function returned by
coerce-float-fun is applied to x values in the range [-1,1] to get the
corresponding ordinate, it returns $%pi, instead of a float. An extra
call to $float fixes this problem.

Perhaps a better solution is to modify coerce-float-fun, if possible, so
that both plot and draw work as expected. The alternative is to add some
extra calls to Maxima's float function in several places.






Stanislav, I have commited a new version of draw with this quick fix:

http://maxima.cvs.sourceforge.net/viewvc/*checkout*/maxima/maxima/share/draw/draw.lisp


draw2d(explicit(f,x,-1.5,1.5));

should now work, but it takes a lot of time to be plotted due to the
adaptive algorithm. This version is faster:

draw2d(adapt_depth=1, explicit(f,x,-1.5,1.5));



> Moreover, if I try this plotting command
> 
> plot2d(f(k),[k,-3,3]);
> 
> I get a stupid question about the sign of k-1.
> 
> Can anyone explain what is wrong here?
> 

Maxima tries to evaluate the general expression f(k) before the
generation of the list of pairs.





-- 
Mario