Copyright | Copyright 2025 Yoo Chung |
---|---|
License | Apache-2.0 |
Maintainer | dev@chungyc.org |
Safe Haskell | None |
Language | GHC2021 |
This module supports deriving exact solutions to polynomial equations. It cannot derive solutions for all polynomials; it will only return those which it can.
Synopsis
- solve :: IndexedPolynomial -> Maybe [Expression]
Documentation
solve :: IndexedPolynomial -> Maybe [Expression] Source #
Derive the roots for the given polynomial. Only real roots are returned.
>>>
map (toHaskell . simplify) <$> solve (2 * power 1 - 6)
Just ["3"]
>>>
map (toHaskell . simplify) <$> solve (power 2 - 4)
Just ["2","-2"]
Returns Nothing
if the function does not know how to derive the roots.