| Copyright | Copyright 2024 Yoo Chung |
|---|---|
| License | Apache-2.0 |
| Maintainer | dev@chungyc.org |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Symtegration.Integration.Factor
Description
Synopsis
- factor :: Text -> Expression -> (Expression, Expression)
- isConstant :: Text -> Expression -> Bool
Documentation
Arguments
| :: Text | Symbol for the variable. |
| -> Expression | Term to separate into constant and non-constant portions. |
| -> (Expression, Expression) |
Factor a multiplicative term into a constant portion and the variable-dependent portion. E.g., \(2a x \sin x\) into \(2a\) and \(x \sin x\) when the variable is \(x\).
>>>let s (x, y) = (toHaskell $ simplify x, toHaskell $ simplify y)>>>s $ factor "x" $ 2 * ("a" * sin "x")("2 * a","sin x")>>>s $ factor "x" $ "a" / "x"("a","1 / x")
Assumes algebraic ring ordering has been applied to the term.
Arguments
| :: Text | Symbol for the variable. |
| -> Expression | Expression to check. |
| -> Bool | Whether the expression is a constant. |
Returns whether an expression contains the variable.
>>>isConstant "x" $ 1 + "x"False>>>isConstant "x" $ 1 + "a"True