Post Reply 
integral bug in xCas or HP PRIME
07-30-2020, 08:14 PM
Post: #1
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?
Find all posts by this user
Quote this message in a reply
07-30-2020, 08:33 PM
Post: #2
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
Find all posts by this user
Quote this message in a reply
07-31-2020, 06:23 AM
Post: #3
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?
Find all posts by this user
Quote this message in a reply
07-31-2020, 11:14 AM
Post: #4
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
Find all posts by this user
Quote this message in a reply
07-31-2020, 11:43 AM
Post: #5
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.
Find all posts by this user
Quote this message in a reply
07-31-2020, 02:42 PM
Post: #6
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
Find all posts by this user
Quote this message in a reply
07-31-2020, 04:25 PM
Post: #7
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.
Find all posts by this user
Quote this message in a reply
08-03-2020, 07:41 PM
Post: #8
RE: integral bug in xCas or HP PRIME
This is indeed a bug in Xcas, now fixed, thank you!
Find all posts by this user
Quote this message in a reply
08-04-2020, 12:05 PM
Post: #9
RE: integral bug in xCas or HP PRIME
Thank you very much; from which website can I download xCas?

Cordially greeting, Roberto Mioni (robmio).
Find all posts by this user
Quote this message in a reply
08-04-2020, 03:01 PM
Post: #10
RE: integral bug in xCas or HP PRIME
xcas is available here
https://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Find all posts by this user
Quote this message in a reply
08-04-2020, 06:46 PM
Post: #11
RE: integral bug in xCas or HP PRIME
The bug is not yet fixed in the binaries. Probably end of next week for win64.
Find all posts by this user
Quote this message in a reply
08-05-2020, 11:29 AM
Post: #12
RE: integral bug in xCas or HP PRIME
Very well, thank you very much. Roberto Mioni (robmio).
Find all posts by this user
Quote this message in a reply
08-07-2020, 01:47 PM
Post: #13
RE: integral bug in xCas or HP PRIME
I think that this year also the CAS of the hp-prime is updated to 1.6.x =)
Find all posts by this user
Quote this message in a reply
08-08-2020, 08:21 AM
Post: #14
RE: integral bug in xCas or HP PRIME
Great. We will look forward to it
Find all posts by this user
Quote this message in a reply
Post Reply 




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