HP Forums
Maxima - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Maxima (/thread-17600.html)



Maxima - Gil - 10-20-2021 09:52 PM

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


RE: Maxima - Albert Chan - 10-20-2021 10:35 PM

Hi, Gil

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

1 / 298.257223563b0


RE: Maxima - Albert Chan - 10-20-2021 11:12 PM

There is also a decimal float package, https://people.eecs.berkeley.edu/~fateman/lisp/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


RE: Maxima - Gil - 10-20-2021 11:27 PM

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


RE: Maxima - John Keith - 10-21-2021 11:48 AM

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


RE: Maxima - Ren - 10-21-2021 02:07 PM

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