Re: Re: sum question

*To*: mathgroup at smc.vnet.net*Subject*: [mg91227] Re: [mg91210] Re: sum question*From*: DrMajorBob <drmajorbob at att.net>*Date*: Sun, 10 Aug 2008 01:53:08 -0400 (EDT)*References*: <15975876.1218319650981.JavaMail.root@m08>*Reply-to*: drmajorbob at longhorns.com

Sadly, if Bill Rowe's guess is correct, rationalizing gives an EXACT answer which, most likely, is completely wrong. That is, changing the code as suggested doesn't change the fact that there's a lot of doubt as to the value of your sum, as it has NO significant digits. If the decimal numbers in question originated as exact quantities (rational fractions, for instance) you may need to try computing in that original form, not with the intermediate Reals you're now using. If one of those numbers was x = 2.22144, for instance, Rationalize might return Rationalize[x] 2.22144 or Rationalize[x, 0] 82187392/36997325 But it might have originated as N[Pi Sin[Pi/4]] 2.22144 2.22144, Pi Sin[Pi/4], 82187392/36997325, and N[Pi Sin[Pi/4]] are very different. The first and second are exact but different, while the first and last are not even the same to machine precision. Using Pi Sin[Pi/4] in your summation may be a lot slower, but it will also be far more exact. If you make that trade-off for thousands of entries, you may end with a sum that's prohibitively slow to compute. But using the decimals may give nothing but zero-precision, hence meaningless, answers. Bobby On Sat, 09 Aug 2008 06:47:43 -0500, Bill Rowe <readnews at sbcglobal.net> wrote: > On 8/8/08 at 7:14 AM, philip-kopp at uiowa.edu (Kopp, Philip F) wrote: > >> Hi, I am trying to work with a rather large sum(>200 terms) in >> Mathematica , but the program displays some odd behavior. When I >> multiply each term in the sum by 1, I get 1 for the answer. When I >> change 1 to 1.0, I get an incredibly large number for the answer. >> There seems to be some problem with using decimal numbers in this >> large sum. I tried Rationalize[1.0], and it works. What I am really >> trying to do is multiply each term by a different number(all less >> than one) that I calculated in another program. These numbers are >> in decimal form, so I run into the same problem. When I try >> rationalize here, it doen't fix the problem. > > Your description above suggests the issue is due to numeric > issues that arise when using machine precision numbers. I would > guess the terms in you sum likely involve say differences of two > nearly equal things where or some similar operation that will be > very sensitive o round off issues. > > Your description indicates a solution. That is using exact > arithmetic. The file of decimal numbers can be converted to > exact numbers using Rationalize. Of course the cost of doing > this will be an overall decrease in execution speed. > > If you need more specific suggestions, you will have to provide > more detail such as example data and the Mathematica code you > are currently using. > > -- DrMajorBob at longhorns.com

**Simulating a Mouseover Event with EventHandler**

**Re: memory question**

**Re: sum question**

**Re: sum question**