How to plot floor function in Maxima?
f4(x) := floor(x);
How to plot floor function in Maxima?
f4(x) := floor(x);
Gnuplot doesn't detect points of discontinuity, so you have to make them explicit.
With Gnuplot, you can do:
N=1000
set sample N
plot (abs(x-floor(x))<1./N*(GPVAL_X_MAX-GPVAL_X_MIN))?1/0:floor(x)
With Maxima, you can do the same using the gnuplot_preamble option to set sample:
fl(x,N,Xmin,Xmax):=if (abs(x-floor(x))<1./N*(Xmax-Xmin)) then nan else floor(x);
Xmin:-10; Xmax:10;
plot2d(fl(x,1000,Xmin,Xmax),[x,Xmin,Xmax],[gnuplot_preamble, "set sample 1000"]);
maxima solution. In my case I didn't get rid of vertical lines with setting [gnuplot_preamble, 'set sample 1000'] in plot2d. What is GPVAL_X_MAX, GPVAL_X_MIN? Do I need to modify f(x) := floor(x) line in maxima?