Comments (4)
Another thing I think we should support is nested rule application. e.g.
@rule(sin(+(~~x))
=> sin(@acrule(~y::multiple_of(2π)
=> zero(~y))(+(~~x...))))
This basically says that there is a rule (you can drop multiples of 2π
from sums) which only applies inside the body of a trig function. Currently this is an error:
julia> @rule sin(+(~~x)) => sin(@acrule(~y::multiple_of(2π) => zero(~y))(+(~~x...)))
ERROR: LoadError: syntax: invalid syntax (escape (outerref @acrule))
Stacktrace:
[1] top-level scope at REPL[13]:1
in expression starting at <macrocall>:0
from symbolicutils.jl.
Interesting case! Seems like it's only needed because +
is ac but sin
is not... otherwise you could write @acrule sin(+(~y::multiple_of(pi), ...etc...))
.
from symbolicutils.jl.
Okay, turns out this works if you just separate out the rules:
using SymbolicUtils
@vars x y a::Integer
r = let
r_inner = RuleSet([@acrule ~y::multiple_of(2π) => zero(~y)])
@rule sin(+(~~x)) => sin(r_inner(+(~~x...)))
end
julia> r(sin(x + 2π*a + y))
(sin(x + y))
from symbolicutils.jl.
I'm closing this because I think we have the most important items here, let's open new issues as need arises.
The Segment optimizations are not very useful anymore since we do most of those complex rules using @acrule
.
from symbolicutils.jl.
Related Issues (20)
- Semantics of `==` not good for generic programming HOT 7
- Add Text Name Symbol
- Conversion from `LiteralReal` to `Real` HOT 1
- Stack overflow in custom interface
- Use genetic algorithm to avoid state explosion HOT 1
- Inf becomes -Inf in rational simplifier sometimes
- Generated functions no longer re-tracable with Symbolics HOT 4
- Issue with creating rule for even and odd function of cos and sin HOT 2
- Metadata is lost on construction of Mul HOT 1
- SciML documentation has broken links
- typos
- method ambiguity for exponentiation of `Complex{Num}` HOT 1
- Q: SymbolicUtils.PolyForm() -> StaticPolynomials.Polynomial(). Variable order at evaluation? HOT 1
- Incorrect broadcast semantics for symbolic arrays
- SymbolicUtils seems broken on Julia 1.6 HOT 1
- Setting up coverage in JuliaSymbolics repos. HOT 1
- CSE does not perform nested nested eliminations of repeated expressions
- simplify fails on "-sin(x)^2 - cos(x)^2"
- Typo on https://symbolicutils.juliasymbolics.org/ HOT 1
- `@acrule` only uses associativity-commutativity on the top-level operand
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symbolicutils.jl.