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)
integrate(f.subs(x,tau)*g.subs(x,t-tau), (tau,0,t))


1. I had to compute the range of integration myself (tau, 0, t).  This 
isn't a fatal problem, but piecewise doesn't have enough information to 
compute it simply.  (My long term solution is to propose a replacement for 
the piecewise function, but I'm not there yet.)

The answer is below:

Piecewise((t*exp(-b*t), Eq(a, b)), (1/(a*exp(b*t) - b*exp(b*t)) - 1/(a*exp(a*t) 
- b*exp(a*t)), True))


The answer is correct, but there are problems trying to incorporate it into 
a larger function.

2. It is not obvious in advance the answer will depend on whether a = b. 
 Is there some way to assume in advance that a=b or a!=b?

3. The second condition, True, isn't helpful.  To understand what True 
means, one has to keep track of the previous conditions.  Is there some way 
to replace the True with a != b.

4. This is a simpler question, but I can't figure it out.  How do I 
manipulate the second answer to my preferred form?

(exp(-b*t)-exp(-a*t))/(a-b)

Is there a simple way to do it programmatically?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/9d71a081-e038-4712-93de-aca17f951e15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to