Post Reply 
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()
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Numerical integration methods - Tonig00 - 07-18-2022, 06:51 PM
RE: Numerical integration methods - KeithB - 07-18-2022, 08:15 PM
RE: Numerical integration methods - Albert Chan - 07-18-2022 09:26 PM



User(s) browsing this thread: 2 Guest(s)