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

Integration in 50G



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


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.



Honored Contributor
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:



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:




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






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)



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)|...



result: ?




now turn rigorous mode OFF (flag -119 SET)



result: 1






Honored Contributor
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....




now RIGOROUS on...






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

with RIGOROUS off....





now RIGOROUS on...





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




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






EVAL'd = 1






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
Posts: 426
Registered: ‎03-01-2012
Message 4 of 5 (1,742 Views)

Re: Integration in 50G

[ Edited ]

confirming the last set of equations:



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


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)




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.



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 :-)




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.