260 likes | 285 Views
Math Review with Matlab:. Calculus. Limits. S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn. Limits. Why Use Limits? Determinate and Indeterminate Functions General Limits Limit Command Indeterminate Example Determinate Example
E N D
Math Review with Matlab: Calculus Limits S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn
Limits • Why Use Limits? • Determinate and Indeterminate Functions • General Limits • Limit Command • Indeterminate Example • Determinate Example • Discontinuous Example • Restricted Constant Example
Why Use Limits? • Many functions are not defined at certain points • However values of the function arbitrarily close to these points may be well defined • Limits are often used to determine the value of a function around (close to) an undefined point • Limits can also be used to approximate values around points of discontinuity in a function
Determinate and Indeterminate • A limit is said to be Determinateif the function is defined at the limit point • The limit is still considered determinate if the result f(a)=±¥ • A limit is said to be Indeterminate if the function is NOT defined at the limit point • Two common examples of indeterminatelimits include:
General Limits • In general, the limit at an indeterminate limit point can be evaluated as: • Where D is an infinitesimally small number and: • As a±D becomes arbitrarily close to a, then f(a±D) becomes arbitrarily close to the limit l
Right and Left Limits • Consider D is an infinitesimally small positive number The Limit from the Right is defined as: The Limit from the Left is defined as: • If the terms right or left are not specified when evaluating a limit, it is assumed that: • If they are not equal then the right or left limit must be specified before evaluating
Limit Command limit(f,x,a) takes the limit of the symbolic expression f as x approaches a limit(f,a) uses findsym(f) as the independent variable and takes the limit as it approaches a limit(f) uses findsym(f) as the independent variable and takes the limit as it approaches 0 limit(f,x,a,'left') takes the limit from the left limit(f,x,a,'right') takes the limit from the right
Indeterminate Example • Analyze the function: • f(x) is obtained by dividing the two continuously definedfunctions plotted to the right • However f(x) is undefined at x = 0 since:
Defined Defined Undefined Defined Limit Around 0 • Even though f(x) is undefined at x=0 • f(x) is defined as x approaches 0from the left • f(x) is defined as x approaches 0from the right
Evaluate Limit Using Delta • The limit can be determined by setting delta to a small value and interpreting the results » delta=sym('1/1000'); » lim_left =eval(sym('sin(-delta)/(-delta)')); » lim_right=eval(sym('sin(delta)/delta')); » vpa(lim_left,10) ans = .9999998333 » vpa(lim_right,10) ans = .9999998333
Indeterminate Verify Using Limit Command » f_zero=sin(0)/0 f_zero = NaN • Use the limit command to verify the previous results » syms x » f=sin(x)/x; » limit_left=limit(f,x,0,'left') limit_left = 1 » limit_right=limit(f,x,0,'right') limit_right = 1 » limit=limit(f) limit = 1 • The limit from the left is equal to the limit from the right
Plot of sin(x) / x • The ezplot command can be used to plot the function and graphically verify the result » ezplot(f,[-15,15]) » grid on
Determinate Limit Example • Given the determinate symbolic function f: • Use Matlab to find the limit of f as x approaches 0 • Use Matlab to find the limit of f as x approaches a
Limit as x approaches 0 • Since x is the Matlab default independent variable and the default limit point is 0 the limit can simply be found using: » syms a x b » f=sin(a*x+b); » lim1 = limit(f) lim2 = sin(b)
Limit as x approaches a » lim2=limit(f1,a) lim2 = sin(a^2+b) • Since x is the Matlab default independent variable and the default limit point is 0 the limit can simply be found using: • Of course the independent variable can be explicitly specified to return the same results » lim2=limit(f1,x,a) lim2 = sin(a^2+b)
Discontinuous Example • Given the function f(x): • Use Matlab to determine the following limits of f as x approaches -1, 0, and +1 • Graphically verify the results by using Matlab to plot f(x) over the region of interest
Limits at Defined Points • Use Matlab to evaluate the limits at x=-1 and x=0 » syms f x » f=1/(x-1); » f_neg1=limit(f,x,-1) f_neg1 = -1/2 » f_zero=limit(f,x,0) f_zero = -1 • Matlab returns a numerical result for each, implying that the limits from the right andleft are the same
Limit at Discontinuity • Finding the limit as x approaches 1 returns NaN (Not a Number) » f_pos1=limit(f,x,1) f_pos1 = NaN Discontinuity at x=1 • This implies that the function is discontinuous at x=1 and that the limit from the left does not equal the limit from the right
Left and Right Limits • Must explicitly find the limit from the left and from the right » f_pos1_lft=limit(f,x,1,'left') f_pos1_lft = -inf » f_pos1_rght=limit(f,x,1,'right') f_pos1_rght = inf
Verify Results • Use Matlab to plot f(x) and verify the previous results » ezplot(f) » axis([-3 3 -5 5]) » grid on
Restriction on Constants • Sometimes it is useful to put restrictions on symbolic constants when evaluating the limits on symbolic expressions x=sym('x','real') restricts x to be real x=sym('x','positive') restricts x to be real and positive x=sym('x','unreal') puts no restrictions on x and can be used to undo any previous restrictions
Restricted Constant Example • Given the continuous function of: • Determine the limit of f(x) asx approaches infinity for the following cases: • Where k2 is any real number • Where k2is a positive real number • We will not discuss the case where k2 is considered complex
Limit for Real k2 • If k2 is assumed to be any real number, the limit is dependent upon the sign of k2 » syms k1 k2 x » f=k1*atan(k2*x); » k2=sym('k2','real'); » lim_k2real = limit(f,x,inf) lim_k2real = 1/2*signum(k2)*pi*k1
Limit for Positive k2 • The limit as x goes to infinity when k2 is known to be a positive real number returns a simpler result » k2=sym('k2','positive'); » lim_k2pos = limit(f,x,inf) lim_k2pos = 1/2*pi*k1 • The result is consistent with the more general result • This may be useful when simplifying symbolic expressions
Summary • General use of limits • Determinate and indeterminate functions • Limits from the right and left • Evaluating limits of symbolic expressions • Restrictions on symbolic constants