
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Janek Kozicki Sent: Tuesday, November 29, 2011 9:19 PM To: boost@lists.boost.org Subject: Re: [boost] [units] - learning to use, continued :)
But still I am quite happy today, because I managed to get a correctly working plots of this harmonic oscillator, but without units, unfortunately. One small problem is that I couldn't get to higher energies because double precision has limited factorials. I would need a working factorial of 100! which currently seems unlikely. And my currently maximum is only 25!
I didn't check yet, but maybe boost has some arbitrary precision library, which would work with Boost.Units and boost::math::factorial ?
So, for your pleasure I am presenting you with a harmonic oscillator code :)
- find some arbitrary precision library, that will work with Units and VERY big factorials, like 100! or even better 1000!
There are indeed at least two related efforts on arbitrary precision library going on. A multiprecision library by Christopher Kormanyos based on his e_float library which is in the sandbox . and, based on this, an extension to Boost.Math (already user-defined type ready and able to use NTL and GMP) that John Maddock is currently busy working on. These should allow you to calculate factorial 100! to a few hundred decimal digits. For your amusement, 100! is (to 50 decimal digits) 100! = 9.332621544394415268169923885626670049071596826438162146859e+157 But I'm not at all sure that this is the way forward for your purpose. For example, in calculating gamma functions, it is customary to use logs to avoid overflow. And we need to make sure we can walk before we can run - combining arbitrary precision with Boost.Units (where double precision is usually enough to represent the accuracy of physical things). Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com