Skip to content

Commit f71d509

Browse files
Complete rules for simplification upon construction
1 parent 0cae526 commit f71d509

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

page/index.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,22 @@ SymbolicUtils contains [a rule-based rewriting language](/rewrite/#rule-based_re
149149

150150
## Simplification
151151

152-
By default `*` and `+` operations apply the most basic simplification upon construction of the expression.
152+
By default `+`, `*` and `^` operations apply the most basic simplification upon construction of the expression.
153153

154154
The rules with which the canonical form of `Symbolic{<:Number}` terms are constructed are the next (where `x isa Symbolic` and `c isa Number`)
155155

156-
- `0 + x` and `1 * x` always gives `x`
157-
- `0 * x` always gives `0`,
156+
- `0 + x`, `1 * x` and `x^1` always gives `x`
157+
- `0 * x` always gives `0` and `x ^ 0` gives `1`
158+
- `-x`, `1/x` and `x\1` get transformed into `(-1)*x`, `x^(-1)` and `x^(-1)`.
158159
- commutativity and associativity over `+` and `*` are assumed. Re-ordering of terms will be done under a [total order](https://github.com/JuliaSymbolics/SymbolicUtils.jl/blob/master/src/ordering.jl)
159-
- sum of `Add`'s are fused
160-
- product of `Mul`'s are fused
161160
- `x + ... + x` will be fused into `n*x` with type `Mul`
162161
- `x * ... * x` will be fused into `x^n` with type `Pow`
162+
- sum of `Add`'s are fused
163+
- product of `Mul`'s are fused
163164
- `c * (c₁x₁ + ... + cₙxₙ)` will be converted into `c*c₁*x₁ + ... + c*cₙ*xₙ`
164-
- `(x₁^c₁ + ... + xₙ^cₙ)^c` will be converted into `x₁^(c*c₁) + ... + xₙ^(c*cₙ)`
165-
- any other combinations of expressions will be left the same
165+
- `(x₁^c₁ * ... * xₙ^cₙ)^c` will be converted into `x₁^(c*c₁) * ... * xₙ^(c*cₙ)`
166+
- there are come other simplifications on construction that you can check [here](https://github.com/JuliaSymbolics/SymbolicUtils.jl/blob/master/src/methods.jl)
167+
166168

167169
Here is an example of this
168170

0 commit comments

Comments
 (0)