Copyright | Copyright 2025 Yoo Chung |
---|---|
License | Apache-2.0 |
Maintainer | dev@chungyc.org |
Safe Haskell | None |
Language | GHC2021 |
Synopsis
- integrate :: [Text -> Expression -> Maybe Expression] -> Text -> Expression -> Maybe Expression
Documentation
:: [Text -> Expression -> Maybe Expression] | Integration algorithms to try on the parts. |
-> Text | Symbol for the variable. |
-> Expression | Expression to integrate. |
-> Maybe Expression | Integral, if derived. |
Integrates by parts.
Specifically, if for
\[ \int f g \, dx \]
it is the case that we can find \(F = \int f \, dx\) and \(\int F \frac{dg}{dx} \, dx\), then we can derive the integral as
\[ \int f g \, dx = F g - \int F \frac{dg}{dx} \, dx \]
>>>
let directMethods = [Powers.integrate, Trigonometric.integrate]
>>>
toHaskell . simplify <$> integrate directMethods "x" ("x" * cos "x")
Just "x * sin x + cos x"