You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this is not enough to get SymbolicUtils to use its own algebraic simplification system on `Expr`s:
105
+
```julia:piracy3
106
+
simplify(ex)
104
107
```
108
+
\out{piracy3}
105
109
106
-
There was no simplification, because by default SymbolicUtils assumes that the expressoins are of type Any and no particular rules apply. Let's change this by saying that the symbolic type (symtype) of an Expr or Symbol object is actually Real.
110
+
The reason that the expression was not simplified is that the expression tree is untyped, so SymbolicUtils
111
+
doesn't know what rules to apply to the expression. To mimic the behaviour of most computer algebra
112
+
systems, the simplest thing to do would be to assume that all `Expr`s are of type `Number`:
107
113
108
114
```julia:piracy4
109
-
SymbolicUtils.symtype(s::Expr) = Real
115
+
SymbolicUtils.symtype(s::Expr) = Number
110
116
111
-
dump(simplify(ex))
117
+
simplify(ex)
112
118
```
113
119
\out{piracy4}
114
120
115
-
Now SymbolicUtils is able to apply the Number simplification rule to Expr.
121
+
Now SymbolicUtils is able to apply the `Number` simplification rule to `Expr`.
0 commit comments