HP50g glitch


There's an integral it gets the complete wrong answer to.

Oddly, it fails rather completely. It doesn't just report it can't get the right answer but reports a wrong answer. And it doesn't try awhile before it fails; it gives the wrong answer instantly.

It also can give the right answer in approximate mode:

It can also do similar problems correctly in exact mode (when the exponent is smaller):

The TI89 can do it correctly:

[link:http://www.wolframalpha.com/input/?i=integral%28%28sin%28x%29%29^16*cos%282*x%29%2Cx%2C0%2C2*pi%29]Wolfram Alpha link on integral[/link]


Hello Crawl,

I've checked your integral and get same result.
The complex mode of CAS fails too.

First idea: Maybe there is not enough memory for the stack operations.
That may explain why ^8 is possible.

The hp 50g is able to give the right result, when the integrand is
transformed by TEXPAND, TRIG and TLIN (used in this order).

But than it is necessary to get a hint that former result is wrong or the former integrand is not possible to integrate that you have the idea for transforming the integrand.

Double boo-boo!




First idea: Maybe there is not enough memory for the stack operations.
That may explain why ^8 is possible.

I don't know. You'd think if it was trying to do the integral but running out of memory, it would take a while before returning the wrong answer. Also, I would expect it to end with an error ("Out of Memory") rather than returning zero.

I'm wondering if, as some sort of time saving thing, the system tries to check if trigonometric integrals are even or odd (about their midpoint), and if they're odd, they immediately evaluate to zero. This one, of course, is even. But maybe there's a glitch in how it's checked? This is all just speculation, of course.


Hello Crawl,

I don't think that a checking for symmetry is responsible for this behavior, because ^8 or ^10 works, but not greater for example ^12 or ^16. If you take the step mode and interrupt while it is working, the stack is full with, symbols (even i, that shows me the CAS goes through the complex numbers).




It functioned till ^10 by ^12 it fails.

IF you use RISCH you get as antideriviate: 0,5*SIN(2*X)*SIN(X)^16, only the second factor was integrated by CAS. Very astonishing!


I had a discussion with Bernard Parisse about the topic. Here it is:

Hello Bernard,

to the best of my knowledge, the HP 50g CAS is derived from your work (ERABLE). In the MoHPC forum there is a recent thread that points out a bug in the integrator. The CAS is unable to properly integrate SIN(x)^16*COS(2x). Maybe you can enlighten the community what is going wrong in this special case.

Hi Marcus,

Indeed there is a bug here. It should return unevaluated, since the trigononometric linearization (that must be called to find the antiderivative) seems to be limited to power 10 (that's why with power 16 it aborts immediatly). Unfortunately I can not fix bugs for the HP50G (I could only for the 49G, but that would require some time since I have not programmed in system RPL since so long (...), moreover the fix would probably not be ported by HP for the 50G). A workaround here is:



Marcus, thank you for contacting Bernard.

Bernard, thank you for the handy workaround which should be applicable to similar type problems (not that I've come across any like this in my life).

Maybe someone at HP could issue a new ROM 2.15+... with this fix :-)

Ronald Williams


I took another look at this issue and I experimented with higher powers of the sine function up to 64 using Bernard Parisse's workaround. The actual results I get on the HP-50g agree with what I'm getting using computer program XCAS. I did this for three cases. The exact integral gave "-pi*27767032438524099/144115188075855872" in about 5 min. 22 seconds. The approximate integral using "sin(x)^64*cos(2*x)" in std format gave '-.6052984857784' in about 55 seconds and the symbolic anti-derivative (much to long to write out) in about 4 minutes 23 seconds. I set up a small RPL programs to compute the different cases and used the calculator's time function to compute the run times. I find this method easier than the stopwatch approach.

I also looked at the TI-89 emulator, TIEmu v2.00, version 2.05, HW2, all using unrestricted speed. The "sin(x)^64*cos(2*x)" case in exact mode ran for over 24 hours without a solution before I killed it The same case for the symbolic anti-derivative took about 26 seconds but I could not verify that the answer is correct because it does not agree with Wolfram Alpha or XCAS or Xmaxima and I have no desire to try and work it out by hand, assuming I could without mistakes. The approximate mode case gave "-.60529848578 in about 11 seconds. I then decided to try the original case "sin(x)^16*cos(2*x)" in exact mode and found it gave "-715*pi/2048" in about 4 minutes 29 seconds. On the other hand the HP takes about 24 seconds using the workaround and not emulated.

I am always amazed by the HP 49 series of calculators, they provide so many different ways to solve problems. However, the challenge for me is to master the machine and find one that works. One could say the HP 49 series represent the 'Swiss Army Knife' of calculators but then again I may be biased :-)

Ronald Williams


My TI-NSpire CAS CX computes the exact integral of sin(x)^64*cos(2*x) in about 11 seconds. It's the same answer as computed by Wolfram Alpha on my iPad. It's the same exact answer you got on the HP-50g.


Hello Marcus,

thank you for your engagement in that stuff. And thank you to Bernard Parisse for his work and statement, which clears the situation, fast and furious.

As my knowlege in the functionality of the hp 50g raises, raises my respect towards persons, who develops a CAS for an calculator. I hope my "double boo-boo" isn't misunderstood.



Thanks for answering this.

Possibly Related Threads...
Thread Author Replies Views Last Post
  hp50g screen weird line Sok-khieng Chum Hun 2 1,044 09-10-2013, 08:11 AM
Last Post: Sok-khieng Chum Hun
  Documentation about Hp50g / 49g+ / 48gII and wikis Pier Aiello 9 2,112 09-10-2013, 04:22 AM
Last Post: Software49g
  "A Penny for your thoughts" on the HP50g Tom Grydeland 3 1,204 08-01-2013, 03:57 AM
Last Post: Les Koller
  Is there a HP50g emulator for Linux? Matti Övermark 2 1,010 07-03-2013, 07:40 AM
Last Post: Matti Övermark
  HP50G advanced applications for mathematics CompSystems 0 763 06-17-2013, 08:38 AM
Last Post: CompSystems
  HP50g rebind stat key Chris Smith 1 801 05-26-2013, 06:21 PM
Last Post: Software49g
  How I use my HP50G at work. David Bengtson 7 1,681 05-06-2013, 02:57 PM
Last Post: Ingo
  HP50g emulator Richard Berler 1 843 03-24-2013, 02:43 PM
Last Post: aurelio
  Focus on the HP50g Mic 13 2,398 01-22-2013, 09:18 PM
Last Post: Ronald Williams
  HP50g and rechargeables Chris Smith 11 1,985 01-07-2013, 02:43 AM
Last Post: Derek Walker (UK)

Forum Jump: