© 2001 by CRC Press LLC
Input]: = Sphere = Plot3D[If[4X^2Y^2>0, Sqrt[4X^2Y^2],0,
{X,–2,2},{Y,–2,2},PlotPoints->{60,60}]
The If command tests the first expression inside the brackets, it the condition
is true then the statement which follows is implemented and other the last statement
inside the bracket is implemented. In this case, the surface only rises over the base
circle of radius equal to 2. The PlotPoints command specifies how many gird points
along X- and Y-directions should be taken to plot the surface. The default number
of point is 15 in both directions. The greater the number of grid points, the smoother
the surface looks.
The same result can be obtained by first defining a surface function, say sf, and
then apply Plot3d for drawing the surface using sf as follows:
Input]: = sf[X_,Y_] = If[4X^2Y^2>0, Sqrt[4X^2Y^2], 0]
Input[2]: = Plot3D[sf[X,Y],{X,–2,2},{Y,–2,2},PlotPoints->{60,60}]
5.4 PROBLEMS
N
UINTGRA
1. Having learned how to apply Trapezoidal Rule for numerical integration,
how would you find the area under the line y(x) = 1 + 2x and between
x = 1 and x = 2? Do it not by direct integration, but numerically. What
should be the stepsize for x in order to ensure an accurate result?
2. Having learned how to apply Simpson’s Rule for numerical integration,
how would you find the area under the parabolic curve y(x) = 1 + 2x +
3x
2
and between x = 1 and x = 2? Do it not by direct integration but
numerically! What should be the stepsize for x in order to ensure an
accurate result?
3. If Trapezoidal Rule, instead of Simpson’s Rule, is applied for Problem 2,
find out how small should be the stepsize for x in order to achieve the
same result accurate to the fifth significant digit.
4. Could Simpson’s Rule be applied for Problem 1? Would the result be
different? If the result is the same, explain why.
5. Given five points (1,1), (2,3), (3,2), (4,5), and (5,4), use a stepsize of x =
1 to compute ydx by application of Simpson’s and Trapezoidal rules.
6. Use the trapezoidal and Simpson’s rules to find the area within the ellipse
described by the equation (x/a)
2
+ (y/b)
2
= 1. Compare the numerical
results with the exact solution of ab.
7. Implement the integration of the function f(x) = 3e
–2x
sinx over the interval
from x = 0 to x = 1 (in radian) by applying both the Trapezoidal and
Simpson’s rules and using an increment of x = 0.25.
8. Find the exact solution of Problem 7 by referring to an integration formula
for f(x) from any calculus book. Decrease the increment of x (i.e., ,