Post Reply 
Maxima
10-20-2021, 09:52 PM (This post was last modified: 10-20-2021 09:53 PM by Gil.)
Post: #1
Maxima
I developed a program on HP50G to calculate the Theorical Normal Earth Gravity.

Then I checked some of my program key values with the ones given by Charles Karney, who suggested me to verify my figures myself by own calculations with the program Maxima.

And look what I found with Maxima:

bigfloat (1/298257223563) gives

3.35281066474748071984552861852055595573263617800976384662611491675256864397313809041641635312737285​6... × 10^-12

but, executing,
bigfloat (1/298.257223563) gives

3.3528106647474804902220313351790537126362323760986328125... × 10^-3,

having previously done
fpprec : 100

Surprising result for a dummy like me.

How do you tackle such an issue?

Thanks in advance for your help and insight on the topic.

Gil Campart


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
10-20-2021, 10:35 PM
Post: #2
RE: Maxima
Hi, Gil

What you wanted is to increase precision of 298.257223563 before getting reciprocal, so do this:

1 / 298.257223563b0
Find all posts by this user
Quote this message in a reply
10-20-2021, 11:12 PM
Post: #3
RE: Maxima
There is also a decimal float package, https://people.eecs.berkeley.edu/~fatema...decfp.lisp

(%i1) load(decfp);
"C:/Program Files/Maxima/share/maxima/5.38.0/share/decfp.lisp"

(%i2) 0.9 - 0.3 * 3              → 1.110223024625157 * 10^16
(%i3) 0.9b0 - 0.3b0 * 3       → -1.387778780781446b-17
(%i4) 0.9L0 - 0.3L0 * 3       → 0.L0
Find all posts by this user
Quote this message in a reply
10-20-2021, 11:27 PM (This post was last modified: 10-20-2021 11:29 PM by Gil.)
Post: #4
RE: Maxima
Indeed, with b0 at the end the same digits with my programs.% “HP50G Division many digits“ !

Well, I feel somewhat more confident!

Thanks for the tip.


But why is it so to proceed?
Gil
Find all posts by this user
Quote this message in a reply
10-21-2021, 11:48 AM (This post was last modified: 10-21-2021 11:56 AM by John Keith.)
Post: #5
RE: Maxima
If you need higher precision on the 50g you can use the LongFloat library. With DIGITS set to 50, 298257223563 R<->F FINV returns 33528106647474807198455286185205559557326361780098.E-61 which agrees with your first result. With input of 298.257223563, R<->F FINV returns 33528106647474807198455286185205559557326361780098.E-52 which is also correct for all 50 digits, differing only in the exponent.

DIGITS can be set to any number up to 9999 which should be adequate for most purposes. Smile
Find all posts by this user
Quote this message in a reply
10-21-2021, 02:07 PM (This post was last modified: 10-21-2021 02:09 PM by Ren.)
Post: #6
RE: Maxima
(10-21-2021 11:48 AM)John Keith Wrote:  DIGITS can be set to any number up to 9999 which should be adequate for most purposes. Smile

[chuckle!]
(Remembering "the Rule of Thumb" for pi ~ 2)

10B, 10BII, 12C, 14B, 15C, 16C, 17B, 18C, 19BII, 20b, 22, 29C, 35, 38G, 39G, 41CV, 48G, 97
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)