New Features and Benefits in Maple 8
Dr. Jason Schattman
Waterloo Maple
jschattman@maplesoft.com
July 4, 2002
http://www.mapleapps.com
Revolutionary
Maplets
The Traditional Way
| > | with(Student:-Calculus1): |
| > | g := cos(x); |
| > | ApproximateInt( g, x=0..4, method=right, partition=200, output=plot, boxoptions=[color=blue] ); |
| > | ApproximateInt( g(x), x=0..4, method=right, partition=50, output=sum, boxoptions=[color=blue] ); |
| > |
The Maplets Way
| > | with(Maplets): with(Elements); |
| > | RiemannSumMaplet := Maplet( Window['W1']( [ [ "Enter a function", TextBox['myF']( value = "cos(x)", width = 6), "a = ", TextBox['a']( value = "0", width = 3), "b = ", TextBox['b']( value = "4", width = 3)], [ "Number of partitions", Slider['S1']( 0..100, 20, 'majorticks'=20, 'minorticks'=5, 'snapticks'='false')], [ Plotter['P']( height = 400, width = 400)], [ MathMLViewer['Sum']( height = 75, width = 250 ), DropDownBox['C']([ blue, green, black, brown, turquoise ])], [ Button['B1']( "Show Riemann Sum", onclick = 'ShowTheSum')] ] ), Action['ShowTheSum']( Evaluate('Sum' = 'MathML:-Export( ApproximateInt( myF, x=a..b, method=left, output=sum, partition=S1))'), Evaluate('P' = 'ApproximateInt( myF, x=a..b, method=left, output=plot, boxoptions=[color=C], partition=S1, title="")') ) ): Display( RiemannSumMaplet ); |
Maplets as interfaces to packages
Interactive Plotting
You no longer have to remember plot commands and their long lists of options.
| > | plot( sqrt(x)+1, x=0..10); |
| > | plot( sqrt(x), x = 0 .. 10, labels = ["Km", "Euro"], thickness = 2, color = COLOR(RGB,4/5,2/5,1), axesfont = [COURIER, BOLD, 12], title = "Shipping Cost vs. Distance", titlefont = [TIMES, BOLDITALIC, 16], labeldirections = [HORIZONTAL, VERTICAL] ); |
| > | with(plots): |
| > | interactive( x^2+y^2+z^2=1 ); |
Interactive Curve Fitting
| > | myData := [[1, 2.1], [2, 4.9], [3, 9.7], [4, 18]]; |
| > | with( CurveFitting ); |
| > | LeastSquares( myData, x, curve=a*x^2+c); |
| > | PolynomialInterpolation( myData, x); |
| > | Interactive( myData ); |
| > |
| > |
Calculus 1 Student Package
Step-by-step tutors for differentiation, integration and limit problems
| > | with(Student:-Calculus1): |
The traditional way
| > | diff( x^2*cos(ln(x)), x ); |
The new way
| > | Diff( x^2*cos(ln(x)), x ); |
| > | Rule[ product ](%); |
| > | Rule[ power ](%); |
| > | Rule[ cos ](%); |
Get a hint if you are stuck
| > | Hint(%); |
| > | Rule[ chain ](%%); |
| > | Rule[ ln ](%); |
| > | Rule[ cos ](%); |
| > | ShowSteps(); |
Can program this as a maplet
New visualization tools
The traditional way
| > | with(plots): |
| > | shape_plot := proc(f1, a, b) local box, i, n, x1, x2, xmid, delta, y1, y2, A, B, slope, concav: n:= 100; delta := (b-a)/n; x2 := a; for i from 1 to n do x1 := evalf(x2); y1 := evalf( f(x1)); x2 := evalf(a + i*delta); y2 := evalf( f(x2)); xmid := x1 + delta/2; slope := evalf( subs( x = xmid, diff( f1, x ))); concav := evalf( subs( x = xmid, diff( f1,x $ 2))); if( slope > 0 ) then A[i]:=plot( f1, x = x1..x2, color = blue, thickness = 4 ); else A[i]:=plot( f1, x = x1..x2, color = red, thickness = 2 ); end if; if( concav > 0 ) then B[i]:=polygonplot([[x1,0],[x1,y1],[x2,y2],[x2,0]], color=sienna, style=patchnogrid); else B[i]:=polygonplot( [[x1,0],[x1,y1],[x2,y2],[x2,0]], color=grey, style=patchnogrid); end if; end do; display({ seq( A[i],i=1..n ),seq( B[i],i=1..n ) } ); end: |
| > | f := x-> sin(x); |
| > | shape_plot( f(x), -Pi, 2*Pi); |
The new way
| > | with( Student:-Calculus1 ); |
| > | FunctionChart( sin(x)+x/2, x=-2*Pi..2*Pi ); |
| > | Tangent( 1/(x), x=2, output=plot ); |
| > | for i from 1 to 50 do p[i] := Tangent( sin(x), x = 1 + i/50, output=plot, title="", view=[0..2,0..1.3] ): end do: display( seq( p[i], i=1..50 ), insequence=true ); |
| > | InversePlot( sin(x), x=0..4*Pi ); |
| > | SurfaceOfRevolution( sin(x), x=-Pi..Pi/2, output=plot ); |
Evolutionary
Basic GUI Enhancements
Preferences Dialog Box
Spell Checker
Email a Worksheet from Maple 8
Enhanced Math Display
New Symbols for Set Operations
| > | restart; |
| > | {3,4} union A union {3,7}; |
| > | x in A; |
| > | C intersect (A union B) ; |
| > | expand( % ); |
| > |
Textbook Notation for Calculus and Vector Calculus
Derivatives
| > | restart; |
| > | Diff( sin(x), x ) = diff(sin(x), x ); |
| > |
Vectors and vector fields
Vector notation consistent with standard textbooks
| > | with(VectorCalculus): |
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *, +, ., Vector, diff, int, limit, series
| > | SetCoordinates( cartesian[x, y, z] ): |
| > | v := Vector( [a, b, c] ); |
| > | F := VectorField( < r^2, 1/theta >, polar[r, theta] ); |
| > |
Vector Calculus Package
| > | restart; with( plots ): with( plottools ): with( VectorCalculus ); |
Warning, the name changecoords has been redefined
Warning, the name arrow has been redefined
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *, +, ., Vector, diff, int, limit, series
Textbook notation for vectors
| > | u := <a, b, -6>; |
| > | v := Vector([b, a, 0]); |
| > | SetCoordinates( spherical[r, theta, phi] ); |
| > | v2 := Vector([r^2, theta+phi, 1]); |
Vector arithmetic
| > | u + v; |
| > | u . v; |
| > | u &x v; |
Calculus of multivariable functions
| > | f := w^2 + x^2 + y^2 + z^2; |
| > | SetCoordinates( cartesian ); |
| > | Grad_f := Gradient( f, [w, x, y, z] ); |
| > | Hess_f := Hessian( f, [w, x, y, z] ); |
| > | Lapl_f := Laplacian( T(r,theta), polar[r,theta] ); |
Integration over structured regions
| > | int( 1, [x,y,z] = Sphere(<0,0,0>, r) ); |
| > | p1 := plot3d( x^2+y^2, x=0..1, y=0..1, color=blue): p2 := implicitplot3d( y=x^2, x=0..1, y=0..1, z=0..1, color=green): p3 := implicitplot3d( y=x, x=0..1, y=0..1, z=0..1, color=red): p4 := plot3d( 0, x=0..1, y=0..1, color=grey): display(p1,p2,p3,p4, axes=boxed); |
| > | int( x+y, [x,y,z] = Region( 0..1, x^2..x, x^2+y^2..1 )); |
Example Problem
Let
F
be the vector field
.
(1) Compute the line integral
where
C
is the intersection of the plane
z = 1 - x - y
and the unit cylinder.
(2) Repeat (2) using Stokes' theorem:
| > | F := VectorField( <-y^3, x^3, -z^3>, cartesian[x,y,z] ); |
| > | fp := fieldplot3d( F, x=-1..1, y=-1..1, z=-1..2, axes=boxed, color=blue ): cyl := cylinder( [0,0,-1], 1,3.5, color=grey, capped=false): plane := plot3d( 1-x-y, x=-1..1, y=-1..1, color=pink, style=patchnogrid): display( cyl, plane, fp ); |
(1) Directly
| > | C := <cos(t), sin(t), 1-sin(t)-cos(t)>; |
| > | LineInt( F, Path( C, t=0..2*Pi ) ); |
(2) Using Stokes' theorem
| > | curl_F := Del &x F; |
| > | S := < r*cos(t), r*sin(t), 1-r*sin(t)-r*cos(t) >; |
| > | Flux( curl_F, Surface( S, r = 0..1, t = 0..2*Pi ) ); |
| > |
Numeric Solutions of PDE Boundary Value Problems
| > | restart; with(VectorCalculus): |
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *, +, ., Vector, diff, int, limit, series
Example: Vibration of a cord
,
,
, and
Wave equation and boundary values
| > | WaveEquation := { diff( u(x,t), t, t) = Laplacian( u(x,t), cartesian[x])/10 }; |
| > | BoundaryValues := {u(0,t) = 0, u(1,t) = 0, D[2](u)(x,0)=0, u(x,0)=piecewise( x >= 0 and x <= 1/2, x, x > 1/2 and x <= 1, 1-x)}; |
Solve it
| > | sol := pdsolve( WaveEquation, BoundaryValues, numeric, spacestep=1/200, timestep=10 ): sol:-animate( u(x,t) ,t=0..2*Pi, frames=30, labels=["x","u(x,t)"], labelfont=[TIMES,ROMAN,14], scaling=constrained ); |
| > | BoundaryValues := {u(0,t) = 0, u(1,t) = 0, D[2](u)(x,0)=0, u(x,0)= sin(4*Pi*x)}; |
Solve it
| > | sol := pdsolve( WaveEquation, BoundaryValues, numeric, spacestep=1/200, timestep=1/100 ): sol:-animate( u(x,t) ,t=0..2*Pi, frames=60, labels=["x","u(x,t)"], labelfont=[TIMES,ROMAN,14]); |
| > |
Scientific Constants and the Periodic Table
| > | restart; with( ScientificConstants ); |
Physical Constants
| > | GetConstant( M[Sun] ); GetConstant( h ); |
Chemical Elements and Isotopes
| > | GetElement( Au ); |
| > | GetValue( Element( Au, meltingpoint ) ); |
List the isotopes of an element
| > | GetIsotopes( element=Cf ); |
Adding Your Own Constants
| > | AddConstant( hydrogen_mass, symbol=m[H], value=1.67353404*10^(-27), units=kg ); |
| > | GetConstant( m[H] ); |
Maplet Interface to the Periodic Table
| > |
Java Interactivity
| > | restart; with( CodeGeneration ); |
| > | ExampleProc := proc( x, y, z ) local h; h := cosh(x^2+y^2+z^2); if abs(x) > abs(y) then h; else -h; end if; end proc: |
| > | Java( ExampleProc ); |
import java.lang.Math;
class CodeGenerationClass {
public static double ExampleProc (double x, double y, double z)
{
double h;
double cgret;
h = (Math.exp(x * x + y * y + z * z) + Math.exp(-1.0 * (x * x + y * y + z * z)))/2.0;
if (Math.abs(y) < Math.abs(x))
cgret = h;
else
cgret = -h;
return(cgret);
}
}
| > |
Packages for Advanced Mathematics Research
Calculus of Variations
| > | with( VariationalCalculus ); |
Symbolic-Numeric Algorithms for Polynomials
| > | with( SNAP ); |
Matrix Polynomial Algebra
| > | with( MatrixPolynomialAlgebra ); |
Modular Linear Algebra
| > | with( LinearAlgebra:-Modular ); |
| > |