HP Forums
integral bug in xCas or HP PRIME - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: integral bug in xCas or HP PRIME (/thread-15400.html)



integral bug in xCas or HP PRIME - robmio - 07-30-2020 08:14 PM

Hello everyone. I encountered an error calculating this integral:

int(exp(-s*t)*t*ln(t),t):

xCas or HP PRIME:

Ei((-s)*t)/s^2-e^((-s)*t)*ln(t)/s^2-t*e^((-s)*t)*ln(t)/s

Correct result:

Ei((-s)*t)/s^2-e^((-s)*t)*ln(t)/s^2-t*e^((-s)*t)*ln(t)/s-e^((-s)*t)/s^2

Do you think it's an xCas bug or am I doing something wrong?


RE: integral bug in xCas or HP PRIME - Albert Chan - 07-30-2020 08:33 PM

Hi, robmio

this look like XCas bug:

XCas> f := exp(-s*t)*t*ln(t)
XCas> simplify(diff(int(f,t),t) - f) → -exp(-s*t)/s

Difference should be 0


RE: integral bug in xCas or HP PRIME - robmio - 07-31-2020 06:23 AM

Thanks for confirming, Albert Chan. However, apart from this type of bug (which leads to incorrect results in calculating the Laplace transform of functions such as: "t^n*ln(x)", with "n∈N" and "n >= 0"), another limit of xCas, which I hope will be overcome sooner or later, is the calculation of limits of the type: "lim (Ei(i*x), x, +infinity" --> Pi*i, in the context of inverse Laplace transforms.
What do you think about it?


RE: integral bug in xCas or HP PRIME - Albert Chan - 07-31-2020 11:14 AM

Paradoxically, simple substitution x=s*t eliminated the bug

XCas> f := exp(-s*t)*t*ln(t)
XCas> g := subst(f, t=x/s) / s    // dt = dx/s ⇒ f dt = g dx
XCas> G := int(g, x)                  // G = (-exp(-x)+ln(x/s)*exp(-x)*(-x-1)+Ei(-x))/s^2
XCas> F := subst(G, x=t*s)       // F = (-exp(-s*t)+ln(t)*exp(-s*t)*(-s*t-1)+Ei(-s*t))/s^2
XCas> simplify(diff(F,t) - f)        // 0 ⇒ F = ∫ f dt


RE: integral bug in xCas or HP PRIME - robmio - 07-31-2020 11:43 AM

Great tip!

Paradoxically the integral is calculated correctly also with "ibpdv(exp(-s*t)*t*ln(t),-exp (-s*t)/s,t)"

--> (-t)*exp((-s)*t)*ln(t)/s+int((exp((-s)*t)*ln(t)+exp((-s)*t))/s,t).

I hope the various bugs will be corrected with the next firmware.

Sincerely, Roberto.


RE: integral bug in xCas or HP PRIME - Albert Chan - 07-31-2020 02:42 PM

(07-31-2020 11:43 AM)robmio Wrote:  Paradoxically the integral is calculated correctly also with "ibpdv(exp(-s*t)*t*ln(t),-exp (-s*t)/s,t)"

I did not know XCas had build-in integration by parts. Thanks !

d(uv) = u dv + v du     → ∫u dv = uv - ∫v du

Note: ibpu()/ibpdv() result had the minus sign *inside* integral, ∫u dv = uv + ∫-v du

Instead of v = exp(-s*t), you can also let dv = exp(-s*t), and let CAS handle scaling.
Or, even better, let u = t*ln(t), and let CAS figure out v.

XCas> f := exp(-s*t)*t*ln(t)
XCas> m := ibpu(f, t*ln(t),t)          // [-t*ln(t)*exp(-s*t)/s , (exp(-s*t)+ln(t)*exp(-s*t))/s]
XCas> F := m[0] + int(m[1],t)       // note the + sign
XCas> simplify(diff(F,t) - f)            // 0


RE: integral bug in xCas or HP PRIME - robmio - 07-31-2020 04:25 PM

Great tip! Indeed, the HP PRIME calculator is really valid, despite some bugs, which, I hope, will be eliminated with the next firmware...

Best regards, Roberto.


RE: integral bug in xCas or HP PRIME - parisse - 08-03-2020 07:41 PM

This is indeed a bug in Xcas, now fixed, thank you!


RE: integral bug in xCas or HP PRIME - robmio - 08-04-2020 12:05 PM

Thank you very much; from which website can I download xCas?

Cordially greeting, Roberto Mioni (robmio).


RE: integral bug in xCas or HP PRIME - klesl - 08-04-2020 03:01 PM

xcas is available here
https://www-fourier.ujf-grenoble.fr/~parisse/giac.html


RE: integral bug in xCas or HP PRIME - parisse - 08-04-2020 06:46 PM

The bug is not yet fixed in the binaries. Probably end of next week for win64.


RE: integral bug in xCas or HP PRIME - robmio - 08-05-2020 11:29 AM

Very well, thank you very much. Roberto Mioni (robmio).


RE: integral bug in xCas or HP PRIME - compsystems - 08-07-2020 01:47 PM

I think that this year also the CAS of the hp-prime is updated to 1.6.x =)


RE: integral bug in xCas or HP PRIME - robmio - 08-08-2020 08:21 AM

Great. We will look forward to it