Post Reply 
Integration in Home Mode - possible bug
10-14-2024, 04:21 AM
Post: #1
Integration in Home Mode - possible bug
Hi
In HOME mode, the first result is wrong. It should be the same as the second one.

∫(√((SIN(X)-1/3)^2),X,0,π/3) gives 0.150934149603
∫(ABS(SIN(X)-1/3),X,0,π/3) gives 0.263110172403

In CAS mode both definite integrals give the same 'exact' answer which approximates to 0.263110172401

∫(√((sin(x)-1/3)^2),x,0,π/3) gives -1/9*π+4/3*√2+2/3*asin(1/3)-1/2-1
∫(ABS(sin(x)-1/3),x,0,π/3) gives -1/9*π+4/3*√2+2/3*asin(1/3)-1/2-1

Please confirm if someone can reproduce these results. Thanks.
Find all posts by this user
Quote this message in a reply
10-14-2024, 08:27 AM
Post: #2
RE: Integration in Home Mode - possible bug
Thanks for reporting the bug. I’ve managed to reproduce it; there may be a relation to an issue I’ve since noticed in the CAS view (that, in the CAS view, an evaluation of “∫(sqrt(X^2),X,-1,0)” produces a noticeably different result than an evaluation of “∫(sqrt(X^2.),X,-1,0)” produces). I’ve created a ticket for this in the bug tracker I’ve set up (to help keep track of bugs).
Find all posts by this user
Quote this message in a reply
10-14-2024, 12:19 PM
Post: #3
RE: Integration in Home Mode - possible bug
Thanks jte.

Some additional info.

If the wrong case is expressed as a sum of two integrals (A+B) considering that 1/3 is a root of the function, it can be noticed that A gets the wrong sign:

A=∫(√((SIN(X)-1/3)^2),X,0,1/3) gives −5.60680574258ᴇ−2 (This can not be negative)
B=∫(√((SIN(X)-1/3)^2),X,1/3,π/3) gives 0.207002207029

|A|+B gives 0.263070264455 which is a better approximation of the correct result.

Regards.
Find all posts by this user
Quote this message in a reply
10-14-2024, 12:31 PM
Post: #4
RE: Integration in Home Mode - possible bug
Internally, the power 2 from Home should be translated to an exact power 2, not an approx 2.0 power before calling integration. Approx powers are not well defined for negative values
Find all posts by this user
Quote this message in a reply
10-14-2024, 01:18 PM
Post: #5
RE: Integration in Home Mode - possible bug
(10-14-2024 12:19 PM)Patocuy Wrote:  A=∫(√((SIN(X)-1/3)^2),X,0,1/3) gives −5.60680574258ᴇ−2 (This can not be negative)
B=∫(√((SIN(X)-1/3)^2),X,1/3,π/3) gives 0.207002207029

|A|+B gives 0.263070264455 which is a better approximation of the correct result.

It seems sqrt(z^2) get simplified to z^(2*1/2) = z, instead of |z|, so even B is wrong by a small amount.
Find all posts by this user
Quote this message in a reply
10-14-2024, 11:28 PM
Post: #6
RE: Integration in Home Mode - possible bug
If anyone is interested, the two integrals came from this post.

https://community.ptc.com/t5/Mathcad/Bug...d-p/977332

Curiously, Mathcad Prime 10 fails in symbolic mode with the absolute value integral and computes correctly the square root integral. In numeric mode, both answers are correct. Some results from other math software are discussed too, including Xcas!

Regards.
Find all posts by this user
Quote this message in a reply
10-15-2024, 05:00 AM
Post: #7
RE: Integration in Home Mode - possible bug
The Prime home result is so bizarre, so unexpected! My CASIO 991 CW, my HP 42S, and my HP 35S come up with the correct result.
Find all posts by this user
Quote this message in a reply
10-19-2024, 12:27 AM
Post: #8
RE: Integration in Home Mode - possible bug
(10-14-2024 01:18 PM)Albert Chan Wrote:  
(10-14-2024 12:19 PM)Patocuy Wrote:  A=∫(√((SIN(X)-1/3)^2),X,0,1/3) gives −5.60680574258ᴇ−2 (This can not be negative)
B=∫(√((SIN(X)-1/3)^2),X,1/3,π/3) gives 0.207002207029

|A|+B gives 0.263070264455 which is a better approximation of the correct result.

It seems sqrt(z^2) get simplified to z^(2*1/2) = z, instead of |z|, so even B is wrong by a small amount.

Yes, the integral calculated in HOME mode corresponds to z instead of |z|


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
10-23-2024, 06:16 PM (This post was last modified: 10-23-2024 06:58 PM by amindanial.)
Post: #9
RE: Integration in Home Mode - possible bug
Unfortunately, the problem comes from the fact that HP Prime gives the answer of sqrt (x^2) as x not |x|. This bug has to be solved. This bug is not found in XCAS, it is only in HP Prime.
Find all posts by this user
Quote this message in a reply
10-23-2024, 07:05 PM
Post: #10
RE: Integration in Home Mode - possible bug
FYI, I have committed a fix for the Prime. Should be available in the next firmware release.
Find all posts by this user
Quote this message in a reply
Post Reply 




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