# How to convolve a Unit function (like “UnitTriangle”) with a InterpolatedFunction

Recently discovered what InterpolatingFunction's are in Mathematica...really amazing/useful. As I understand it, it's basically a curve fitter....sorta.

So how would I use Convolve with a unit triangle or some other analytical-esque function, to convolve over a InterpolatingFunction??

In the image, the red triangle is UnitTriangle[x] (well, it's height and width are off, but you get the gist of it). So ideallly, I'd like to do something like Convolve[ UnitTriangle[x], InterpolatedFunction, ?, ?]

But that won't work of course, since I don't know what the domains are (hence the ? ?) for the interpolated function.

-
I think Convolve works only symbolically. You might have to use NIntegrate to do the convolution integral directly. – Michael E2 Mar 15 '14 at 22:41
Yes, as Michael said you need to integrate numerically. Not only does Convolve require symbolic input, it also integrates over the whole real line, which won't work for an interpolating function with a restricted domain. – Szabolcs Mar 15 '14 at 23:12
Hmm. Well, if you use NIntegrate you just get a number out right? Is there a way, for example, to use NIntegreate to get the same graph output, as this would do --> Convolve[UnitBox[x], UnitBox[x], x, t] Really I just need the graph output of what the convolution of the unit triangle with an interpolation function would look like. – Christopher Brittain Mar 16 '14 at 5:28
If you specifically want to use Convolve, you have to construct a different kind of interpolation function to work with. For instance, you can use Piecewise, InterpolatingPolynomial or construct the function using your own basis functions. I must say I'm a bit saddened by the fact Interpolation, BezierFunction and BSPlineFunction don't produce suitable output, but instead you have to trouble yourself to get all this done. – kirma Mar 16 '14 at 9:51

There is nothing to stop you from using NIntegrate with a parameter and have it evaluated for a given value of that parameter, e.g.
Plot[ NIntegrate[ f[x] UnitTriangle[ x - x0], {x, 1, 6}], {x0, 1, 6}]

 Plot[ NIntegrate[ f[x] UnitTriangle[ x - x0], {x, 1, 6}, Method -> {Automatic, "SymbolicProcessing" -> 0}], {x0, 1, 6}]