0 purchases
calculess
Calculess.dart #
A Dart port for calculus library in dart and NPM. Originally Created by Blake Sanie.
Getting Started #
Import and initialize package
import 'package:calculess/calculess.dart';
copied to clipboard
Documentation #
Limits #
Evaluate a limit
Calc.limAt( x , function );
copied to clipboard
Evaluate a limit from the left
Calc.limLeftOf( x , function );
copied to clipboard
Evaluate a limit from the right
Calc.limRightOf( x , function );
copied to clipboard
Methods: #
Accept ±Infinity as x value (parameter)
Can output ±Infinity
Output double.nan when the limit does not exist
Examples: #
recip(x) => 1 / x;
Calc.limLeftOf(0, recip); // -double.infinity
Calc.limRightOf(0, recip); // double.infinity
Calc.limAt(0, recip); // double.nan
Calc.limAt(1, recip); // 1
copied to clipboard
Derivatives #
Evaluate f'(x)
Note: If the given function is not continuous or differentiable at the target, double.nan is returned
Calc.deriv( x , function );
copied to clipboard
Evaluate a derivative to the nth degree of x
Note: as the degree increases, .nthDeriv() becomes less accurate. Also, continuity and differentiability are not checked.
Calc.nthDeriv( degree, x , function );
copied to clipboard
Examples: #
num para(x) => x * x;
Calc.deriv(2, para); // 4
Calc.nthDeriv(2, 2, para); // 2
Calc.nthDeriv(3, 2, para); // 0
num sharp(num x) => x.abs();
Calc.deriv(1, sharp); // 1
Calc.nthDeriv(2, 1, para); // 0
Calc.deriv(0, sharp); // double.nan
copied to clipboard
Integrals #
Evaluate an integral using midpoint Riemann Sums
Calc.integral( start , end , function , numSubintervals );
copied to clipboard
Evaluate a function's average value
Calc.averageValue( start , end , function , numSubintervals );
copied to clipboard
Note: As the number of subintervals increases, .intregral() becomes more accurate, though more time is required for calculations
Examples
import 'dart:math' as math;
double sin(x) => math.sin(x);
Calc.integral(0, Math.PI, sin, 10); // 2.0082484079079745
Calc.integral(0, Math.PI, sin, 100); // 2.000082249070989
Calc.integral(0, Math.PI, sin, 1000); // 2.000000822467294
Calc.integral(0, Math.PI, sin, 10000); // 2.000000008224376
Calc.integral(0, Math.PI, sin, 100000); // 2.000000000081865
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.