lec24.mws

L-24 MCS 320 Friday 21 October 2005

> restart;

> with(plots);

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...

1. Plotting functions and formulas

We can plot functions and formulas without explit conversions:

> formula := exp(-x^2)*sin(Pi*x^2);

formula := exp(-x^2)*sin(Pi*x^2)

> plot(formula,x=-2..2); # x is the independent variable

[Plot]

> f := unapply(formula,x):

> plot(f(t),t=-2..2);  # plotting via a conversion to formula

[Plot]

> plot(f,-2..2); # no need to specify x

[Plot]

2. Displaying and animating plots

Maple has datastructures for plots.  The plot command from above proceeded in two steps:

1. create the plot; 2. rendering the plot.  If we assign the plot to a variable, we can separate these two stages.

> p1 := plot(formula,x=-2..2); # creation of the plot, stored in p1

p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...p1 := INTERFACE_PLOT(CURVES([[-2., -0.897207541577083346e-17], [-1.95640569166666678, -0.112239208746679562e-1], [-1.91281138333333334, -0.226203713752542827e-1], [-1.89384579604166658, -0.26671171509...

Note that we better terminate with a : instead of the semi-colon...

> display(p1); # rendering of the plot

[Plot]

The display can handle multiple arguments.

> p2 := plot(subs(Pi=2*Pi,formula),x=-2..2,color=green):

> display(p1,p2);

[Plot]

Instead of putting p1 and p2 on the same plot, we can put them after each other:

> display(p1,p2,insequence=true);

[Plot]

Suppose we would like an animation of 20 frames, for increasing values of the factor in front of the Pi, i.e.:  p1 is for 1*Pi, p2 is for 2*Pi, in general p[k] will be for k*Pi.

> pl := seq(plot(subs(Pi=k*Pi,formula),x=-2..2),k=1..20):

> display(pl,insequence=true);

[Plot]

>

3. Plotting around singularities

We can plot algebraic curves, defined by one polynomial in two variables.

> curve := x^3 + y^3 -5*x*y + 1/5;

curve := x^3+y^3-5*x*y+1/5

> implicitplot(curve,x=-3..3,y=-3..3,numpoints=5000);

[Plot]

> watt := (x^2+y^2)^3 + 5.12*(x^2+y^2)^2 - 5.15*(x^4-y^4) - 14.7456*y^2;

watt := (x^2+y^2)^3+5.12*(x^2+y^2)^2-5.15*x^4+5.15*y^4-14.7456*y^2

> implicitplot(watt,x=-3..3,y=-3..3,numpoints=10000);

[Plot]

By taking enough samples we can get a faithful plot.  The problem is the singularity at the origin, at (0,0), which we can resolve via polar coordinates.

> polar_watt := subs(x=r*cos(t),y=r*sin(t),watt);

polar_watt := (r^2*cos(t)^2+r^2*sin(t)^2)^3+5.12*(r^2*cos(t)^2+r^2*sin(t)^2)^2-5.15*r^4*cos(t)^4+5.15*r^4*sin(t)^4-14.7456*r^2*sin(t)^2polar_watt := (r^2*cos(t)^2+r^2*sin(t)^2)^3+5.12*(r^2*cos(t)^2+r^2*sin(t)^2)^2-5.15*r^4*cos(t)^4+5.15*r^4*sin(t)^4-14.7456*r^2*sin(t)^2

> s := solve(polar_watt/r^2,r);

s := 0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), -0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), 0.50000000...s := 0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), -0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), 0.50000000...s := 0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), -0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), 0.50000000...s := 0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), -0.5000000000e-1*(6.-2060.*sin(t)^2+2.*(1060900.*sin(t)^4+583644.*sin(t)^2+9.)^(1/2))^(1/2), 0.50000000...

The solution give us parameterization r as a function of t, for this curve.

> polarplot(s[1],t=0..Pi);

[Plot]

>

4. Sparse Matrices

see lecture note

5. Curve Fitting

see lecture note