> plot3d(x^2+y^2, x=-1..1, y=-1..1);
Dynagraph will pop up a graphics window and display
the graph of x^2+y^2
(a paraboloid of revolution.)
Try grabbing the graph with the mouse pointer (with the left button down) and
moving it. Try zooming in and out with the zoom dial. Pull down
the Style menu and select an alternative style for the graph.
Select the Shading menu and change the color of the graph.
Select the Options menu and change the color of the background.
Also try clicking on the Spin button, which will put the graph in autospin. You can control the axis and speed of rotations by grabbing and "pushing" the graph with the mouse pointer.
Now try another plot:
> plot3d(x^2-y^2, x=-1..1, y=-1..1);
You don't have to type the entire expression. Simply hit the keyboard's up-arrow to recall the previous command. Edit the line by changing the plus sign to a minus sign and hit return. The previous graph will be replaced with a new graph (a hyperboloid.)
You can display both graphs simultaneously by enclosing their descriptions in curly braces, as in:
> plot3d({x^2+y^2, x^2-y^2}, x=-1..1, y=-1..1);
An alternate way would be to assign names to each of the two graphs, as in:
> p1 := plot3d(x^2+y^2, x=-1..1, y=-1..1); > p2 := plot3d(x^2-y^2, x=-1..1, y=-1..1);then display them together by:
> display({p1,p2});
If you are not interested in seeing the individual graphs
p1
and p2
as they are being defined
and only want to see
the composite, replace the terminating semicolons
in the definitions of p1
and p2
with
colons, in which case the graphs will be defined
but not displayed.
The composite graph itself may be given a name, as in:
> p3 := display({p1,p2});and later combined with other plots.
To display a saved graph, just type its name, as in:
> p1;
The spacecurve command plots curves in 3D. Here is an helix:
> spacecurve([cos(t), sin(t), t], t=0..4*Pi, thickness=6);
Space curves and surfaces can be combined:
> p1 := spacecurve([cos(t),sin(t), t/4], t=0..4*Pi, thickness=5); > p2 := plot3d(x^2+y^2, x=-1..1, y=-1..1); > display({p1,p2});
To exit dynagraph, type
> quit
For further examples and more complex constructions consult Further examples.