To make the axes ratio same, use the command [yx_ratio,1]. For example
plot2d([parametric,cos(t),sin(t),[t,0,2*%pi]],[yx_ratio,1]);
To draw a list data us the following command
plot2d([discrete, data]);
For example to plot the list [ [¡3; 9 ]; [¡ 2 ; 4]; [¡1; 1]; [0; 0]; [1; 1]; [2; 4]; [3; 9]] use
data:makellist([i,i^2],i,-3,3);
plot2d([discrete, data]);
To draw 3D plots
plot3d(f,[x,x0,x1],[y,y0,y1]);
For example
plot3d(%e^(x+y)*sin(x*y),[x,0,%pi],[y,0,%pi]);
To draw an implicit function f(x; y) = 0, load first the package as
load(implicit_plot);
and then draw by
implicit_plot(f(x,y)=0,[x,x0,x1],[y,y0,y1]);
For example the following command draw a circle with radius 2:
implicit_plot(x^2+y^2=4,[x,-2,2],[y,-2,2]);
To draw the slope field (or vector field) of a differential equation, you should fir st load
the package plotdf as
load(plotdf);
and then to draw the slope field. For example to draw the field of the equation y
0
= sin(y)
just write
plotdf(sin(y),[x,x0,x1],[y,y0,y1]);
When you click on the plot page, a trajectory is appeared passing through the click point.
In order to draw the vector field [f(x; y); g(x; y)] just write
plotdf([f,g],[x,x0,x1],[y,y0,y1]);
For example the vector field V = (¡y; x) in ¡1 ≤x ≤1 and ¡1 ≤y ≤1 can be plotted as
plotdf([-y,x],[x,-1,1],[y,-1,1]);
To draw a trajectory starting at, say (0.5; 0.5) write
plotdf([-y,x],[x,-1,1],[y,-1,1],[trajectory_at,0.5,0.5]);
To sol ve an initial val ue problem numerically, use the Runge-Kutta method. The
command
rk(f(x,y),y,y0,[x,x0,x1,xstep]);
solves the i.v.p. y
0
= f(x; y), y(x
0
) = y
0
for x
0
≤x ≤x
1
for steps xstep.
For example, the i.v.p. y
0
= cos(2x) + ye
¡y
, y(0) = 1 is solved numerically for 0 ≤x ≤5 as
rk(cos(2*x)+y*%e^(-y),y,1,[x,0,5,0.1]);
To draw the integral curve o f the above i.v.p. use the following command
data:rk(cos(2*x)+y*%e^(-y),y,1,[x,0,5,0.1]);
plot2d([discrete,data]);
For a system of equations y
0
= f(x; y; z), z
0
= g(x; y; z) do as follows.
data:rk([f,g],[y,z],[y0,z0],[x,x0,x1,xstep]);
plot2d([discrete,makelist([p[1],p[2]],p,data)]);
that above command plot y(x). To draw z(x) use
plot2d([discrete,makelist([p[1],p[3]],p,data)]);
and to draw the phase portrait (y(x); z(x)) use
26 Basic commands in wxMaxima