Skip to content

Commit 5eb3752

Browse files
MasonProttershashi
authored andcommitted
add example to readme
1 parent 0977ebb commit 5eb3752

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,31 @@ SymbolicUtils.jl provides various utilities for symbolic computing.
1616

1717
[Symbols in SymbolicUtils](https://juliasymbolics.github.io/SymbolicUtils.jl/#creating_symbolic_expressions) carry type information. Operations on them propagate this information. [A rule-based rewriting language](https://juliasymbolics.github.io/SymbolicUtils.jl/#rule-based_rewriting) can be used to find subexpressions that satisfy arbitrary conditions and apply arbitrary transformations on the matches. The library also contains a set of useful [simplification](https://juliasymbolics.github.io/SymbolicUtils.jl/#simplification) rules for expressions of numeric symbols and numbers. These can be remixed and extended for special purposes.
1818

19+
1920
If you are a Julia package develper in need of a rule rewriting system for your own types, have a look at the [interfacing guide](https://juliasymbolics.github.io/SymbolicUtils.jl/interface/).
2021

2122
[**Go to the manual**](https://juliasymbolics.github.io/SymbolicUtils.jl/)
2223

24+
## "I don't want to read your manual, just show me some cool code"
25+
```julia
26+
julia> using SymbolicUtils
27+
28+
julia> @syms x::Real y::Real z::Complex
29+
(x, y, z)
30+
31+
julia> 2x^2 - y + x^2
32+
(3 * (x ^ 2)) + (-1 * y)
33+
34+
julia> r = @rule sinh(im * ~x) => sin(~x)
35+
sinh(im * ~x) => sin(~x)
36+
37+
julia> r(sinh(im * y))
38+
sin(y)
39+
40+
julia> simplify(cos(y)^2 + sinh(im*y)^2, [r])
41+
1
42+
```
43+
2344
# Citations
2445

2546
- The pattern matcher is an adaption of the one by Gerald Jay Sussman (as seen in [6.945](https://groups.csail.mit.edu/mac/users/gjs/6.945/) at MIT), his use of symbolic programming in the book [SICM](https://groups.csail.mit.edu/mac/users/gjs/6946/sicm-html/book.html) inspired this package.

0 commit comments

Comments
 (0)