MultivariateCalculus
The Student:-MultivariateCalculus package is designed to aid in the teaching and understanding of multivariate calculus concepts. This worksheet demonstrates the basics of this functionality. For more information about the commands in the MultivariateCalculus package, see the command help page. For a general overview, see MultivariateCalculus.
Getting Started
Commands in the MultivariateCalculus package can be referred to using the long form, for example, Student:-MultivariateCalculus:-ApproximateInt.
However, it is recommended that you load the package first and use the shorter command names.
restart
with⁡Student:-MultivariateCalculus:
The MultivariateCalculus package contains tutor routines that act as interfaces to the other MultivariateCalculus routines. Each tutor can be called with no parameters, in which case defaults are used. These parameters can be changed easily in the Maplet application.
The following examples show you how to use the MultivariateCalculus routines. For additional examples, see the moreStudentMultivariateCalculus example worksheet.
Taylor Approximations
The MultivariateCalculus package routine TaylorApproximation calculates, plots, or animates Taylor approximations to multivariate functions. The TaylorApproximationTutor routine provides an interface to the TaylorApproximation routine.
TaylorApproximationTutor⁡
TaylorApproximationTutor⁡sin⁡x+y,x,y=1,2,8
The TaylorApproximation routine allows you to calculate, plot, or animate the Taylor approximation, without using the Maplet application interface.
TaylorApproximation⁡sin⁡x+y,x,y=1,0,5
cos⁡1⁢y5120+sin⁡1⁢y424+cos⁡1⁢x−1⁢y424−cos⁡1⁢y36+sin⁡1⁢x−1⁢y36+cos⁡1⁢x−12⁢y312−sin⁡1⁢y22−cos⁡1⁢x−1⁢y22+sin⁡1⁢x−12⁢y24+cos⁡1⁢x−13⁢y212+cos⁡1⁢y−sin⁡1⁢x−1⁢y−cos⁡1⁢x−12⁢y2+sin⁡1⁢x−13⁢y6+cos⁡1⁢x−14⁢y24+sin⁡1+cos⁡1⁢x−1−sin⁡1⁢x−122−cos⁡1⁢x−136+sin⁡1⁢x−1424+cos⁡1⁢x−15120
The following creates an animation. To run any of the animations in this worksheet:
Click the plot. The plot toolbar is displayed.
In the toolbar, click the Play button.
Alternatively, right-click (Control-click, on Mac) the plot to display the context menu. Select Animation > Play.
TaylorApproximation⁡sin⁡x+y,x,y=1,0,5,output=animation
Cross-Sections
The MultivariateCalculus package has routines to illustrate the concepts of cross-sections. The cross-section routines demonstrate the intersection of any given plane with the curve.
The CrossSectionTutor routine provides and interfaces for the CrossSection.
CrossSectionTutor⁡
CrossSectionTutor⁡x2+y2+z2=4,x+z=2,1,0,x=−2..2,y=−2..2,z=−2..2
The CrossSection routine allows you to plot or animate the cross-sections without using the Maplet application interface.
CrossSection⁡x2+y2+z2=4,x+y=1.1,0.1,x=−2..2,y=−2..2,z=−2..2,showfunction=false,title=Sphere
CrossSection⁡x2+y2,z=0..24,x=−4..4,y=−4..4,z=0..25,planes=10,output=animation
Directional Derivatives and the Gradient
The DirectionalDerivative, DirectionalDerivativeTutor, Gradient, and GradientTutor routines of the MultivariateCalculus package are designed to demonstrate and determine directional derivatives and gradients. The tutor routines provide an interface to the DirectionalDerivative and Gradient routines.
DirectionalDerivativeTutor⁡
DirectionalDerivativeTutor⁡x2+3⁢y12,x,y=1,2,2,3
GradientTutor⁡
GradientTutor⁡y⁢x2+y2,x,y=1,2,3,5
The DirectionalDerivative routine allows you to plot, animate, or obtain the value of the directional derivative, without using the Maplet application interface. The Gradient routine allows you to obtain the gradient, or plot the gradient at a point. Using the output=gradplot option, the Gradient routine can simultaneously plot the gradients at multiple points within a region.
DirectionalDerivative⁡x2+y2,x,y=1,2,3,4
225
DirectionalDerivative⁡x2+3⁢y12,x,y=1,1,1,−1,output=animation,frames=15
Gradientx2+y2, x,y=0,1;
02
Gradientx2+y2, x,y=0,1,2,1, output=plot;
Gradientx2+y2, x,y = 0,1,2,1, output = gradplot;
The Hessian and the Second Derivative Test
The SecondDerivativeTest routine of the MultivariateCalculus package can be used to calculate the Hessian for use in the second derivative test, or to apply the second derivative test to determine the local minima, local maxima, and saddle points.
SecondDerivativeTest⁡x2+y2,x,y=0,0,output=hessian
2002
SecondDerivativeTest⁡x2−y2,x,y=0,0
LocalMin=,LocalMax=,Saddle=0,0
SecondDerivativeTest⁡x2+y2+z2,x,y,z=1,2,1,2,3,1,0,0,0,output=hessian
200020002,200020002,200020002
SecondDerivativeTest⁡x2+y2+z2,x,y,z=1,2,1,2,3,1,0,0,0
LocalMin=0,0,0,LocalMax=,Saddle=
Integrals in Multivariate Calculus
The MultiInt routine of the MultivariateCalculus provides an interface for the construction or evaluation of multiple integrals.
MultiInt⁡x2⁢y,y=x−1..x+1,x=0..4,output=integral
∫04∫x−1x+1x2⁢yⅆyⅆx
MultiInt⁡x2⁢y,y=x−1..x+1,x=0..4
128
MultiInt⁡x2+y2+z,z=−2..4+y2,y=x−1..x+6,x=2..4,output=integral
∫24∫x−1x+6∫−2y2+4x2+y2+zⅆzⅆyⅆx
MultiInt⁡x2+y2+z,z=−2..4+y2,y=x−1..x+6,x=2..4
213375445
Integral Approximations
Multivariate integral approximations using Riemann sums can be observed using the ApproximateInt and ApproximateIntTutor routines. The ApproximateIntTutor routine provides a Maplet application interface to the ApproximateInt routine.
ApproximateIntTutor⁡
ApproximateIntTutor⁡x3−y2+x⁢y,y=−4..4
ApproximateIntTutor⁡r,r=0..2,θ=0..π2,coordinates=polar
The ApproximateInt routine allows you to plot, animate, or obtain the value of an integral approximation, without using the Maplet application interface.
ApproximateInt⁡r,r=0..5,t=0..π2,coordinates=polar,output=plot,showfunction=false,prismoptions=color=green,method=upper
ApproximateInt⁡x2+y2,x=−4..4,y=−6..6,output=animation,partition=6,6,frames=2..7
ApproximateInt⁡x2+y2,x=−4..4,y=−6..6,output=value,partition=6,6
1617.777776
The Jacobian
The Jacobian of a list of multivariate functions can be calculated using the Jacobian routine of the MultivariateCalculus package. The Jacobian routine can also be used to calculate the determinant of the Jacobian. The Jacobian is used in the application of a change of variables to a multiple integral. Change of variables is explained in the following section.
Jacobian⁡z⁢x−4⁢y⁢z,x+y−2⁢z,z3,x,y,z=2,1,C
C−4⁢C−211−2003⁢C2
Jacobian⁡z⁢x−4⁢y⁢z,x+y−2⁢z,z3,x,y,z=2,1,C,output=determinant
15⁢C3
Change of Variables
The ChangeOfVariables and Revert commands can be used to rewrite integrals in a more convenient form, and to revert to the original form if the change was not successful, for example, if the endpoints of integration cannot be determined in terms of the new variables.
a:=∫02∫04x2⁢yⅆxⅆy
a≔∫02∫04x2⁢yⅆxⅆy
b:=ChangeOfVariables⁡a,cartesianx,y,polarr,θ
b≔∫y=0y=2∫x=0x=4r4⁢cos⁡θ2⁢sin⁡θⅆrⅆθ
c:=Revert⁡b
c≔∫02∫04x2⁢yⅆxⅆy
The ChangeOfVariables routine can also be applied to triple integrals.
a:=∫∫∫x⁢yzⅆxⅆyⅆz
a≔∫∫∫x⁢yzⅆxⅆyⅆz
ChangeOfVariables⁡a,cartesianx,y,z,cylindricalr,θ,u
∫∫∫r3⁢cos⁡θ⁢sin⁡θuⅆrⅆθⅆu
Lagrange Multipliers
The LagrangeMultipliers command calculates or plots the local minima, local maxima, and saddle points of a function subject to constraints, using the method of Lagrange multipliers.
LagrangeMultipliers⁡x⁢y,x28+y22−1,x,y
2,1,2,−1,−2,1,−2,−1
LagrangeMultipliers⁡x⁢y,x28+y22−1,x,y,output=plot
LagrangeMultipliers⁡x⁢y,x28+y22−1,x,y,output=plot,showlevelcurves=false
Lines and Planes
The MultivariateCalculus package supports computations with lines and planes in two and three dimensions, using commands and using the context menu. This functionality will be demonstrated using some problems with answers.
Skew lines
Problem
a) Show that the lines R=A+t P and R=B+s Q, where A, B, P, and Q are defined by
x=3−2 t,y=2+5 t,z=6+t and x=5+4 s,y=7+2 s,z=3+2 s
do not intersect and are not parallel (so they are skew lines);
b) Find the common normal between them.
c) Find the distance between them.
Solution using the context menu
Part a)
Form a list of parametric equations for each line, then select Context Menu: Calculus-Multivariate≻Line≻t (then s for the second line).
x=3−2 t,y=2+5 t,z=6+t→make line<< Line 1 >>→assign to a nameL1
x=5+4 s,y=7+2 s,z=3+2 s→make line<< Line 2 >>→assign to a nameL2
Form a sequence of the line names, select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Skew (or Parallel or Intersect).
L1,L2 = << Line 1 >>,<< Line 2 >> = →skew lines?true
L1,L2 = << Line 1 >>,<< Line 2 >>→parallel?false
L1,L2 = << Line 1 >>,<< Line 2 >>→intersect?false
Part b)
Form a plane parallel to both lines (it will contain the first line). Do this by forming a sequence of the line names, then selecting Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Plane.
L1,L2 = << Line 1 >>,<< Line 2 >>→make plane<< Plane 1 >>→assign to a nameP1
Now take the normal of this plane: select Context Menu: Calculus-Multivariate≻Normal.
P1 = << Plane 1 >>→normal88−24
Part c)
Form a sequence of the line names, then select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Distance.
L1, L2 = << Line 1 >>,<< Line 2 >>→distance16⁢1111
Solution using commands
Define the line objects.
L1 ≔ Linex=3−2 t,y=2+5 t,z=6+t;
L1≔<< Line 3 >>
L2 ≔ Linex=5+4 s,y=7+2 s,z=3+2 s;
L2≔<< Line 4 >>
Test skewness with the command AreSkew (or AreParallel or Intersects).
AreSkewL1, L2;
true
AreParallelL1, L2;
false
IntersectsL1, L2;
Form a plane parallel to both lines (it will contain the first line).
P1 ≔ PlaneL1, L2;
P1≔<< Plane 2 >>
Take the normal of this plane with the command GetNormal.
GetNormalP1;
88−24
We can create a plot of these three objects as follows:
plotsdisplayGetPlotP1, GetPlotL1, vectoroptions=width=0.5, GetPlotL2, vectoroptions=width=0.5, caption = typesetThe plane , 'P1', and the lines , 'L1', and , 'L2', ., axes=none;
Use the Distance command.
DistanceL1, L2;
16⁢1111
Intersection of planes
a) Find a formula for the line ℓ that is the intersection of the planes
π1: 3 x−7 y−9 z=8 and π2:5 x+4 y−2 z=6
b) Find an equation for the plane that contains ℓ and the point P:2,−3,1.
Take the equation of each plane (with copy and paste, control-drag, or by retyping it) and create the planes by selecting Context Menu: Calculus-Multivariate≻Plane, then selecting Context Menu: Assign to a Name≻Q[1] or Q[2].
3 x−7 y−9 z=8→make plane<< Plane 3 >>→assign to a nameQ1
5 x+4 y−2 z=6→make plane<< Plane 4 >>→assign to a nameQ2
Create the sequence of the two names of planes, select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Intersection, and finally select Context Menu: Assign to a Name≻L.
Q1, Q2 = << Plane 3 >>,<< Plane 4 >>→intersection<< Line 5 >>→assign to a nameL
To verify that L is indeed contained in the two planes, form a sequence of a plane name and the line name, select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Contains.
Q1,L = << Plane 3 >>,<< Line 5 >>→contains?true
Q2,L = << Plane 4 >>,<< Line 5 >>→contains?true
To get an equation, use the name for the line, select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Representation... . By choosing one of the forms from the drop down menu, one can select from five different representations:
L = << Line 5 >>→representation−47⁢x50+z=−3725,39⁢x50+y=1925 (here we selected 'equations')
L = << Line 5 >>→representationx=496623+50⁢t,y=4333115−39⁢t,z=−22793115+47⁢t (here we selected 'parametric')
L = << Line 5 >>→representationt·50−3947+4966234333115−22793115 (here we selected 'vectors')
L = << Line 5 >>→representation496623+50⁢t4333115−39⁢t−22793115+47⁢t (here we selected 'combined_vector')
L = << Line 5 >>→representationx50−24815575 = −y39+433121485 = z47+2279146405 (here we selected 'symmetric')
Create the sequence of the line name and the list of coordinates of the point, select Context Menu: Evaluate and Display Inline, then select Context Menu: Calculus-Multivariate≻Plane..., and finally select Context Menu: Assign to a Name≻Q[3].
L, 2, −3, 1 = << Line 5 >>,2,−3,1→make plane<< Plane 5 >>→assign to a nameQ3
Create the plane objects.
Q1 ≔ Plane3 x−7 y−9 z=8;
Q1≔<< Plane 6 >>
Q2 ≔ Plane5 x+4 y−2 z=6;
Q2≔<< Plane 7 >>
Use the GetIntersection command to compute the intersection.
L ≔ GetIntersectionQ1, Q2;
L≔<< Line 6 >>
Use the GetRepresentation commands to get a formula for L. Several forms are available:
GetRepresentationL;
t·50−3947+4966234333115−22793115
GetRepresentationL, 'form = equations';
−47⁢x50+z=−3725,39⁢x50+y=1925
GetRepresentationL, 'form = parametric';
x=496623+50⁢t,y=4333115−39⁢t,z=−22793115+47⁢t
GetRepresentationL, 'form = combined_vector';
496623+50⁢t4333115−39⁢t−22793115+47⁢t
GetRepresentationL, 'form = symmetric';
x50−24815575 = −y39+433121485 = z47+2279146405
Create the plane object.
Q3 ≔ PlaneL, 2, −3, 1;
Q3≔<< Plane 8 >>
To verify that Q3 indeed contains both L and the point 2, −3, 1, use the Contains command.
ContainsQ3, L and ContainsQ3, 2, −3, 1;
Applications
The MultivariateCalculus package provides routines to calculate quantities such as function average, surface area, and center of mass, using multivariate calculus.
Function Average
The FunctionAverage command returns the integral used to determine the average of a function over a region or calculates the average of the function over the region.
FunctionAverage⁡x2+y2,x=0..1,y=0..1−x2,output=integral
∫0−x2+1∫01x2+y2ⅆxⅆy∫0−x2+1∫011ⅆxⅆy
FunctionAverage⁡x2+y2,x=0..1,y=0..1−x2
−x2+13+−x2+1323−x2+1
FunctionAverage⁡r2,r=0..1,t=0..π2,coordinates=polarr,t,output=integral
∫0π2∫01r3ⅆrⅆt∫0π2∫01rⅆrⅆt
FunctionAverage⁡r2,r=0..1,t=0..π2,coordinates=polarr,t
12
FunctionAverage⁡x2+y2+z,x=2..4,y=x−1..x+6,z=−2..4+y2,output=integral
∫−2y2+4∫x−1x+6∫24x2+y2+zⅆxⅆyⅆz∫−2y2+4∫x−1x+6∫241ⅆxⅆyⅆz
FunctionAverage⁡x2+y2+z,x=2..4,y=x−1..x+6,z=−2..4+y2
392⁢y23+756+2⁢x+63⁢y2+63−2⁢x−13⁢y2+63+7⁢y2+4214⁢y2+84
Surface Area
The SurfaceArea command plots, constructs the integral for, or calculates the surface area of a curve within a region.
SurfaceArea⁡x2+y,x=−2..2,y=−1..1,output=plot
SurfaceArea⁡x2+y2,x=−2..2,y=−1..1,output=integral
∫−22∫−114⁢x2+4⁢y2+1ⅆyⅆx
SurfaceArea⁡x2+y,x=−2..2,y=−1..1
12⁢2+2⁢arcsinh⁡2⁢2
Center of Mass
The CenterOfMass command plots, constructs the integral for, or calculates the center of mass of a curve within a region.
CenterOfMass⁡x2+y2,x=1..4,y=−1..6,output=plot
CenterOfMass⁡x2+y2,x=1..4,y=−1..6,output=integral
∫−16∫14x⁢x2+y2ⅆxⅆy∫−16∫14x2+y2ⅆxⅆy,∫−16∫14y⁢x2+y2ⅆxⅆy∫−16∫14x2+y2ⅆxⅆy
CenterOfMass⁡x2+y2,x=1..4,y=−1..6
565208,765208
Return to Index of Example Worksheets
Download Help Document