I have a function defined by
$$f(t)=\int\limits_0^t g(x) dx$$
$g(x)$ is a complicated function (specifically the Mittag-Leffler function which has recently been implemented in Mathematica 9 as MittagLefflerE[a,b,t]
) and so I evaluate this integral numerically using NIntegrate
. I want to perform two tasks with this function---Plot it as a function of the limit $t$, and evaluate it's value at a number of different time instances. I have stored these values of time in a vector of the form {t1,t2,t3,...,tn}
. Mathematica's documentation suggests that to plot the function I will have to define it as
f[t_?NumericQ] := NIntegrate[g[x],{x,0,t}]
which works perfectly fine. However, I cannot use this definition of the function $f$ to now evaluate it's value at every element of my list. I assume the issue is because NIntegrate
is not listable. Is there any way I can get around this?
Attributes[f]={Listable}
might want to look into usingNDSolve
though so you in a sense only have to evaluate the integral once $\endgroup$