Fast (limited) user defined recursion

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: Fibonacci numbers using fast recursion

import org.mariuszgromada.math.mxparser.*;
...
RecursiveArgument fib = new RecursiveArgument("fib(n) = fib(n-1) + fib(n-2)");
fib.addBaseCase(0, 0);
fib.addBaseCase(1, 1);
Expression e = new Expression("fib(10)", fib);
         
mXparser.consolePrintln("Res 1: " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Res 2: fib(11) = " + fib.getArgumentValue(11));
[mXparser-v.5.0.0] Res 1: fib(10) = 55.0
[mXparser-v.5.0.0] Res 2: fib(11) = 89.0

Case 2: Fibonacci numbers using fast recursion – less convenient, but faster constructor

RecursiveArgument fib = new RecursiveArgument("fib", "fib(n-1) + fib(n-2)", "n");
fib.addBaseCase(0, 0);
fib.addBaseCase(1, 1);
Expression e = new Expression("fib(10)", fib);

mXparser.consolePrintln("Res 1: " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Res 2: fib(11) = " + fib.getArgumentValue(11));
[mXparser-v.5.0.0] Res 1: fib(10) = 55.0
[mXparser-v.5.0.0] Res 2: fib(11) = 89.0
Nuget – Package Manager

Install-Package MathParser.org-mXparser -Version 5.0.7

Nuget – .NET CLI

dotnet add package MathParser.org-mXparser --version 5.0.7

Nuget – Package Reference

<PackageReference Include="MathParser.org-mXparser" Version="5.0.7"/>

Maven – Dependency

<dependency>
<groupid>
org.mariuszgromada.math</groupid>
<artifactid>
MathParser.org-mXparser</artifactid>
<version>
5.0.7</version>
</dependency>

Maven – Gradle

implementation 'org.mariuszgromada.math:MathParser.org-mXparser:5.0.7'

Maven – Gradle (Kotlin)

implementation("org.mariuszgromada.math:MathParser.org-mXparser:5.0.7")

GitHub

git clone https://github.com/mariuszgromada/MathParser.org-mXparser

OTHER DOWNLOAD OPTIONS

Download latest release – v.5.0.7 Leonis: .NET bin onlyDownload latest release – v.5.0.7 Leonis: JAVA bin onlyDownload latest release – v.5.0.7 Leonis: bin + doc

NEWS FROM MATHPARSER.ORG
SOURCE CODE

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

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