plot2d SciMax Toolbox plot_options

SciMax Toolbox >> plot3d

plot3d

Maxima Function

Calling Sequence

plot3d ([expr_1, expr_2, expr_3], x_range, y_range, ..., options, ...)
plot3d(expr,x_range,y_range,...,options,...)
plot3d(name,x_range,y_range,...,options,...)
plot3d([expr_1,expr_2,expr_3],x_rge,y_rge)
plot3d([name_1,name_2,name_3],x_range,y_range,...,options,...)

Description

Displays a plot of one or three expressions as functions of two variables.

(%i1) plot3d (2^(-u^2 + v^2), [u, -3, 3], [v, -2, 2]);

plots z = 2^(-u^2+v^2) with u and v varying in [-3,3] and [-2,2] respectively, and with u on the x axis, and v on the y axis.

The same graph can be plotted using openmath (if Xmaxima is installed):

(%i2)  plot3d (2^(-u^2 + v^2), [u, -3, 3], [v, -2, 2],
               [plot_format, openmath]);

in this case the mouse can be used to rotate the plot to look at the surface from different sides.

An example of the third pattern of arguments is

(%i3) plot3d ([cos(x)*(3 + y*cos(x/2)), sin(x)*(3 + y*cos(x/2)),
   y*sin(x/2)], [x, -%pi, %pi], [y, -1, 1], ['grid, 50, 15]);

which plots a Moebius band, parametrized by the three expressions given as the first argument to plot3d. An additional optional argument ['grid, 50, 15] gives the grid number of rectangles in the x direction and y direction.

The function to be plotted may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression. In the form plot3d (f, ...) where f is the name of a function or a lambda expression, the function must be a function of two arguments. In the form plot3d ([f_1, f_2, f_3], ...) where f_1, f_2, and f_3 are names of functions or lambda expressions, each function must be a function of three arguments.

This example shows a plot of the real part of z^1/3.

(%i4) plot3d (r^.33*cos(th/3), [r, 0, 1], [th, 0, 6*%pi],
      ['grid, 12, 80], ['transform_xy, polar_to_xy]);

Other examples are the Klein bottle:

(%i5) expr_1: 5*cos(x)*(cos(x/2)*cos(y) + sin(x/2)*sin(2*y)
      + 3.0) - 10.0$
(%i6) expr_2: -5*sin(x)*(cos(x/2)*cos(y) + sin(x/2)*sin(2*y)
      + 3.0)$
(%i7) expr_3: 5*(-sin(x/2)*cos(y) + cos(x/2)*sin(2*y))$
(%i8) plot3d ([expr_1, expr_2, expr_3], [x, -%pi, %pi],
      [y, -%pi, %pi], ['grid, 40, 40]);

and a torus:

(%i9) expr_1: cos(y)*(10.0+6*cos(x))$
(%i10) expr_2: sin(y)*(10.0+6*cos(x))$
(%i11) expr_3: -6*sin(x)$
(%i12) plot3d ([expr_1, expr_2, expr_3], [x, 0, 2*%pi],
       [y, 0, 2*%pi], ['grid, 40, 40]);

Sometimes it is necessary to define a function to plot the expression. All the arguments to plot3d are evaluated before being passed to plot3d, and so trying to make an expression which does just what is needed may be difficult, and it is just easier to make a function.

(%i13) M: matrix([1, 2, 3, 4], [1, 2, 3, 2], [1, 2, 3, 4],
       [1, 2, 3, 3])$
(%i14) f(x, y) := float (M [?round(x), ?round(y)])$
(%i15) plot3d (f, [x, 1, 4], [y, 1, 4], ['grid, 4, 4])$

See for more examples.

plot2d SciMax Toolbox plot_options