This is how you can compute the integral symbolically using SymPy:
In [53]: C_i = Function('C_i')
In [54]: t, t0, x, v = symbols('t, t0, x, v', positive=True)
In [55]: g = lambda x, t: DiracDelta(x/v - t + t0)
In [56]: C_f = Integral(C_i(t0)*g(x,t-t0), (t0, 0, t))
In [57]: C_f
Out[57]:
t
⌠
⎮ ⎛ x⎞
⎮ Cᵢ(t₀)⋅δ⎜-t + 2⋅t₀ + ─⎟ d(t₀)
⎮ ⎝ v⎠
⌡
0
In [58]: C_f.doit()
Out[58]:
⎛t⋅v - x⎞ ⎛-(t⋅v - x) ⎞ ⎛t⋅v - x⎞ ⎛ t⋅v - x⎞
Cᵢ⎜───────⎟⋅θ⎜───────────⎟ Cᵢ⎜───────⎟⋅θ⎜t - ───────⎟
⎝ 2⋅v ⎠ ⎝ 2⋅v ⎠ ⎝ 2⋅v ⎠ ⎝ 2⋅v ⎠
- ────────────────────────── + ──────────────────────────
2 2
In [59]: C_f.doit().simplify()
Out[59]:
⎛ ⎛-t⋅v + x⎞⎞ ⎛t⋅v - x⎞
⎜1 - θ⎜────────⎟⎟⋅Cᵢ⎜───────⎟
⎝ ⎝ 2⋅v ⎠⎠ ⎝ 2⋅v ⎠
─────────────────────────────
2
The theta here is the Heaviside function. Now you just need to evaluate that integral numerically which you can do with lambdify
:
In [73]: C_fs = C_f.doit().simplify()
In [74]: f = lambdify((x, v, t), C_fs, ['scipy', {'C_i': lambda e: 0.5}])
In [75]: f(10, 0.1, t_arr)
Out[75]:
array([0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
0. , 0.125, 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 ,
0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 ,
0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 ,
0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 , 0.25 ,
...
If you have an array of values for C_i
then you can just use interpolate to turn that into a callable function.