Built-in constants

TO SUPPORT MY WORK, ORDER A COMMERCIAL LICENSE
THANK YOU!

Tutorial Math Collection API spec Download

Below is the code for JAVA, the code for C# is almost identical.

Case 1: Using built-in constants

import org.mariuszgromada.math.mxparser.*;
...
Expression e = new Expression("pi+e");
mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: pi+e = 5.859874482048838

Case 2: Estimating Moon gravitational acceleration

import org.mariuszgromada.math.mxparser.*;
...
Expression e = new Expression("( [G.] * [Moon-M] / [Moon-R]^2 ) * ( [m] / [s]^2 )");
mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: ( [G.] * [Moon-M] / [Moon-R]^2 ) * ( [m] / [s]^2 ) = 1.6247349715841357

Case 3: Getting list of constants

import org.mariuszgromada.math.mxparser.*;
...
Expression e = new Expression();
mXparser.consolePrintln(e.getHelp("constant"));   
[mXparser-v.5.0.0] Help content: 

    #  key word            type                    syntax                                        since description
    -  --------            ----                    ------                                        ----- -----------
  278. π                   <Constant Value>        π                                             5.0   Pi, Archimedes' constant or Ludolph's number - unicode math symbol
  279. ℼ                   <Constant Value>        ℼ                                             5.0   Pi, Archimedes' constant or Ludolph's number - unicode math symbol
  280. pi                  <Constant Value>        pi                                            1.0   Pi, Archimedes' constant or Ludolph's number
  281. e                   <Constant Value>        e                                             1.0   Napier's constant, or Euler's number, base of Natural logarithm
  282. ℯ                   <Constant Value>        ℯ                                             5.0   Napier's constant, or Euler's number, base of Natural logarithm - unicode math symbol
  283. ⅇ                   <Constant Value>        ⅇ                                             5.0   Napier's constant, or Euler's number, base of Natural logarithm - unicode math symbol
  284. [gam]               <Constant Value>        [gam]                                         1.0   Euler-Mascheroni constant
  285. [phi]               <Constant Value>        [phi]                                         1.0   Golden ratio
  286. [PN]                <Constant Value>        [PN]                                          1.0   Plastic constant
  287. [B*]                <Constant Value>        [B*]                                          1.0   Embree-Trefethen constant
  288. [F'd]               <Constant Value>        [F'd]                                         1.0   Feigenbaum constant alfa
  289. [F'a]               <Constant Value>        [F'a]                                         1.0   Feigenbaum constant delta
  290. [C2]                <Constant Value>        [C2]                                          1.0   Twin prime constant
  291. [M1]                <Constant Value>        [M1]                                          1.0   Meissel-Mertens constant
  292. [B2]                <Constant Value>        [B2]                                          1.0   Brun's constant for twin primes
  293. [B4]                <Constant Value>        [B4]                                          1.0   Brun's constant for prime quadruplets
  294. [BN'L]              <Constant Value>        [BN'L]                                        1.0   de Bruijn-Newman constant
  295. [Kat]               <Constant Value>        [Kat]                                         1.0   Catalan's constant
  296. [K*]                <Constant Value>        [K*]                                          1.0   Landau-Ramanujan constant
  297. [K.]                <Constant Value>        [K.]                                          1.0   Viswanath's constant
  298. [B'L]               <Constant Value>        [B'L]                                         1.0   Legendre's constant
  299. [RS'm]              <Constant Value>        [RS'm]                                        1.0   Ramanujan-Soldner constant
  300. [EB'e]              <Constant Value>        [EB'e]                                        1.0   Erdos-Borwein constant
  301. [Bern]              <Constant Value>        [Bern]                                        1.0   Bernstein's constant
  302. [GKW'l]             <Constant Value>        [GKW'l]                                       1.0   Gauss-Kuzmin-Wirsing constant
  303. [HSM's]             <Constant Value>        [HSM's]                                       1.0   Hafner-Sarnak-McCurley constant
  304. [lm]                <Constant Value>        [lm]                                          1.0   Golomb-Dickman constant
  305. [Cah]               <Constant Value>        [Cah]                                         1.0   Cahen's constant
  306. [Ll]                <Constant Value>        [Ll]                                          1.0   Laplace limit
  307. [AG]                <Constant Value>        [AG]                                          1.0   Alladi-Grinstead constant
  308. [L*]                <Constant Value>        [L*]                                          1.0   Lengyel's constant
  309. [L.]                <Constant Value>        [L.]                                          1.0   Levy's constant
  310. [Dz3]               <Constant Value>        [Dz3]                                         1.0   Apery's constant
  311. [A3n]               <Constant Value>        [A3n]                                         1.0   Mills' constant
  312. [Bh]                <Constant Value>        [Bh]                                          1.0   Backhouse's constant
  313. [Pt]                <Constant Value>        [Pt]                                          1.0   Porter's constant
  314. [L2]                <Constant Value>        [L2]                                          1.0   Lieb's square ice constant
  315. [Nv]                <Constant Value>        [Nv]                                          1.0   Niven's constant
  316. [Ks]                <Constant Value>        [Ks]                                          1.0   Sierpinski's constant
  317. [Kh]                <Constant Value>        [Kh]                                          1.0   Khinchin's constant
  318. [FR]                <Constant Value>        [FR]                                          1.0   Fransen-Robinson constant
  319. [La]                <Constant Value>        [La]                                          1.0   Landau's constant
  320. [P2]                <Constant Value>        [P2]                                          1.0   Parabolic constant
  321. [Om]                <Constant Value>        [Om]                                          1.0   Omega constant
  322. [MRB]               <Constant Value>        [MRB]                                         1.0   MRB constant
  323. [li2]               <Constant Value>        [li2]                                         2.3   li(2) - Logarithmic integral function at x=2
  324. [EG]                <Constant Value>        [EG]                                          2.3   Gompertz constant
  325.                  <Constant Value>                                                   4.0   <Physical Constant> Light speed in vacuum [m/s] (m=1, s=1)
  326. [G.]                <Constant Value>        [G.]                                          4.0   <Physical Constant> Gravitational constant (m=1, kg=1, s=1)]
  327. [g]                 <Constant Value>        [g]                                           4.0   <Physical Constant> Gravitational acceleration on Earth [m/s^2] (m=1, s=1)
  328. [hP]                <Constant Value>        [hP]                                          4.0   <Physical Constant> Planck constant (m=1, kg=1, s=1)
  329. [h-]                <Constant Value>        [h-]                                          4.0   <Physical Constant> Reduced Planck constant / Dirac constant (m=1, kg=1, s=1)]
  330. [lP]                <Constant Value>        [lP]                                          4.0   <Physical Constant> Planck length [m] (m=1)
  331. [mP]                <Constant Value>        [mP]                                          4.0   <Physical Constant> Planck mass [kg] (kg=1)
  332. [tP]                <Constant Value>        [tP]                                          4.0   <Physical Constant> Planck time [s] (s=1)
  333. [ly]                <Constant Value>        [ly]                                          4.0   <Astronomical Constant> Light year [m] (m=1)
  334. [au]                <Constant Value>        [au]                                          4.0   <Astronomical Constant> Astronomical unit [m] (m=1)
  335. [pc]                <Constant Value>        [pc]                                          4.0   <Astronomical Constant> Parsec [m] (m=1)
  336. [kpc]               <Constant Value>        [kpc]                                         4.0   <Astronomical Constant> Kiloparsec [m] (m=1)
  337. [Earth-R-eq]        <Constant Value>        [Earth-R-eq]                                  4.0   <Astronomical Constant> Earth equatorial radius [m] (m=1)
  338. [Earth-R-po]        <Constant Value>        [Earth-R-po]                                  4.0   <Astronomical Constant> Earth polar radius [m] (m=1)
  339. [Earth-R]           <Constant Value>        [Earth-R]                                     4.0   <Astronomical Constant> Earth mean radius (m=1)
  340. [Earth-M]           <Constant Value>        [Earth-M]                                     4.0   <Astronomical Constant> Earth mass [kg] (kg=1)
  341. [Earth-D]           <Constant Value>        [Earth-D]                                     4.0   <Astronomical Constant> Earth-Sun distance - semi major axis [m] (m=1)
  342. [Moon-R]            <Constant Value>        [Moon-R]                                      4.0   <Astronomical Constant> Moon mean radius [m] (m=1)
  343. [Moon-M]            <Constant Value>        [Moon-M]                                      4.0   <Astronomical Constant> Moon mass [kg] (kg=1)
  344. [Moon-D]            <Constant Value>        [Moon-D]                                      4.0   <Astronomical Constant> Moon-Earth distance - semi major axis [m] (m=1)
  345. [Solar-R]           <Constant Value>        [Solar-R]                                     4.0   <Astronomical Constant> Solar mean radius [m] (m=1)
  346. [Solar-M]           <Constant Value>        [Solar-M]                                     4.0   <Astronomical Constant> Solar mass [kg] (kg=1)
  347. [Mercury-R]         <Constant Value>        [Mercury-R]                                   4.0   <Astronomical Constant> Mercury mean radius [m] (m=1)
  348. [Mercury-M]         <Constant Value>        [Mercury-M]                                   4.0   <Astronomical Constant> Mercury mass [kg] (kg=1)
  349. [Mercury-D]         <Constant Value>        [Mercury-D]                                   4.0   <Astronomical Constant> Mercury-Sun distance - semi major axis [m] (m=1)
  350. [Venus-R]           <Constant Value>        [Venus-R]                                     4.0   <Astronomical Constant> Venus mean radius [m] (m=1)
  351. [Venus-M]           <Constant Value>        [Venus-M]                                     4.0   <Astronomical Constant> Venus mass [kg] (kg=1)
  352. [Venus-D]           <Constant Value>        [Venus-D]                                     4.0   <Astronomical Constant> Venus-Sun distance - semi major axis [m] (m=1)
  353. [Mars-R]            <Constant Value>        [Mars-R]                                      4.0   <Astronomical Constant> Mars mean radius [m] (m=1)
  354. [Mars-M]            <Constant Value>        [Mars-M]                                      4.0   <Astronomical Constant> Mars mass [kg] (kg=1)
  355. [Mars-D]            <Constant Value>        [Mars-D]                                      4.0   <Astronomical Constant> Mars-Sun distance - semi major axis [m] (m=1)
  356. [Jupiter-R]         <Constant Value>        [Jupiter-R]                                   4.0   <Astronomical Constant> Jupiter mean radius [m] (m=1)
  357. [Jupiter-M]         <Constant Value>        [Jupiter-M]                                   4.0   <Astronomical Constant> Jupiter mass [kg] (kg=1)
  358. [Jupiter-D]         <Constant Value>        [Jupiter-D]                                   4.0   <Astronomical Constant> Jupiter-Sun distance - semi major axis [m] (m=1)
  359. [Saturn-R]          <Constant Value>        [Saturn-R]                                    4.0   <Astronomical Constant> Saturn mean radius [m] (m=1)
  360. [Saturn-M]          <Constant Value>        [Saturn-M]                                    4.0   <Astronomical Constant> Saturn mass [kg] (kg=1)
  361. [Saturn-D]          <Constant Value>        [Saturn-D]                                    4.0   <Astronomical Constant> Saturn-Sun distance - semi major axis [m] (m=1)
  362. [Uranus-R]          <Constant Value>        [Uranus-R]                                    4.0   <Astronomical Constant> Uranus mean radius [m] (m=1)
  363. [Uranus-M]          <Constant Value>        [Uranus-M]                                    4.0   <Astronomical Constant> Uranus mass [kg] (kg=1)
  364. [Uranus-D]          <Constant Value>        [Uranus-D]                                    4.0   <Astronomical Constant> Uranus-Sun distance - semi major axis [m] (m=1)
  365. [Neptune-R]         <Constant Value>        [Neptune-R]                                   4.0   <Astronomical Constant> Neptune mean radius [m] (m=1)
  366. [Neptune-M]         <Constant Value>        [Neptune-M]                                   4.0   <Astronomical Constant> Neptune mass [kg] (kg=1)
  367. [Neptune-D]         <Constant Value>        [Neptune-D]                                   4.0   <Astronomical Constant> Neptune-Sun distance - semi major axis [m] (m=1)
  368. [true]              <Constant Value>        [true]                                        4.1   Boolean True represented as double, [true] = 1
  369. [false]             <Constant Value>        [false]                                       4.1   Boolean False represented as double, [false] = 0
  370. [NaN]               <Constant Value>        [NaN]                                         4.1   Not-a-Number
Nuget
Install-Package MathParser.org-mXparser -Version 5.0.2
Maven
<dependency>
<groupid>org.mariuszgromada.math</groupid>
<artifactid>MathParser.org-mXparser</artifactid>
<version>5.0.2</version>
</dependency>
Gradle
implementation 'org.mariuszgromada.math:MathParser.org-mXparser:5.0.2'
Gradle (Kotlin)
implementation("org.mariuszgromada.math:MathParser.org-mXparser:5.0.2")
GitHub
git clone https://github.com/mariuszgromada/MathParser.org-mXparser
OTHER DOWNLOAD OPTIONS

Download latest release – v.5.0.2 Leonis: bin + docDownload latest release – v.5.0.2 Leonis: bin only, includes separate binaries for various .NET platforms and Java versions
Source code .zipSource code .tar.gz
View on GitHubMathSpace.pl

DONATION
Did you find the software useful?
Please consider donation 🙂
DONATE