Re: Integration in 50G (1742 Views)
Reply
Frequent Advisor
JackZhan
Posts: 32
Registered: ‎07-12-2012
Message 1 of 5 (1,851 Views)
Accepted Solution

Integration in 50G

Hello!

 

Well when I tried to calculate the definite integral of |sin x| in [0, 2 Pi] I got the message Unable to find sign.

1.png

I switched into RPN mode and this error still exists. Then I used [RS] [ENTER] to obtain the numerical result, and after a while I got the correct answer 4. But I just can't get the answer simplely by clicking [EVAL].

 

I also tried to calculate the indefinite integral, and the calculator returned the correct answer -cos(x)*sign(sin(x)). Just wondering why the calculator produce an error when requesting a exact (not numerical, without .) result.

 

Jack

Honored Contributor
pin224466
Posts: 426
Registered: ‎03-01-2012
Message 2 of 5 (1,812 Views)

Re: Integration in 50G

[ Edited ]

this is NOT an answer that can be done in a single post.... simply because there isn't enough time to include everything in a single post.

 

To start:

EVAL is supposed to provide an exact answer (in EXACT mode, otherwise an approximation in APPROX mode)

->NUM will provide a numeric approximation or the result

 

 

part of the answer is likely hidden in the result achieved for an indefinite integral:

-cos(x)*sign(sin(x))

 

The answer is likely found with the function SIGN

 

with the following flag settings:

%%HP: T(3)A(R)F(.);
{ # 11508207990FF0h
# 1000000000000000h
# 5840020A010008h
# 0h }

 

if the above equation is EVAL'd  (or EXPAND'd), the result is -cos(x)

now, a single flag change:  RIGOROUS ON (flag -119 CLEAR)...

 

now, EVAL (or EXPAND) the result of the indefinite integral:

 

Capture.JPG

 

if you used EVAL on the indefinite integral result, EVAL a second time to produce a further simplified version of the equation:

 

Capture8.JPG

 

 

 

a general understanding of what the SIGN function performs on a variable can be found by a simple equation (with the above flag settings - rigorous ON)

'sin(x)'

SIGN

result:  sin(x)/|sin(x)|

now, if the above result is EVAL'd again the result is 1

HOWEVER, substitute a value for X first in the equation sin(x)/|sin(x)|...

'X=2*\pi'

EVAL

result: ?

 

 

 

now turn rigorous mode OFF (flag -119 SET)

'sin(x)'

SIGN

result: 1

 

 

 

 

 

Honored Contributor
pin224466
Posts: 426
Registered: ‎03-01-2012
Message 3 of 5 (1,785 Views)

Re: Integration in 50G

[ Edited ]

now plot the original equation from 0 -> 2PI....|sin(x)|

with RIGOROUS off....

Capture2.JPG

 

 

now RIGOROUS on...

 

Capture.JPG

 

 

 

now graph the result of the indefinite integral:  [-cos(x)*sign(sin(x)]

with RIGOROUS off....

 

Capture3.JPG

 

 

now RIGOROUS on...

 

Capture4.JPG

 

 

a couple of other pieces of info to look at (with RIGOROUS on):

 

Capture11.JPG

 

EVAL'd produces: Lim Error: unable to find sign

 

however,

 

Capture12.JPG

 

EVAL'd = 1

 

and,

 

Capture13.JPG

 

EVAL'd = -1

 

so it appears there might be a singularity present....

 

FYI, if you repeat the same 3 limit equations using the entire indefinite integral result -cos(x)*sign(sin(x))  the same results are achieved for each limit.

 

 

 

Honored Contributor
pin224466
Posts: 426
Registered: ‎03-01-2012
Message 4 of 5 (1,742 Views)

Re: Integration in 50G

[ Edited ]

confirming the last set of equations:

Capture9.JPG

 

EVAL'd = -1

 

and the limit X->PI -0 = 1

and the limit X->PI = cannot determine.

 

So there is a singularity....

 

 

unfortunately, due to the resolution of the 50G screen, when the resulting equation of the indefinite integral is plotted, the clear breaks in the plot at Pi and 2*PI are not 100% clear.

 

However, the subsequent calculations confirm they exist.

 

What has been shown is that when the original integral from 0 to 2PI of |sin(x)| is calculated,

it is clear that the 50G automatically sets RIGOROUS ON, even if it is not enabled in the flags (likely because of the absolute value function in the equation).

 

Rigorous ON is a perfectly reasonable expectation when EXACT mode is selected with an absolute value function present. 

 

now for the paper and pencil method:

 

|sin(x)| is sin(x) from 0 to PI

|sin(x)| is -sin(x) from PI to 2PI

so....

integral from 0 to 2PI of |sin(x)| can also be expressed as

integral from 0 to PI of sin(x)

+

integral from PI to 2PI of -sin(x)

 

Capture10.JPG

 

in EXACT MODE (rigorous mode setting no longer matters)

when EVAL'd = 4.

 

 

I can only refer you to a post made previously by Bernard Parisse (one of the CAS developers).   Bernard stated that the CAS cannot catch all singularites in EXACT integration (but it does flag some).

 

Regarding the numeric approximation method (using ->NUM) to achieve the result.... I cannot offer any answer as to the reason the singularity is resolved. 

 

I have never seen a single post indicating what type of numeric approximation algorithms are used for approximate integration in the 50G.  Obviously the numeric approximation algorithms are different from the exact calculations.

 

 

finally, FYI, here is another good example of the 50G dealing with an integral and having to use a little paper and pencil methodology (in this case the cauchy principal value method) to help the 50G resolve the singularity.

 

http://h30499.www3.hp.com/t5/Calculators/50g-Numerical-Integration-with-singularities/m-p/5678169#M1...

 

 

Esteemed Contributor
Bart dB
Posts: 418
Registered: ‎02-04-2010
Message 5 of 5 (1,689 Views)

Re: Integration in 50G

Hi pin,

 

Thank you for your excellent explanations :-)

 

Cheers,

-B

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.