symtegration-0.4.0: Library for symbolic integration of mathematical expressions.
CopyrightCopyright 2025 Yoo Chung
LicenseApache-2.0
Maintainerdev@chungyc.org
Safe HaskellNone
LanguageGHC2021

Symtegration.Symbolic.Simplify.Fraction

Description

 
Synopsis

Documentation

simplify :: Expression -> Expression Source #

Cancel out common numeric factors in fractions.

>>> toHaskell $ simplify $ 10 / 20
"1 / 2"
>>> toHaskell $ simplify $ Number (-15) / Number (-10)
"3 / 2"
>>> toHaskell $ simplify $ (12 * "x") / (4 * "y")
"(3 * x) / (1 * y)"
> toHaskell $ simplify $ (15 * "x" + 20 * "y") / (5 * "z" - 35 * "u")

"(3 * x + 4 * y) / (1 * z - 7 * u)"

Assumes numeric folding and algebraic ring ordering has been applied.