L'Hopital rule
Show older comments
Mfile for aplications this rule.
Answers (1)
Star Strider
on 10 Apr 2016
No .m-file needed. You can do a reasonably robust approximation with a simple anonymous funciton:
LHospital = @(f,g,x) (f(x+1E-8) - f(x))./(g(x+1E-8) - f(x));
f = @(x) sin(x);
g = @(x) x;
sin0_by_0 = LHospital(f,g,0)
sin0_by_0 =
1
The ‘correct’ version requires the Symbolic Math Toolbox.
2 Comments
Torsten
on 11 Apr 2016
Slight correction:
LHospital = @(f,g,x) (f(x+1E-8) - f(x))./(g(x+1E-8) - g(x));
Best wishes
Torsten.
Star Strider
on 11 Apr 2016
Thanks, Torsten.
I need to remember to check for typos, especially when I copy-paste.
Categories
Find more on Mathematics 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!