equations 6.0.0 copy "equations: ^6.0.0" to clipboard
equations: ^6.0.0 copied to clipboard

An equation-solving library that supports complex numbers.

example/README.md

Examples #

Here is a quick overview of the main features of the equations package. For more information about solving equations and examples on how to use the classes from this package, see the articles on the repository's Wiki pages:

Algebraic (Polynomial) equations #

// f(x) = ix^3 + (-2 + 5i)x + 7
final equation = Cubic(
  a: const Complex.i(),
  c: const Complex(-2, 5),
  d: const Complex.fromReal(7),
);
final solutions = equation.solutions();

/// -1.0447245173314328 + 1.7792977920746025i 
/// 0.3113353509227148 - 2.7574534545940717i
/// 0.733389166408717 + 0.9781556625194701i
print(solutions);

Nonlinear equations #

// f(x) = x^e - cos(x)
final newtonRaphson = Newton(function: 'x^e-cos(x)', x0: 0.5)
final result = newtonRaphson.solve();

// 0.856055...
print(result.guesses.last);

Systems of equations #

// [1.0, 0.0, 1.0 | 6.0]
// [0.0, 2.0, 0.0 | 5.0]
// [1.0, 0.0, 3.0 | -2.0]
final solver = LUSolver(
  matrix: RealMatrix.fromData(
    rows: 3,
    columns: 3,
    data: const [
      [1, 0, 1],
      [0, 2, 0],
      [1, 0, 3],
    ],
  ),
  knownValues: [6, 5, -2],
);
final solutions = solver.solve();

// 10.0
// 2.5
// -4.0
print(solutions);
85
likes
160
points
1.47k
downloads

Publisher

verified publisherfluttercompletereference.com

Weekly Downloads

An equation-solving library that supports complex numbers.

Homepage
Repository (GitHub)
View/report issues

Topics

#equations #numbers #algebra

Documentation

API reference

License

MIT (license)

Dependencies

fraction, petitparser

More

Packages that depend on equations