Usually, yes, calculus required, unless you can turn it into a reimann integral approximation. Which is usually how integration is conceptually taught.
The tl;dr is make boxes with the box height equal to the function value at that point, subdivide the interval into boxes small enough that your answer has sufficient precision (but not so small as to introduce numerical errors from floating point operations), sum up the area of all the boxes.
If either end of the interval is infinity or there's a big ol' asymtote or discontinuity, calculus is required.
So say you've got f(x)=x2 and you want to calculate the integral from 0,10 of f(x).
double integr = 0;
double box_width = 0.01;
for (double x=0; x < 10.0; x += box_width) {
integr += x*x // x^2 part
* box_width; // integration part
For larger dimensions (eg 2D, 3D, nD integrals) people use the infamous Monte Carlo method. One example of a multidimensional integral is the light transport equation in path tracing.
Usually, yes, calculus required, unless you can turn it into a reimann integral approximation. Which is usually how integration is conceptually taught.
Integrals are defined in terms of the Riemann integral, so you don't "turn it into a Riemann approximation", you simply stop the process at a finite number of partitions.
If you look at the context, we are discussing numerical approaches to calculus. I don't think Lebesgue integration etc. is particularly relevant here, and I thought it was a waste of time saying "Riemann integration is defined in terms of the Riemann integral".
You typically wouldn't try to numerically an integral over the entire real line, you would make a substitution so that you are working over a finite length interval, e.g. [-1,1] (such as in Gauss quadrature). You could even use Gauss-Hermite quadrature if you couldn't be bothered to adjust an integral on the entire real line.
My point is that numerical calculation of a Lebesgue integral is not easy, and adding in these extra details is only going to confuse the other commenter. They likely know "integral" as a Riemann integral only, and I don't want to have to sit here and teach a course in Measure Theory just for a reddit comment.
Which is why I half-jokingly say that integration is a limit of infinity times zero (infinite many small partitions) while derivative is limit of zero divided by zero (slope of two points coming together).
do the numbers in the problem change? if yes, then you should use a numerical method. most programming languages have packages that can approximate integrals for you. if it doesn't change, then you should solve it using calculus to save computation time.
9
u/Mikeyboi337 Oct 06 '21
How do you do integrations? I see a lot of papers requiring integrations do you actually have to do the calculus for it?