Compute Multi-Variable Limits using MATLAB

Hello,
I know I can compute one variable limits using the "limit" function. Is there anyway I can compute multi-variable limits in MATLAB? For example if I have the function f = x^2/y and I want to compute the limit as x and y go to zero.
Thank you, Kevin

 Accepted Answer

Matt J
Matt J on 29 Aug 2013
Edited: Matt J on 29 Aug 2013
If the function is continuous at the point you're interested in, it is sufficient to apply limit() to any 1-dimensional path approaching that point. E.g., to find the limit of
f(x,y)=x.^2+y.^2
as x,y-->0 you can take the 1-dimensional path x(t)=y(t)=t and reduce f to
f(x(t),y(t))=2*t.^2
Then, apply limit() to this 1D function of t as t-->0.
However, your example f=x^2/y is not continuous at x=y=0, so the limit is not defined there. Along x(t)=y(t)=t, the function approaches zero. Along the path x(t)=sqrt(t), y(t)=t the function converges to 1. Along the path x(t)=t, y(t)=t.^3 the function approaches Inf. If there is a particular path you know you are interested in, though, you could still apply limit() to that path.

8 Comments

Thanks for your response. I know what the time derivatives of x and y are (in terms of x and y). Does that allow me to take the limit?
Matt J
Matt J on 29 Aug 2013
Edited: Matt J on 29 Aug 2013
If x and y obey a differential equation in t, then solving that equation will give you x(t), y(t) and you can again use LIMIT to take limits of f(x(t), y(t)) as a function of t.
My actual system is too complex to be able to find analytic expressions for x(t) and y(t) based on the differential equations. What I do know is that x and y both converge to zero in steady state. I have another variable f which = x^2/y, but this leads to a MATLAB divide by zero error once the system is in steady state (as both the numerator and denominator go to zero in steady state). Since I know the expressions for dxdt and dydt, I'm wondering if I can use a different expression for f (by taking a limit), so I can avoid this MATLAB error.
You could try L'Hopital's rule, and see if it leads to anything. So, the limit would be
2*x*dxdt/dydt
and since you know dxdt and dydt in terms of x,y you can reduce this to a different function of (x,y), one hopefully having a simpler limiting expression. If not, you can apply L'Hopital's rule additional times.
The problem is, since x and y converge to steady state values of 0, won't all derivatives of x and y have to be zero as well? Therefore when I divide by dydt or d2ydt2 (or any higher derivative of y), that will be still dividing by zero.
It depends a lot on what your differential equations look like. For example, suppose they were
dxdt=-x
dydt=-2*x^2
A solution to these equations is x(t)=exp(-t), y(t)=exp(-2*t) which at steady state are zero and so are all their dervatives. However, applying L'hopital's rule, leads to
lim f = lim 2*x*dxdt/dydt = lim -2*x^2/(-2*x^2) = 1
giving the correct limit.
One thing is for sure. The only way to find the limit is to incoporate info from the differential equations and L'hopital's rule gives you at least one way of doing so.
Matt, thanks for your help. I understand what you are saying, but my example is a bit more complicated and I'm not sure if L'Hopital Rule is valid here.
My differential equations are
dq/dt = i;
di/dt = -A*i-B*q+C*u
where A,B,and C are known positive constants and the control variable u is governed by
u = -D*i-E*q/i
where D and E are known positive constants
What I'm looking to do is find a value for u in the limit where q and i approach 0 because since the denominator is 0, this produces a MATLAB divide by zero error.
For finding the limit of u, when I take the derivatives of the numerator and the denominator on the right hand side, the derivative of the denominator is also function of u.
u = -E*dq/dt / di/dt
= -E*i / (-A*i-B*q+C*u)
Is L'Hopital's rule still valid in this case? If so, how do I proceed?
So, the problem is to find the limit of q/i. if lim q/i = 0 then you know that lim u = 0 and we're done.
I'll now prove, by contradiction, that it is impossible for q/i to converge to anything but zero. Assume, aiming for a contradiction, that q/i has a non-zero limit point L~=0 for some sequence of times t_n, where t_n --> infinity as n--->infinity. Then lim_n i/q = 1/L and combining with L'Hopital's rule
1/L = lim_t di/dt / dq/dt
= lim_t(-A*i-B*q-C*D*i-C*E*q/i) / i
= -A-B*L-C*D - C*E*L*lim_t(1/i)
But the limit on the RHS is infinite, assuming C*E~=0, whereas the LHS is finite. This establishes a contradiction. So, q/i--->0 and you're done.
I don't know, however, if knowing the limit really helps you. Even if you know the limit, you do not know how fast it gets there, so you don't know at what t it is possible to start approximating q/i by its limit and with what accuracy.

Sign in to comment.

More Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!