Built-in constants

MathParser.org - mXparser - logo - Tutorial

*** If you found the software useful donation is something you might consider ๐Ÿ™‚ ***

If you found the software useful donation is something you might consider :-)

JAVA code

Case 1: Using built-in constants

import org.mariuszgromada.math.mxparser.*;
...
Expression e = new Expression("pi+e");
mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
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.4.0.0] Res: ( [G.] * [Moon-M] / [Moon-R]^2 ) * ( [m] / [s]^2 ) = 1.624734971584136

Case 3: Getting list of constants

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

  183. pi                  <Constant Value>        Pi, Archimedes' constant or Ludolph's number
  184. e                   <Constant Value>        Napier's constant, or Euler's number, base of Natural logarithm
  185. [gam]               <Constant Value>        Euler-Mascheroni constant
  186. [phi]               <Constant Value>        Golden ratio
  187. [PN]                <Constant Value>        Plastic constant
  188. [B*]                <Constant Value>        Embree-Trefethen constant
  189. [F'd]               <Constant Value>        Feigenbaum constant alfa
  190. [F'a]               <Constant Value>        Feigenbaum constant delta
  191. [C2]                <Constant Value>        Twin prime constant
  192. [M1]                <Constant Value>        Meissel-Mertens constant
  193. [B2]                <Constant Value>        Brun's constant for twin primes
  194. [B4]                <Constant Value>        Brun's constant for prime quadruplets
  195. [BN'L]              <Constant Value>        de Bruijn-Newman constant
  196. [Kat]               <Constant Value>        Catalan's constant
  197. [K*]                <Constant Value>        Landau-Ramanujan constant
  198. [K.]                <Constant Value>        Viswanath's constant
  199. [B'L]               <Constant Value>        Legendre's constant
  200. [RS'm]              <Constant Value>        Ramanujan-Soldner constant
  201. [EB'e]              <Constant Value>        Erdos-Borwein constant
  202. [Bern]              <Constant Value>        Bernstein's constant
  203. [GKW'l]             <Constant Value>        Gauss-Kuzmin-Wirsing constant
  204. [HSM's]             <Constant Value>        Hafner-Sarnak-McCurley constant
  205. [lm]                <Constant Value>        Golomb-Dickman constant
  206. [Cah]               <Constant Value>        Cahen's constant
  207. [Ll]                <Constant Value>        Laplace limit
  208. [AG]                <Constant Value>        Alladi-Grinstead constant
  209. [L*]                <Constant Value>        Lengyel's constant
  210. [L.]                <Constant Value>        Levy's constant
  211. [Dz3]               <Constant Value>        Apery's constant
  212. [A3n]               <Constant Value>        Mills' constant
  213. [Bh]                <Constant Value>        Backhouse's constant
  214. [Pt]                <Constant Value>        Porter's constant
  215. [L2]                <Constant Value>        Lieb's square ice constant
  216. [Nv]                <Constant Value>        Niven's constant
  217. [Ks]                <Constant Value>        Sierpinski's constant
  218. [Kh]                <Constant Value>        Khinchin's constant
  219. [FR]                <Constant Value>        Fransen-Robinson constant
  220. [La]                <Constant Value>        Landau's constant
  221. [P2]                <Constant Value>        Parabolic constant
  222. [Om]                <Constant Value>        Omega constant
  223. [MRB]               <Constant Value>        MRB constant
  224. [li2]               <Constant Value>        (2.3) li(2) - logarithmic integral function at x=2
  225. [EG]                <Constant Value>        (2.3) Gompertz constant
  226. [ c]                <Constant Value>        (4.0) <Physical Constant> Light speed in vacuum [m/s] (m=1, s=1)
  227. [G.]                <Constant Value>        (4.0) <Physical Constant> Gravitational constant (m=1, kg=1, s=1)]
  228. [g]                 <Constant Value>        (4.0) <Physical Constant> Gravitational acceleration on Earth [m/s^2] (m=1, s=1)
  229. [hP]                <Constant Value>        (4.0) <Physical Constant> Planck constant (m=1, kg=1, s=1)
  230. [h-]                <Constant Value>        (4.0) <Physical Constant> Reduced Planck constant / Dirac constant (m=1, kg=1, s=1)]
  231. [lP]                <Constant Value>        (4.0) <Physical Constant> Planck length [m] (m=1)
  232. [mP]                <Constant Value>        (4.0) <Physical Constant> Planck mass [kg] (kg=1)
  233. [tP]                <Constant Value>        (4.0) <Physical Constant> Planck time [s] (s=1)
  234. [ly]                <Constant Value>        (4.0) <Astronomical Constant> Light year [m] (m=1)
  235. [au]                <Constant Value>        (4.0) <Astronomical Constant> Astronomical unit [m] (m=1)
  236. [pc]                <Constant Value>        (4.0) <Astronomical Constant> Parsec [m] (m=1)
  237. [kpc]               <Constant Value>        (4.0) <Astronomical Constant> Kiloparsec [m] (m=1)
  238. [Earth-R-eq]        <Constant Value>        (4.0) <Astronomical Constant> Earth equatorial radius [m] (m=1)
  239. [Earth-R-po]        <Constant Value>        (4.0) <Astronomical Constant> Earth polar radius [m] (m=1)
  240. [Earth-R]           <Constant Value>        (4.0) <Astronomical Constant> Earth mean radius (m=1)
  241. [Earth-M]           <Constant Value>        (4.0) <Astronomical Constant> Earth mass [kg] (kg=1)
  242. [Earth-D]           <Constant Value>        (4.0) <Astronomical Constant> Earth-Sun distance - semi major axis [m] (m=1)
  243. [Moon-R]            <Constant Value>        (4.0) <Astronomical Constant> Moon mean radius [m] (m=1)
  244. [Moon-M]            <Constant Value>        (4.0) <Astronomical Constant> Moon mass [kg] (kg=1)
  245. [Moon-D]            <Constant Value>        (4.0) <Astronomical Constant> Moon-Earth distance - semi major axis [m] (m=1)
  246. [Solar-R]           <Constant Value>        (4.0) <Astronomical Constant> Solar mean radius [m] (m=1)
  247. [Solar-M]           <Constant Value>        (4.0) <Astronomical Constant> Solar mass [kg] (kg=1)
  248. [Mercury-R]         <Constant Value>        (4.0) <Astronomical Constant> Mercury mean radius [m] (m=1)
  249. [Mercury-M]         <Constant Value>        (4.0) <Astronomical Constant> Mercury mass [kg] (kg=1)
  250. [Mercury-D]         <Constant Value>        (4.0) <Astronomical Constant> Mercury-Sun distance - semi major axis [m] (m=1)
  251. [Venus-R]           <Constant Value>        (4.0) <Astronomical Constant> Venus mean radius [m] (m=1)
  252. [Venus-M]           <Constant Value>        (4.0) <Astronomical Constant> Venus mass [kg] (kg=1)
  253. [Venus-D]           <Constant Value>        (4.0) <Astronomical Constant> Venus-Sun distance - semi major axis [m] (m=1)
  254. [Mars-R]            <Constant Value>        (4.0) <Astronomical Constant> Mars mean radius [m] (m=1)
  255. [Mars-M]            <Constant Value>        (4.0) <Astronomical Constant> Mars mass [kg] (kg=1)
  256. [Mars-D]            <Constant Value>        (4.0) <Astronomical Constant> Mars-Sun distance - semi major axis [m] (m=1)
  257. [Jupiter-R]         <Constant Value>        (4.0) <Astronomical Constant> Jupiter mean radius [m] (m=1)
  258. [Jupiter-M]         <Constant Value>        (4.0) <Astronomical Constant> Jupiter mass [kg] (kg=1)
  259. [Jupiter-D]         <Constant Value>        (4.0) <Astronomical Constant> Jupiter-Sun distance - semi major axis [m] (m=1)
  260. [Saturn-R]          <Constant Value>        (4.0) <Astronomical Constant> Saturn mean radius [m] (m=1)
  261. [Saturn-M]          <Constant Value>        (4.0) <Astronomical Constant> Saturn mass [kg] (kg=1)
  262. [Saturn-D]          <Constant Value>        (4.0) <Astronomical Constant> Saturn-Sun distance - semi major axis [m] (m=1)
  263. [Uranus-R]          <Constant Value>        (4.0) <Astronomical Constant> Uranus mean radius [m] (m=1)
  264. [Uranus-M]          <Constant Value>        (4.0) <Astronomical Constant> Uranus mass [kg] (kg=1)
  265. [Uranus-D]          <Constant Value>        (4.0) <Astronomical Constant> Uranus-Sun distance - semi major axis [m] (m=1)
  266. [Neptune-R]         <Constant Value>        (4.0) <Astronomical Constant> Neptune mean radius [m] (m=1)
  267. [Neptune-M]         <Constant Value>        (4.0) <Astronomical Constant> Neptune mass [kg] (kg=1)
  268. [Neptune-D]         <Constant Value>        (4.0) <Astronomical Constant> Neptune-Sun distance - semi major axis [m] (m=1)

*** If you found the software useful donation is something you might consider ๐Ÿ™‚ ***

If you found the software useful donation is something you might consider :-)

Enjoy! ๐Ÿ™‚

 

Best regards,

Mariusz Gromada

Download latest release โ€“ v.4.1.1 Aeries: bin + doc + src (.zip 13.4 MB)

Download latest release โ€“ v.4.1.1 Aeries: bin only (.zip 4.35 MB) โ€“ separate binaries for java: 1.5, 1.6, 1.7, 1.8; .NET: 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, .NET Core, .NET Standard, .NET PCL, Xamarin.Android, Xamarin.iOS

Source code .zipSource code .tar.gz View on GitHubMathSpace.pl