1
$\begingroup$

I'm pretty new here, I'm trying to make a animation of integration in Wolfram Mathematica, but it's getting me a headache I really don't know how to do this.

The point is to ilustrate the process of integration, in one side to use sum by parts (on with the lower heigh and the other with the higher heigh) in some continuos part, so far I was trying to use DiscretePlot, but I wasn't ablee to go far

The objective is to look something like the images, but that exemplifies well the process of integration

$\endgroup$
1
  • $\begingroup$ Welcome to MSE. Hard to help you because you have not described what exactly you are trying to animate. Please post the code you have tried (as text that can be copied/pasted, not an image). $\endgroup$ Commented Apr 23, 2021 at 19:29

1 Answer 1

2
$\begingroup$

With

f[x_] = 2 + Cos[x];
step = 3 Pi/20;
fleft[x_] = f[step Floor[x/step]]; 
fright[x_] = f[step Ceiling[x/step]]; 

We may plot:

Plot[{f[x], fleft[x], fright[x]}, {x, 0, 3 Pi}, 
 PlotStyle -> {Red, Black, Green}, Filling -> {2 -> {{3}, Yellow}}]

enter image description here

or:

enter image description here

Or do you prefer:

Plot[{f[x], fright[x]}, {x, 0, 3 Pi}, Filling -> Bottom, 
 Exclusions -> None]
Plot[{f[x], fleft[x]}, {x, 0, 3 Pi}, Filling -> Bottom, 
 Exclusions -> None]

![enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks a lot for the answear! I swear to god, this was killing me inside $\endgroup$
    – Trashlife
    Commented Apr 23, 2021 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.