# Numerical integration of two variable function

The aim is to calculate the definite integral of the function $f$ of the form $$f(x,t) \;\;\;\; x \in [0, \infty ) \;\;, \;\;t \in [t_0,T]$$ numerically. For example consider the function below $$f = e^{-xt}$$

For each $t_i$ belongs to interval $[t_0, T]$, there is an integral like this:

$$\int_{0}^{\infty} f(x, t) dx \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(*)$$

If the interval of $[t_0,T]$ divided to $n$ equal part, then we have $n$ integral of the form $(*)$ where $t_i$ is the lower bound of each interval. Also I'm willing to plot the result of $n$ integration.

In MATLAB it's easy to code the above integral; by defining a for loop, one can deal with sweeping t over interval $[t_0,T]$.

          for t = t0 : 0.01 : T
fun = @(x) f(x, t);
q = integral(fun,0,Inf);
end


I familiar with the command "Integrate" (in Mathematica) but I can't sweep t over interval.

How can I do this?

f[x_, t_] := E^(-x t);

Because this is a numerical integration, you need to define t0 and T before integration. Otherwise you can replace NIntegrate with Integrate and that should be fine.