Category Archives: Calculus

mXparser - user defined functions applied to Fundamental theorem of calculus

Fundamental Theorem of Calculus is a kind of a link between two most important calculus concepts: derivative and integral.

Fundamental Theorem of Calculus - formal statement

For continuous real-valued function defined on closed interval let  be the function given by

The is uniformly continuous on , differentiable on the open interval , and

Fundamental Theorem of Calculus - mXparser test

import org.mariuszgromada.math.mxparser.*;
...
/* Function */
Function f = new Function("f(x) = sin(x)");
		
/* Antiderivative */
Function F = new Function("F(x) = int(f(t), t, 0, x)", f);
		
/* function = derivative ( antiderivative ) */
Argument x = new Argument("x = pi");
Expression e = new Expression("f(x) - der(F(x), x)", x, f, F);
mXparser.consolePrintln("Res : " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Computing time = " + e.getComputingTime() + " s.");
Res : f(x) - der(F(x), x) = 6.237833817291525E-8
Computing time = 0.411 s.

Best regards,
Mariusz Gromada