HP 50g Takes hours to compute a convergent series



#7

I almost called HP support thinking my 50g was broken. I was following the tutorials in the manual and when I tried to find the sum of 1/k^2 from 1 to infinity, the calculator took over 15 min, so I stopped it and rebooted it. I tried again and let it go for an hour before I canceled it. I then let it run all night and today it rebooted and complained that the batteries were low. Today I tried it attached to my USB with new batteries. After 2 hours I canceled it and started to call HP, but I paused and thought about the modes that could cause this problem. I had it set to approximate mode. It hit me... This thing was trying to approximate the area under the curve using some type of Riemann's sum within who knows what error bound. I changed it to exact mode and it solved it in about 1 second. Would this thing have ever found an approximate answer? I also had the number format set to standard. If I change the format to fixed and some smaller precision, will the 50g increase the error to reduce the number of terms and reduce the computation time? I'm going to try it, but I was curious if anyone knew how this thing worked when approximating.


#8

Integration, not summation, is controlled by the display mode. Setting FIX to something small will not change how fast a sum is computed. Furthermore, in approximate mode, the Greek Sigma function doesn't do any kind of mathematical simplification or thinking at all; it just loops from a to b and adds all the terms together. If flag -21 is clear and flag -22 is set, then a summation from 1 to to infinity will take an infinite amount of time.

In other words, Don't Do That. If you want the 50g to do any kind of symbolic simplification, you must be in exact mode. Otherwise it'll just crank it numerically by brute force looping, which is great for summations that exact mode doesn't know how to simplify. Need an approximate summation to infinity that can't be simplified? Then instead of using infinity, just use a number that's large enough to get a useful answer but not so large that it takes too long. Infinity never makes sense in approximate mode.

Hope that helps!


#9

For calculations involving infinite sums, I use an upper limit of 250-500 to get a reasonable estimation - the time takes a few seconds instead of forever.


#10

Quote:
I use an upper limit of 250-500 to get a reasonable estimation

That might not be enough in this case:

Kind regards

Thomas


#11

Are you sure that summing 100, 500 or 600 terms makes a difference compare to an infinity ?


Looking at this graph, I am not sure ? It is looking really similar.

But of course this is only my point of view (or a scaling problem).


#12

We can estimate the error by integrating 1/x2 from N to infinity which leads to: 1/N. Thus you'd need to add a million terms to get 6 correct places. While this might still be done in a reasonable amount of time it takes probably too long to get 12 correct places.

The estimated error for your examples is:

100: 0.0100
500: 0.0020
600: 0.0017
You might not notice a difference by just looking at a graph.

Kind regards

Thomas


#13

I suggest you try my hpgcc2 library at hpcalc.org.
It is a numeric library, it will not calculate any infinite sums, but it should speed up the calculaton of sums by 50x to 100x

http://www.hpcalc.org/hp49/graphics/plotting/int1d.zip

Best regards
Gjermund


#14

You might as well be interested in this recent thread about
Riemann's Zeta Function (HP 50g) as

Cheers

Thomas

Edited: 13 May 2013, 7:00 a.m.

#15

From the readme.txt:

Quote:
Calculate sum(i=1 to 1000000) in about 10s.

That's still ~115 days just to calculate the sum from 1 to 1012. Keep in mind that we didn't calculate 1/n2 for each term yet. Compare that to the result using Rieman's Zeta function:

    s    |        Zeta(s)       |  time(s) |    exact value
---------+----------------------+----------+-----------------
2. | 1.64493406685 | 0.479 | pi^2/6

Sometimes it's worth to think a little on how to compute a result.

Cheers

Thomas

Edited: 13 May 2013, 7:29 a.m.


#16

This is great information, thank you. I'm sure it's very obvious to everyone that I'm very new to the calculus and advanced math world. I've been programming professionally for over 20 years and never had an opportunity to finish my undergrad. I work for a research lab and they asked me to continue my education and start working on a graduate degree. Now I'm back in school (Engineering Physics) and I'm starting from the ground up (The U of I only accepted a few of my liberal arts classes, which is probably a good thing). Most of my coworkers are engineers and they praise the HP calculators. One coworker gave me an HP-67 that I restored. I bought a 35s and a 50g and I'm slowly learning these amazing machines. I'm taking Calc 3 this summer and I've started studying vector calculus in preparation. I'm trying to augment my studies, and make it more interesting, by learning how to do the operations on the 50g and 35s and figure out how the calculator is doing what it does. I realized after I posted that the calculator probably was just doing a sum out to some number of partial sums. At first I thought it might be using an integral and then calculating the integral using a Riemann's sum, but it probably makes more sense that it's just summing the partial sums. It seems like an impossible task to have the calculator determine if the series is geometric or something else and find the radius of convergence to sum with a/(1-r). I suppose it could divide the sums to find the ratio, but that doesn't always work. Also thinking about it, I would imagine the calculator has to be doing some type of convergence tests and then finding the sum, but I'm surprised that it would just start calculating the sums to infinity without giving some error or stopping when it reaches a number that is correct within certain error. What if the series diverges (1/n) or it's an alternating series [(-1)^n/n]? Realize, I'm using a very limited amount of knowledge to figure out a black box (literally) that was designed by geniuses (like the people in this forum) with intelligence far greater than my own. Someday I hope to understand some portion of this math.


#17

Hi Matthew

Good luck with your studies and I hope you enjoy them together with your multiple HP calculators. To me they were always a good help in understanding mathematical problems: writing a program to solve a problem still makes me understand it better.

You brought up a problem which obviously isn't easy to solve. While WolframAlpha provides a list of convergence tests:

  • The ratio test is inconclusive.
  • The root test is inconclusive.
  • By the comparison test, the series converges.
you may not expect too much from the HP-50g. For its size it's a rather powerful calculator but still has limitations and it's important to find these since that gives you the confidence when using a tool.

Kind regards

Thomas


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP PRIME - How to convert TICKS in hours, minutes, seconds giancarlo 10 3,133 11-12-2013, 08:01 AM
Last Post: Harold A Climer
  HP-10C Series Family Photo Max Stone 5 2,239 10-24-2013, 10:31 PM
Last Post: Eddie W. Shore
  Product Series and Limit Expressions on the 50G Matt Agajanian 13 3,781 09-03-2013, 02:02 PM
Last Post: Simone Cerica
  HP Calc Series Mic 3 1,623 03-21-2013, 01:34 AM
Last Post: Mic
  HP 48G series -> 20 years NACHO 0 966 12-13-2012, 09:40 AM
Last Post: Nacho
  Swiss clones of the HP Voyager series WaltMaken 10 2,925 11-30-2012, 11:40 AM
Last Post: Harald
  HP-48: extract coefficient of power series Thomas Klemm 3 1,580 10-21-2012, 11:42 PM
Last Post: Han
  HP32SII takes 120 to process a command Bruce Larrabee 2 1,230 08-25-2012, 05:42 AM
Last Post: Bruce Larrabee
  Best Keyboard of the HP 28/48/49/50 Series Eddie W. Shore 9 3,337 07-12-2012, 07:21 AM
Last Post: Dave Britten
  hp 41 series wire-wrapped connector question. Matt Kernal 3 1,706 06-19-2012, 01:48 AM
Last Post: Luiz C. Vieira (Brazil)

Forum Jump: