NumPy and SciPy, in pure Dart
Scientific computing for Dart and Flutter
Arrays, linear algebra, polynomial fits, FFT, filters, statistics, distributions and root finding. One package that runs on the Dart VM, in Flutter apps and on the web.
dart pub add scidart Dart VM · Flutter (Android, iOS, macOS, Windows, Linux) · Web

Try it here
The library runs in this page
This demo calls scidart compiled to JavaScript, the same code a Flutter web app ships. Change the tones and the window, and the FFT and the parabolic peak estimate update.
Loading the interactive demo…
Example
Familiar if you know SciPy
Every example on this site runs against the released library when the site is built. The output you see is real.
import 'dart:math' as math;
import 'package:scidart/numdart.dart';
import 'package:scidart/scidart.dart';
void main() {
// adult height in cm
var height = NormalDistribution(mean: 170, std: 8);
print('density at 170: ${height.pdf(170)}');
print('P(height < 180): ${height.cdf(180)}');
print('P(height > 190): ${height.sf(190)}');
print('95th percentile: ${height.ppf(0.95)}');
print('central 95%: ${height.interval(0.95).toList()}');
var s = height.sample(10000, random: math.Random(42));
print(
'sample mean: ${mean(s).toStringAsFixed(2)}, std: ${standardDeviation(s).toStringAsFixed(2)}');
}
Output
density at 170: 0.04986778505017909 P(height < 180): 0.8943502263331448 P(height > 190): 0.0062096653257761375 95th percentile: 183.1588290156118 central 95%: [154.32028812367957, 185.67971187632043] sample mean: 169.93, std: 7.92
Modules
What is inside
NumDart package:scidart/numdart.dart
- ArraysArray, Array2d and ArrayComplex, element-wise math and evenly spaced samples.
- Linear algebraSolve linear systems, invert matrices and use the QR, LU and SVD decompositions.
- Polynomial fittingLeast squares polynomial fits with one input (PolyFit) or several inputs and outputs (PolyFitMultivariate).
- StatisticsMean, median, mode, variance and standard deviation of a sample.
- CalculusNumerical integration with the trapezoidal and Simpson rules, cumulative integrals and derivatives.
- InterpolationParabolic interpolation to find a peak between samples.
- Complex numbersThe Complex type and its operations.
- Random arraysUniform random arrays for tests and simulations.
- ConstantsMathematical and physical constants and unit conversion factors.
SciDart package:scidart/scidart.dart
- Fourier transformFFT, inverse FFT, real FFT, frequency bins and spectra in dB.
- Signal processingFIR filter design, filtering, peaks, window functions and convolution.
- Special functionsError functions and the modified Bessel function of order zero.
- Normal distributionDensity, cumulative probability, quantiles, intervals and random samples of a normal distribution.
- Root findingRoots of scalar functions and of systems of nonlinear equations.
Latest release
scidart 0.1.1
Fixes
- randomArray2d(rows, columns) returns rows rows of columns values; it had rows and columns swapped
- fft with n larger than the input appends the zeros at the end, like numpy.fft.fft; they were added at the start, which changed the phase of the result. rfft gets the same fix
- toString of Array and Complex no longer starts with a line break, as their documentation shows. ArrayComplex prints on one line, and Array2d and Array3d print one row per line without trailing spaces
Docs
- API documentation builds without warnings (unresolved references in doc comments)
- The scidart.org site is rebuilt after each release