How to find a limit without syms and limit function

조회 수: 18 (최근 30일)
Florin Florin
Florin Florin 2019년 5월 25일
편집: John D'Errico 2021년 10월 6일
Let's take the limit . How can i calculate it without using syms and matlab's function limit?

채택된 답변

Star Strider
Star Strider 2019년 5월 25일
편집: Star Strider 2019년 5월 25일
Crude but effective (for this function, may not be universally applicable):
fcn = @(x) (x.^3 - 1) ./ (x - 1);
x = 1;
lm = fcn(x-1E-15)
lm =
3
Experiment to get the result you want.
EDIT —
Another option is to use a simple numerical derivative:
dfdx = @(f,x) (f(x + 1E-8) - f(x)) ./ 1E-8;
fcnn = @(x) x.^3 - 1;
fcnd = @(x) x - 1;
xv = 1;
Lm = dfdx(fcnn,xv) ./ dfdx(fcnd,xv)
producing:
Lm =
3
  댓글 수: 2
Gustav Garpebo
Gustav Garpebo 2021년 10월 6일
Can you pleasae explain the terms? xv, fcnn, fcnd etc
Star Strider
Star Strider 2021년 10월 6일
@Gustav Garpebo — Sure! (I probably should have explained those originally, describing them in comments, although they were clear in the context 2½ years ago.)
The forward-difference derivative ‘dfdx’ function requires a function handle (first argument) and a value of ‘x’ at which the function is evaluated (second argument), and since the function is being evaluated at 1 that is what ‘xv’ is assigned to be. The two other functions, ‘fcnn’ and ‘fcnd’ are the numerator and denominator of the original function, respectively. The rest is straightforward.
.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

John D'Errico
John D'Errico 2021년 10월 6일
편집: John D'Errico 2021년 10월 6일
You can use my limest function. It is on the file exchange.
>> fun= @(x) (x.^3 - 1)./(x-1)
fun =
function_handle with value:
@(x)(x.^3-1)./(x-1)
Now use limest. It even provides an estimate of how well it thinks that limit is known.
[L,errest] = limest(fun,1)
L =
3
errest =
2.20957326622612e-14
Is that correct? l'hopital would tell me of course. Thus, if I differentiate the numerator and the demoninator, we would have 3^x^2/1. At x==1, that is 3.
The symbolic toolbox would agree, but you don't want to see that.
syms X
F = (x^3-1)/(x-1)
limit(F,1)
ans =
3
But we can still use the symbolic TB, without use of limit, just using l'hopital...
subs(diff(X^3-1),X,1)/subs(diff(X-1),X,1)
ans =
3
As expected, it returns 3 as the desired limit.
You can find limest on the file exchange, here:
LIMEST uses an adaptive, multi-order Richardson extrapolation scheme, modified to provide also an estimate of the uncertainty at the extrapolation point, all of my invention.)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by