Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75998 - sandbox/math_constants/boost/math/constants
From: pbristow_at_[hidden]
Date: 2011-12-16 13:04:00


Author: pbristow
Date: 2011-12-16 13:04:00 EST (Fri, 16 Dec 2011)
New Revision: 75998
URL: http://svn.boost.org/trac/boost/changeset/75998

Log:
Several decimal digits strings replaced by calculations.
Text files modified:
   sandbox/math_constants/boost/math/constants/calculate_constants.hpp | 85 ++++++++++++++++++---------------------
   1 files changed, 40 insertions(+), 45 deletions(-)

Modified: sandbox/math_constants/boost/math/constants/calculate_constants.hpp
==============================================================================
--- sandbox/math_constants/boost/math/constants/calculate_constants.hpp (original)
+++ sandbox/math_constants/boost/math/constants/calculate_constants.hpp 2011-12-16 13:04:00 EST (Fri, 16 Dec 2011)
@@ -575,18 +575,7 @@
      * gamma<T, policies::policy<policies::digits2<N> > >();
 }
 
-// Continued fraction
-template <class T>
-template<int N>
-inline T constant_cf10<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
-{
- // TODO calculate this.
- BOOST_MATH_STD_USING
- T cf10("1.030640834100712935881776094116936840925");
- return cf10;
-}
-
-//Zeta
+// Zeta
 
 template <class T>
 template<int N>
