









Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!










Calculus
Many of the exercise sets in by Johnson and Mathews contain technology exercises,marked with the icon which are intended to be
1 Information for Instructors 1 Getting Started Student Accessibility to MATLAB Working in a MATLAB Environment
2 Plotting, Limits and the Derivative 5 Plotting simple functions with MATLAB Taking limits with MATLAB The Derivative with MATLAB Solving Equations by MATLAB Plotting Parametric Equations Plotting Polar Equations Approximate solutions of equations Applications of the derivative
3 Integration 14 A De1nite Integral Integration by Parts; An Inde1nite Integral Approximation of Integrals Trapezoidal Rule Taylor Series
Calculus ,J & M , MATLAB M 2
solved with the use of a computer algebra system (CAS) such as MAT- LAB. In addition,each chapter of the text contains at least one student project. These projects are designed to give students substantial experience in solving multistep problems,usually with the aid of a graphical calculator or a CAS. The purpose of this manual is to provide a brief introduction to the MATLAB computing environment,speci1cally geared to the textbook. If you are considering having students use MATLAB for some of the Technology exercises or Student Projects,please spend a few minutes read- ing this section. It contains general advice and suggestions for the successful implementation of MATLAB in your course.
First you may need to determine where your students will have access to MATLAB. For instance, if you plan on having students do their work on campus in a computer lab,then it will be necessary that MATLAB is readily available in the lab or labs,where the students will be expected to work. If possible,the labs should have the latest version of MATLAB (presently Version 6.1 at the time of writing). Up-to-date information about MAT- LAB can be found on the web at http://www.mathworks.com. If you or your school is planning on purchasing MATLAB for use in a computer lab, the information you may need can also be obtained from the Mathworks website. An academic site license can be obtained at a considerable dis- count. Once you purchase and obtain your site license for MATLAB,have your computer administrator install the program on the lab machines. For instance,on our campus,MATLAB is available on the computer network as soon as the students log-in. If your school chooses not to obtain a site license,you may need to make arrangements to have your students purchase individual copies of MATLAB. The Student Edition of MATLAB is recommended. It is de- scribed at the URL http://www.mathworks.com/products/student version/. You may want to check to see if the campus bookstore or computer store will stock the soft- ware for you. You might want to spend some time working with MATLAB in the same environment as your students. If they will be working in an on-campus lab,
, 4
Command Function
Calculus J & M , MATLAB M
syms Short cut for constructing symbolic objects ezplot Easy-to-use function plotter limit Limit of a symbolic expression solve Symbolic solution of functional equations double Convert symbolic expression to numerical plot Linear plot linspace Linearly spaced vector subs Symbolic substitution diff Differentiate int Integrate pretty Pretty print a symbolic expression taylor Taylor series polar Plot in polar coordinates trapz Trapezoidal integration
Calculus , , MATLAB 5
J & M M
plot
linspace,
syms x y y1 y x linspace 0 2 pi y sin x y1 sin y y2 sin y plot x y
One of the most useful bene1ts of a program such as MATLAB is in plotting functions. There are several ways in which this may be carried out. The most common command for two-dimensional graphs is. Data arrays are formed and plotted on the horizontal and vertical axes, and the points are connected by line segments. If there are not enough line segments, the curve may appear choppy. The command to segment the interval is which is actually an internal function,since it is made up of more than one command. You may adjust the number of data points as needed. However there is a default number of 100,which is often adequate. To perform a plot,the process is illustrated on a exercise from Section 1.2, p.19,#39.
x
, 7
Calculus , MATLAB
syms x y y 2 x ezplot y 1 5
ezplot
y < x <.
J & M M
Alternatively,the command may be used to perform a plot. This is particularly recommended when only one function over one interval is needed. This is illustrated on a exercise from Section 1.4,p.35,#13.
This shows the graph of for
, 8
ans = 1
syms x
Calculus , MATLAB
(sin( ) )
J & M M
ezplot y 0 1 0 1
syms h limit h h
limit tan x pi 2
Another possibility is that the limit does not exist.
This shows zooming in near the point
Just about all of the important processes of calculus may be performed using MATLAB. The 1rst one to be shown is that of taking limits. This is illustrated on a exercise in section 1.5,p.47,#13 of the text. If no limit point is given,it is automatically taken to be
identi1es this difficulty,which is also on p.47 in the text.
,
8
10
x
x
Calculus J & M , MATLAB M
b
solve f x f x x.
x , lambertw,
double
-sin(x)
syms h b limit((b^h-1)/h,h,0)
ans =
log(b) % The log is the natural logarithm ln.
solve( 2^x=x^8 )
x
x
8 lambertw 1 8 log 2 log 2 8 lambertw 1 1 8 log 2 log 2 8 lambertw 1 8 log 2 1 2 2 1 2 1 2 i 2 1 2 log 2 8 lambertw 1 8 i log 2 log 2 8 lambertw 1 8 log 2 1 2 2 1 2 1 2 i 2 1 2 log 2 8 lambertw 1 8 log 2 log 2 8 lambertw 1 8 log 2 1 2 2 1 2 1 2 i 2 1 2 log 2 8 lambertw 1 8 i log 2 log 2 8 lambertw 1 8 log 2 1 2 2 1 2 1 2 i 2 1 2 log 2
The derivatives of other functions such as may also be derived. This is motivated on p.134 in the text.
The command E E in MATLAB solves the equation for the desired values of As the need arises this command will be greatly used. A 1rst illustration is from section 2.7,a exercise on p.152,#43. The command gives nine roots of the equation in terms of the built- in function which at this stage is not too useful to us. MATLAB, the genie that it is,desires to please us by obtaining as exact an answer as possible.
However,MATLAB,being the practical tool it is,has another command, which converts a symbolic expression to a numerical one.
, 11
8 x x 8 x 8
Calculus J & M , MATLAB M
t=0:0.1:7; x=sin(t) y=sin(2*t); plot(x,y)
x < x <
. , x <. < x <. , < x , x >. , > x.
double x ans 1 1000 43 5593 0 69 72 0 8014i 0 0850 0 9890i 0 7007 0 6283i 0 9 231 0 7007 0 6283i 0 0850 0 9890i 0 6972 0 8014i Only the positive real values of are of interest to us. Thus for ,while for but for
The need may arise to plot a curve given in parametric form. The plot command is capable of handling this,as illustrated on a exercise from section 3.4,p.232,#79.
, 13
diff
Calculus J & M , MATLAB M
The command performs the symbolic differentiation of a function. This technique is illustrated on an interesting but complicated exercise from section 4.7,p.319,#23.
double(ans) ans = 2.9956- 4.0003i 2.9956+ 4.0003i -0.4956+ 1.3101i -0.4956- 1.3101i
syms A r h A=pi^r^2/2-r^2asin(1-h/r)-(r-h)sqrt(h(2r-h))
1/2(pi^r)^2-r^2asin(1-h/r)-(r-h)(h(2*r-h))^(1/2)
Ah=diff(A,h)
Ah= r/(1-(1-h/r)^2)^(1/2)+(h(2r-h))^(1/2) -1/2(r-h)/(h(2r-h))^(1/2)(2r-2h)
Ah1=subs(Ah,r,1.5)
Ah1= 3/2/(1-(1-2/3h)^2)^(1/2)+(h(3-h))^(1/2) -1/2(3/2-h)/(h(3-h))^(1/2)(3-2h)
Ah2=subs(Ah1,h,2)
Ah2 =
hrate=0.5/(6*Ah2)
,
Calculus , MATLAB 14
int
J & M M
The command may be used to obtain both inde1nite and de1nite inte- grals. Whenever possible,MATLAB attempts to provide an exact answer. This is illustrated on a example from section 5.6,p.393,#35. This example is somewhat involved and the code is developed next.
hrate =
double(hrate) ans =
% First, find the area of the region removed. It is determined by the points where the circle and the parabola meet. syms x solve( 4-sqrt(16-x^2)=-0.4*x^2+3.2 )
ans =
% The area of the removed section is then obtained as a definite integral between those limits.
A=int(-0.4*x^2+3.2-(4-sqrt(16-x^2)),x,-2.4356475,2.4356475)
,
∫ √
/
16
2 0 2 2
(^2 ) 100
help taylor
Calculus , MATLAB
( ) sin +
J & M M
trapz quad quad
a b x b dx. linspace T.
taylor f f x. taylor f, n n
2 1 + 1/36 pi
2 1 + 1/36 pi
2 1 + 1/144 pi
2 1 + 1/144 pi
x=linspace(0,pi/2); a=17.9435; b=4.5511;
f=sqrt((a^2-b^2)*(sin(x).^2.)+b^2); trapz(x,f) ans =
There are three built-in MATLAB functions for numerically evaluating an integral over a 1nite range. They are ,and. The trapezoid rule is employed in the 1rst of those commands. It is illustrated in solving a exercise from section 6.4 on p.479,#27. The purpose is to evaluate
Since the default number in is 100, the effect is to compute
MATLAB can be used to 1nd the Taylor series of a function. The com- mand gives (by default) the 1fth order Maclaurin polynomial approximation to ,that is,the Taylor series about Here we em- ploy which is the -st order Maclaurin polynomial. Several other parameters can be speci1ed and a complete description may be found under. For very smooth functions,the Taylor series method will
,
17
Calculus J & M , MATLAB M
syms f x f=taylor(sin(x^2),15)
f =
x^2-1/6x^6+1/120x^10-1/5040*x^
I=int(f,x,0,pi/2)
1/24pi^3-1/5376pi^7+1/2703360pi^11-1/2477260800pi^
double(I) ans =
give an accurate approximation to a de1nite integral,using few terms when the interval of integration is short. The method is developed in an example at the end of section 7.7 on p.621 in the text. In what follows the method is illustrated on a exercise,p.624,#21.