integral bug in xCas or HP PRIME
07-30-2020, 08:14 PM
Post: #1
 robmio Junior Member Posts: 15 Joined: Jan 2020
integral bug in xCas or HP PRIME
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?
07-30-2020, 08:33 PM
Post: #2
 Albert Chan Senior Member Posts: 965 Joined: Jul 2018
RE: integral bug in xCas or HP PRIME
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
07-31-2020, 06:23 AM
Post: #3
 robmio Junior Member Posts: 15 Joined: Jan 2020
RE: integral bug in xCas or HP PRIME
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?
07-31-2020, 11:14 AM
Post: #4
 Albert Chan Senior Member Posts: 965 Joined: Jul 2018
RE: integral bug in xCas or HP PRIME
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
07-31-2020, 11:43 AM
Post: #5
 robmio Junior Member Posts: 15 Joined: Jan 2020
RE: integral bug in xCas or HP PRIME
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.
07-31-2020, 02:42 PM
Post: #6
 Albert Chan Senior Member Posts: 965 Joined: Jul 2018
RE: integral bug in xCas or HP PRIME
(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
07-31-2020, 04:25 PM
Post: #7
 robmio Junior Member Posts: 15 Joined: Jan 2020
RE: integral bug in xCas or HP PRIME
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.
Yesterday, 07:41 PM
Post: #8
 parisse Senior Member Posts: 1,111 Joined: Dec 2013
RE: integral bug in xCas or HP PRIME
This is indeed a bug in Xcas, now fixed, thank you!
 « Next Oldest | Next Newest »

User(s) browsing this thread: Edwin, teerasak, 4 Guest(s)