@@ -699,7 +688,8 @@
 inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
 { // from e_float constants.cpp
   // http://mathworld.wolfram.com/KhinchinsConstant.html
- // TODO calculate this.
+ // http://jeremiebourdon.free.fr/data/Khintchine.pdf might help but looks frightening :-(
+ // TODO calculate this?
   T k( "2.6854520010653064453097148354817956938203822939944629530511523455572188595371520028011411749318476979"
 "9515346590528809008289767771641096305179253348325966838185231542133211949962603932852204481940961806"
 "8664166428930847788062036073705350103367263357728904990427070272345170262523702354581068631850103237"
@@ -719,22 +709,23 @@
 inline T constant_extreme_value_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
 { // from e_float constants.cpp
   // Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
- // TODO Calculate this.
+ T ev(12 * sqrt(static_cast<T>(6)) * zeta_three<T, policies::policy<policies::digits2<N> > >()
+ / pi_cubed<T, policies::policy<policies::digits2<N> > >() );
 
-T ev(
-"1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150"
-"1894272048688553376986765366075828644841024041679714157616857834895702411080704529137366329462558680"
-"2015498788776135705587959418756809080074611906006528647805347822929577145038743873949415294942796280"
-"0895597703063466053535550338267721294164578901640163603544404938283861127819804918174973533694090594"
-"3094963822672055237678432023017824416203652657301470473548274848068762500300316769691474974950757965"
-"8640779777748741897542093874605477776538884083378029488863880220988107155275203245233994097178778984"
-"3488995668362387892097897322246698071290011857605809901090220903955815127463328974447572119951192970"
-"3684453635456559086126406960279692862247058250100678008419431185138019869693206366891639436908462809"
-"9756051372711251054914491837034685476095423926553367264355374652153595857163724698198860485357368964"
-"3807049634423621246870868566707915720704996296083373077647528285782964567312903914752617978405994377"
-"9064157147206717895272199736902453130842229559980076472936976287378945035706933650987259357729800315");
+//T ev(
+//"1.1395470994046486574927930193898461120875997958365518247216557100852480077060706857071875468869385150"
+//"1894272048688553376986765366075828644841024041679714157616857834895702411080704529137366329462558680"
+//"2015498788776135705587959418756809080074611906006528647805347822929577145038743873949415294942796280"
+//"0895597703063466053535550338267721294164578901640163603544404938283861127819804918174973533694090594"
+//"3094963822672055237678432023017824416203652657301470473548274848068762500300316769691474974950757965"
+//"8640779777748741897542093874605477776538884083378029488863880220988107155275203245233994097178778984"
+//"3488995668362387892097897322246698071290011857605809901090220903955815127463328974447572119951192970"
+//"3684453635456559086126406960279692862247058250100678008419431185138019869693206366891639436908462809"
+//"9756051372711251054914491837034685476095423926553367264355374652153595857163724698198860485357368964"
+//"3807049634423621246870868566707915720704996296083373077647528285782964567312903914752617978405994377"
+//"9064157147206717895272199736902453130842229559980076472936976287378945035706933650987259357729800315");
 
-return ev;
+ return ev;
 }
 
 template <class T>
@@ -742,9 +733,10 @@
 inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
 { // from http://mpmath.googlecode.com/svn/data/glaisher.txt
   // 20,000 digits of the Glaisher-Kinkelin constant A = exp(1/2 - zeta'(-1))
- // Computed using A = exp((6 (-zeta(2))/pi^2 + log 2 pi + gamma)/12)
+ // Computed using A = exp((6 (-zeta'(2))/pi^2 + log 2 pi + gamma)/12)
   // with Euler-Maclaurin summation for zeta'(2).
- // TODO calculate this.
+ // No good references/algorithms for this found yet.
+ // TODO calculate this?
 
   T g(
 "1.282427129100622636875342568869791727767688927325001192063740021740406308858826"
@@ -770,20 +762,24 @@
 { // From e_float
   // 1100 digits of the Rayleigh distribution skewness
   // Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
- // TODO Calculate this using pi_minus_three etc.
 
-T rs(
- "0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067"
- "9440004726436754739597525250317640394102954301685809920213808351450851396781817932734836994829371322"
- "5797376021347531983451654130317032832308462278373358624120822253764532674177325950686466133508511968"
- "2389168716630349407238090652663422922072397393006683401992961569208109477307776249225072042971818671"
- "4058887072693437217879039875871765635655476241624825389439481561152126886932506682176611183750503553"
- "1218982627032068396407180216351425758181396562859085306247387212297187006230007438534686340210168288"
- "8956816965453815849613622117088096547521391672977226658826566757207615552041767516828171274858145957"
- "6137539156656005855905288420585194082284972984285863898582313048515484073396332610565441264220790791"
- "0194897267890422924599776483890102027823328602965235306539844007677157873140562950510028206251529523"
- "7428049693650605954398446899724157486062545281504433364675815915402937209673727753199567661561209251"
- "4695589950526053470201635372590001578503476490223746511106018091907936826431407434894024396366284848"); ;
+T rs(2 * root_pi<T, policies::policy<policies::digits2<N> > >()
+ * pi_minus_three<T, policies::policy<policies::digits2<N> > >()
+ / pow(four_minus_pi<T, policies::policy<policies::digits2<N> > >(), static_cast<T>(3./2))
+ );
+ // 6.31110657818937138191899351544227779844042203134719497658094585692926819617473725459905027032537306794400047264,
+
+ //"0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067"
+ //"9440004726436754739597525250317640394102954301685809920213808351450851396781817932734836994829371322"
+ //"5797376021347531983451654130317032832308462278373358624120822253764532674177325950686466133508511968"
+ //"2389168716630349407238090652663422922072397393006683401992961569208109477307776249225072042971818671"
+ //"4058887072693437217879039875871765635655476241624825389439481561152126886932506682176611183750503553"
+ //"1218982627032068396407180216351425758181396562859085306247387212297187006230007438534686340210168288"
+ //"8956816965453815849613622117088096547521391672977226658826566757207615552041767516828171274858145957"
+ //"6137539156656005855905288420585194082284972984285863898582313048515484073396332610565441264220790791"
+ //"0194897267890422924599776483890102027823328602965235306539844007677157873140562950510028206251529523"
+ //"7428049693650605954398446899724157486062545281504433364675815915402937209673727753199567661561209251"
+ //"4695589950526053470201635372590001578503476490223746511106018091907936826431407434894024396366284848"); ;
   return rs;
 }
 
@@ -791,7 +787,7 @@
 template<int N>
 inline T constant_rayleigh_kurtosis_excess<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
 { // - (6 Pi^2 - 24 Pi + 16)/((Pi - 4)^2)
- // TODO Calculate this using pi_minus_four etc.
+ // Might provide provide and calculate this using pi_minus_four.
    return - (((static_cast<T>(6) * pi<T, policies::policy<policies::digits2<N> > >()
         * pi<T, policies::policy<policies::digits2<N> > >())
    - (static_cast<T>(24) * pi<T, policies::policy<policies::digits2<N> > >()) + static_cast<T>(16) )
@@ -805,7 +801,7 @@
 template<int N>
 inline T constant_rayleigh_kurtosis<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
 { // 3 - (6 Pi^2 - 24 Pi + 16)/((Pi - 4)^2)
- // TODO Calculate this using pi_minus_four etc.
+ // Might provide provide and calculate this using pi_minus_four.
    return static_cast<T>(3) - (((static_cast<T>(6) * pi<T, policies::policy<policies::digits2<N> > >()
         * pi<T, policies::policy<policies::digits2<N> > >())
    - (static_cast<T>(24) * pi<T, policies::policy<policies::digits2<N> > >()) + static_cast<T>(16) )
@@ -815,7 +811,6 @@
    );
 }
 
-
 }}}} // namespaces
 
 #endif // BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk