plot2d




On Sat, 2 Jan 2010, Rupert Swarbrick wrote:

< mok-kong shen <mok-kong.shen at t-online.de> writes:
< 
< > Hello,
< >
< > This is a newbee's problem: I just tried wxMaxima 0.8.4 and entered as 
< > in the manual (chap. 1, Introduction to Maxima) the following command:
< >
< > plot2d(sin(x)/x,[x,-20,20])
< >
< > I obtained the plot but on ending the plot window there appeared a 
< > message in the main window:
< >
< > plot2d: expression evaluates to non-numeric value somewhere in 
< > plotting range.
< >
< > What had I done wrongly? Thanks for your help in advance.
< 
< What happened is that Maxima tried to evaluate sin(x)/x at x=0, getting
< 0/0, which doesn't make sense as a number. To check that's what's
< happening, you can perturb one of the interval ends very slightly so
< that you won't end up evaluating at zero:
< 
< (%i1) plot2d( sin(x)/x, [x,-20,20] );
< plot2d: expression evaluates to non-numeric value somewhere in plotting range.
< (%o1) 
< (%i2) plot2d( sin(x)/x, [x,-20,20.001] );
< (%o2) 
< (%i3) 
< 
< But, as you can see from the plot, Maxima and gnuplot are robust enough
< to ignore this problem and just not plot the point at all. Since there
< are lots of samples, you can't see the difference.
< 
< Rupert
< 

Try,
plot2d(if equal(x,0.0) then 1 else sin(x)/x,[x,-20,20]);

Leo.

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.