MAPLE commands - Quick Reference Guide - By OM, 12/02 ----------------------------------------------------- COMMAND EXPLANATION ----------------------------------------------------- ## general > restart; # good to have this at the top of worksheet; > with(student); # adds extra functionality (recommended) > f:=x->x^2; # define a function f(x) > g:=x->evalf(x^3); # define a function f(x), force it to give decimal result > evalf(%) # evaluate previous output in decimal form > diff(sin(x),x); # derivative of sin(x) with respect to x > diff(f(t),t); # derivative of f(t) with respect to t > int(f(x),x=1..2); # integrate f(x) for x between 1 and 2. > Int(f(x),x=1..2); # display the integral of f(x) for x between 1 and 2. > Pi ; # the number 3.1415...Note the it begins with capital P. > exp(2.5); # exponential function evaluated at 2.5 > ln(2.5); # the natural logarithm of 2.5 > p := x^2 - 2*x; # store the expression x^2-2*x under the name "p" > subs(x=3,p); # substitute x=3 into expression p # plotting functions and points > with(plots); # adds functionality for plotting (recommended) > plot(f(x),x=-1..1,y=0..2,scaling=constrained); # plot f(x) with same scaling in x and y axes. > plot(f(x),x=-1..1,y=0..2,axes=boxed); # a plot of f(x) in boxed form. > plot([f(x),g(x)],x=0..2); # plot f(x) and g(x) for x between 0 and 2. > mypts:=[seq([n,10*n-n^2],n=0..10)]; # define a list of points > plot(mypts,x=0..10,style=point,symbol=circle); # plot the points above ## solving equations > solve( cos(x)+y = 9, x ); # solve an equation for x > solve( {x^2*y^2=0, x-y=1} ); # solve a system of equations for x,y > fsolve(x^3-2*x+1,x,-1..1); # numerically solve x^3-2*x+1 = 0 for x between -1 and 1 ## differential equations > with(DEtools): # loads diff eqns package > de1 := diff(x(t),t) = 3*x(t)*(1-x(t)/300); # assigns a differential equation to a name > DEplot(de1,x(t),t=0..3,x=0..400); # slope field plot of diff eqn "de1" > DEplot(de1,x(t),t=0..3,x=0..400,[[x(0)=50]]); # slope field plot and solution through (0,50) > dsolve({de1,x(0)=50},x(t)); # solves the differential eqn "de1" ## curve fitting > with(stats): # loads package for curve fitting > xvals := [-2.,-1.,0.,1.,2.]; # data needed for fit command > yvals := [-3,0,1,0,-3]; # more data needed for fit command > fit[leastsquare[[x,y], y=a*x^2+b*x+c]]( [xvals,yvals]); # fit a parabola