I guess that you are aware that you can compute the integral analytically, so the first numerical method would be a difference of function evaluations at the endpoints.
Apart from that:
If you want to do it in a purely numerical way, you might want to start with a composite trapezoidal integration just for a start to get a feeling what numerical integration is about.
You can also try higher Newton-Côtes formulas to see what differences in error order mean, and the Newton-Côtes formulae are still easy to implement.
As the final method, you should use Gauß-Laguerre integration, since it will compute the exact result of your integral, already with a 1st order formula.
Yes. You can integrate it using numerical methods such as simpon's, and trapeziodal rule. These are the basic methods used for integrating of a function. These methods give so accurate results, if the interval is chosen adequately small.
To add to Hermann's otherwise perfect answer: of course, Simpson's rule will work also. Only specific requirements on computational efficiency may force you to switch to more sophisticated methods.
PS: just noted that Michael said this already, sorry.
Yes. You can integrate it using numerical methods.But if the time interval is adequate small you can obtain good solution. Also if you want you can use matlab code program.
Thanks for your excellent suggestion. As I'm the learner of MATLAB can you please send any example code to solve the time-dependent function as like the above?
Though, the trapezoidal and Simpson's rules could be used they may not give precise results. The preferred and most accurate integration technique is a Gauss quadrature method consisting of Gauss-Legendre, Gauss-Chebychev, Gausss-Laguerre. Gauss-Hermite and Gauss-Jacobi methods.
However, the Gauss-Legendre quadrature can be universally applied in all circumstances.
The Gauss quadrature method numerically computes the integral of f(x) over the interval x = a to x = b as
Integral = 0.5*h*sum of [ Wi * f (xi) ]
where the sum is done for i = 1 to np (np = no of integration points). h = b - a, Wi = weight for integration point xi and xi = 0.5*(a+b) + 0.5*h*pi, with pi being an integration point value lying between -1 and 1. The values of Wi and Pi depend on the number of integration points np.
However, when np is small straight forward application of the Gauss quadrature may also give inaccurate results depending on the value of h = b -a. In that case, it will be adisable to divide the integration range into a number (num) of smaller intervals in each of which Gauss quadrature is applied and the results summed. Without beating about the bush, below is presented a Fortran 90 program for implementing this multiple-interval Gauss quadrature for np = 4.
The user can modify the value of num until the integral ceases to change.
PROGRAM GAUSS_QUADRATURE
IMPLICIT NONE
REAL*8 w(20), p(20), Integral, h, mean, a, b, func, t
INTEGER np, num, i, j
np = 4
WRITE(*, *)" give the values of num, a, b with spaces but without commas"
READ (*, *) num, a, b
! num = number of intervals in the range a to b
! a = lower integration limit, b = upper integration limit