L'Hopital rule
Afficher commentaires plus anciens
Mfile for aplications this rule.
Réponses (1)
Star Strider
le 10 Avr 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 commentaires
Torsten
le 11 Avr 2016
Slight correction:
LHospital = @(f,g,x) (f(x+1E-8) - f(x))./(g(x+1E-8) - g(x));
Best wishes
Torsten.
Star Strider
le 11 Avr 2016
Thanks, Torsten.
I need to remember to check for typos, especially when I copy-paste.
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!