Friday, February 17, 2017

Mathematical Constants

Need a mathematical constant?  Here they are in Java as BigDecimals provided by GitHub's JMathConstant project.

And here is a quicklook of the code:

package com.gliesian.constants;

import java.math.BigDecimal;

public class MathConstant {

    private MathConstant() {
    }
    
    public static BigDecimal ZERO = new BigDecimal("0.0");
    public static BigDecimal ONE = new BigDecimal("1.0");
    public static BigDecimal MEISSEL_MERTENS = new BigDecimal("0.26149721284764278375542683860869585");
    public static BigDecimal BERNSTEINS = new BigDecimal("0.28016949902386913303");
    public static BigDecimal GAUSS_KKUZMIN_WIRSING = new BigDecimal("0.30366300289873265859744812190155623");
    public static BigDecimal HAFNER_SARNAK_MCCURLEY = new BigDecimal("0.35323637185499598454351655043268201");
    public static BigDecimal LANDAUS = new BigDecimal("0.5");
    public static BigDecimal EULER_MASCHERONI = new BigDecimal("0.57721");
    public static BigDecimal OMEGA = new BigDecimal("0.56714329040978387299996866221035555");
    public static BigDecimal GOLOMB_DICKMAN = new BigDecimal("0.6243299885435508709929363831083724");
    public static BigDecimal CAHEN = new BigDecimal("0.6434105463");
    public static BigDecimal TWO_PRIME = new BigDecimal("0.6601618158468695739281211001455577");
    public static BigDecimal LAPLANE_LIMIT = new BigDecimal("0.66274341934918158097474209710925290");
    public static BigDecimal EMBREE_TREFETHEN = new BigDecimal("0.70258");
    public static BigDecimal LANDAU_RAMANUJAN = new BigDecimal("0.76422365358922066299069873125009232");
    public static BigDecimal ALLADI_GRINSTEAD = new BigDecimal("0.8093940205");
    public static BigDecimal BRUN = new BigDecimal("0.8705883800");
    public static BigDecimal CATALANS = new BigDecimal("0.91596559417721901505460351493238411");
    public static BigDecimal LEGENDRE = new BigDecimal("1.0");
    public static BigDecimal LENGYELS = new BigDecimal("1.0986858055");
    public static BigDecimal VISWANATHS = new BigDecimal("1.13198824");
    public static BigDecimal APERYS = new BigDecimal("1.20205690315959428539973816151144999");
    public static BigDecimal GLAISHER_KINKELIN = new BigDecimal("1.2824271291");
    public static BigDecimal CONWAYS = new BigDecimal("1.30357726903429639125709911215255189");
    public static BigDecimal MILLS = new BigDecimal("1.30637788386308069046861449260260571");
    public static BigDecimal PLASTIC = new BigDecimal("1.32471795724474602596090885447809734");
    public static BigDecimal PYTHAGORAS = new BigDecimal("1.4142135623730950488");
    public static BigDecimal RAMANUJAN_SOLDNER = new BigDecimal("1.45136923488338105028396848589202744");
    public static BigDecimal PORTERS = new BigDecimal("1.4670780794");
    public static BigDecimal BACKHOUSE = new BigDecimal("1.45607494858268967139959535111654356");
    public static BigDecimal LIEBS_SQUARE_ICE = new BigDecimal("1.5396007178");
    public static BigDecimal ERDOS_BORWEIN = new BigDecimal("1.60669515241529176378330152319092458");
    public static BigDecimal GOLDEN_RATIO = new BigDecimal("1.61803398874989484820458683436563811772030917980576286213544862270526046281890");
    public static BigDecimal NIVENS = new BigDecimal("1.70521114010536776428855145343450816");
    public static BigDecimal THEODORUS = new BigDecimal("1.73205080756887729352744634150587236");
    public static BigDecimal BRUNS = new BigDecimal("1.9021605823");
    public static BigDecimal UNIVERSAL_PARABOLIC = new BigDecimal("2.29558714939263807403429804918949039");
    public static BigDecimal SILVER_RATIO = new BigDecimal("2.4142135623730950488");
    public static BigDecimal FEIGENBAUMS_FIRST = new BigDecimal("2.50290787509589282228390287321821578");
    public static BigDecimal SIERPINSKI = new BigDecimal("2.58498175957925321706589358738317116");
    public static BigDecimal KHINCHIN = new BigDecimal("2.68545200106530644530971483548179569");
    public static BigDecimal NAPIERS = new BigDecimal("2.7182818284590452353602874713527");
    public static BigDecimal FRANSEN_ROBINSON = new BigDecimal("2.80777024202851936522150118655777293");
    public static BigDecimal ARCHIMEDES = new BigDecimal("3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989");
    public static BigDecimal LEVYS = new BigDecimal("3.27582291872181115978768188245384386");
    public static BigDecimal RECIPROCAL_FIBONACCI = new BigDecimal("3.35988566624317755317201130291892717");
    public static BigDecimal FEIGENBAUMS_SECOND = new BigDecimal("4.66920160910299067185320382046620161");

    public static void main(String[] args) {
        System.out.println("MEISSEL_MERTENS CONSTANT: " + MEISSEL_MERTENS);
    }
}

No comments:

Post a Comment

The source code for gliesians.com is for sale on Ebay.

I've decided to shut down gliesians.com and sell the source code. If anyone is looking to purchase the related source, you can find it...