I am doing a project with a lot of symbolic integration.
Functions are something like an erlang probability distribution function.
Here is a simple example of a task.
https://s18.postimg.org/gd7t4bv95/gif_latex.gif
Here is the code for the task above:
import sympy as sym
t=sym.Symbol('t')
t1=sym.Symbol('t1')
t2=sym.Symbol('t2')
expr=( 1-sym.exp(-(t-t2)) )*( 1-sym.exp(-(t-t2)) )*sym.exp(-t2)
expr=sym.integrate(expr,(t2,0,t))
expr=expr.subs(t,t-t1) * (1-sym.exp(-(t-t1)))*sym.exp(-t1)
expr=sym.integrate(expr,(t1,0,t))
Here is a slightly complicated result:
https://s11.postimg.org/x9tw8kw8j/untitle.png
So, for sympy implementation, I use integrate () and subs () most of the time.
However, the speed is very slow. When I have 5 variables (e.g. from t_1 to t_5), I need to wait a bit. But when I have 10 variables, I can not finish the calculation.
The code is pretty complicated, but I'm sure integration is the bottleneck. In the end, from the sampling result, one can imagine how to require the completion of a task.
sympy? ,