Skip to main content

Crate algebra_basics_rs

Crate algebra_basics_rs 

Source
Expand description

Basic math formulas for quadratic equations and 2x2 matrices.

This crate currently supports:

  • quadratic equation solving (ax^2 + bx + c = 0)
  • 2x2 matrix determinant
  • other common 2x2 matrix operations: trace, transpose, inverse
  • solving a 2x2 linear system using Cramer’s rule

Enums§

MathError
Errors returned by math operations in this crate.
QuadraticRoots
The root structure returned by solve_quadratic.

Functions§

determinant_2x2
Computes the determinant of a 2x2 matrix.
discriminant
Computes the discriminant of a quadratic equation: b^2 - 4ac.
inverse_2x2
Computes the inverse of a 2x2 matrix.
solve_linear_2x2
Solves a 2x2 linear system A * x = b using Cramer’s rule.
solve_quadratic
Solves the quadratic equation ax^2 + bx + c = 0.
trace_2x2
Computes the trace of a 2x2 matrix (a + d).
transpose_2x2
Computes the transpose of a 2x2 matrix.

Type Aliases§

Matrix2x2
A 2x2 matrix represented as: [[a, b], [c, d]]