Replies: 1 comment 1 reply
-
The last idea (interleave differentiation and simplification) was something I had started in a big branch in which I had added more discipline to the expression type, which I was going to use as a launchpad for doing some of the type changes you approached from a different (and better) direction. My plan, at the time, described vaguely, was to have the simplifier pump work on Expression objects, rather than naked S-expressions. Expression objects would carry a We have a much better type system now, so we could revisit something like this as I think it's a bit more general. The final results ought to be the same, but some of the work could be more efficiently amortized vs having only one hammer that we use over and over at every level. The analyzer and polynomial codes would have to refactor pretty hard to get this done, however. But like you, I have seen this problem before: an easy way to observe it is to ask for lots of terms of a Taylor series. You can get about 10 (which is surely enough to please the ghost of Newton), but if simplification were amortized, it should be closer to equal time for every step (perhaps modulo the logarithmically growing effort of doing the bignum arithmetic) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@littleredcomputer , here's a test of github discussions.
I was thinking about this little animation library I started building a while back: https://github.com/sicmutils/maturin, and how when I made it up to a quadruple pendulum I started seeing the simplifier bog WAY down. I'm sure that there are tons of repeated subexpressions in the symbolic derivative.
Currently, in
sicmutils.expression.compile
, we simplify our expression BEFORE we do common subexpression elimination: https://github.com/sicmutils/sicmutils/blob/master/src/sicmutils/expression/compile.cljc#L470-L471I wonder what gains we'd get if we added a new simplification fixed-point:
What do you think? Have you seen this anywhere?
Another idea is to take forward (or reverse) mode AD, and interleave simplification steps AS the derivative is getting generated in the first place.
Beta Was this translation helpful? Give feedback.
All reactions