Re: [sympy] Issues with integrate and piecewise functions

2017-06-22 Thread Chris Smith
Here is an example from the `lts` branch computing the product of two functions that have different ranges in each: >>> p = Piecewise((a,abs(x-1)<1),(b,abs(x-2)<2),(c,True))*Piecewise((d,x>1 ),(e,True)) >>> piecewise_fold(p) Piecewise( (a*d, (x > 1) & (x < 2)), (b*d, (x > 1) & (x < 4)),

Re: [sympy] Issues with integrate and piecewise functions

2017-06-11 Thread boncelet
On Wednesday, June 7, 2017 at 5:49:34 PM UTC-4, Aaron Meurer wrote: > > > > > > > My thoughts on Piecewise is that it's trying to do too many things. > There's > > a difference between representing a function whose form changes > depending on > > the value of its argument (in my case, t) an

Re: [sympy] Issues with integrate and piecewise functions

2017-06-07 Thread Aaron Meurer
On Wed, Jun 7, 2017 at 3:12 PM, wrote: > BTW, when I'm demonstrating sympy to people, I show them we can test our > preferred form for equality. (Sympy is handy for verifying hand > calculations or standard formulas found in books.) > > h = integrate(f.subs(x,tau)*g.subs(x,t-tau), (tau,0,t)) > s

Re: [sympy] Issues with integrate and piecewise functions

2017-06-07 Thread boncelet
BTW, when I'm demonstrating sympy to people, I show them we can test our preferred form for equality. (Sympy is handy for verifying hand calculations or standard formulas found in books.) h = integrate(f.subs(x,tau)*g.subs(x,t-tau), (tau,0,t)) simplify(h.args[1][0] - (exp(-b*t)-exp(-a*t))/(a-b)

Re: [sympy] Issues with integrate and piecewise functions

2017-06-07 Thread Aaron Meurer
On Wed, Jun 7, 2017 at 11:35 AM, wrote: > I'm trying to write a generic function to convolve two functions (in one > dimension, for now) and came across a few issues I don't know how to solve. > Rather than give up, maybe I can start a discussion. Some Sympy follows: > > a , b = symbols('a b', p

[sympy] Issues with integrate and piecewise functions

2017-06-07 Thread boncelet
I'm trying to write a generic function to convolve two functions (in one dimension, for now) and came across a few issues I don't know how to solve. Rather than give up, maybe I can start a discussion. Some Sympy follows: a , b = symbols('a b', positive=True) f = exp(-a*x) g = exp(-b*x) integr