Numerical integration methods
|
07-18-2022, 09:26 PM
Post: #4
|
|||
|
|||
RE: Numerical integration methods
With substitution, HP Prime can solve integral symbolically.
CAS> f(x) := x^2 * expm1(1/x^3) CAS> r := quote(int(f(x), x, a, b)) (x = y^(-1/3)) Touched up ⇒ \(\displaystyle {1\over3}\int _\frac{1}{a^3} ^\frac{1}{b^3} \frac{1-e^y}{y^2}\;dy\) CAS> r := simpilfy(r) 1/3*(-a^3*e^(1/a^3) + b^3*e^(1/b^3) + Ei(1/a^3) - Ei(1/b^3) + a^3 - b^3) CAS> r(a=1., b=100.) → 4.80504345652 This is very bad numerical answer! Let's replace exp with more accurate expm1 ... carefully! CAS> g(x) := (x^3*expm1(1/x^3) - Ei(1/x^3))/3 CAS> g(100.) - g(1.) → 4.80504346032 We write g as function, to prevent expm1(x) from expanding to exp(x)-1 If argument for g is numerical, expm1() is used, instead of exp() |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)