Custom Riemann Summ

jsebastien.turcotte shared this question 4 months ago
Needs Answer

Hi,

I'm creating a a file that has a regular partition of interval [a,b] and creates a Riemann sum for the function. I want the height of the rectangles in each subinterval to be the user's choice.

Here is how I generated the rectangles. When "custom" gets chosen by the user, the following script runs:

Execute(Sequence("Delete(x_{"k"})",k,0,99))
Execute(Sequence("Delete(y_{"k"})",k,0,99))
If(SelectedElement(Optionsh)=="Choix",{Execute(Sequence("x_{"k"}=Point(x>="x(Partition(k))"&&x<="x(Partition(k+1))")",k,1,n)),Execute(Sequence("y_{"k"}=f(x_{"k"})",k,1,n)),Execute(Sequence("Polygon("Partition(k)", ("x(Partition(k))", y_{"k"}), ("x(Partition(k + 1))", y_{"k"}), "Partition(k + 1)")", k, 1, n))})	

where Partition is a list of the regular partition points.

Now this works fine and user can move the x_k to change the height. I am however unable to compute and sum the signed areas of all those rectangles, allowing it to change if the number of rectangles (n) (needs an F9 actualisation) and /or some x_k change.

Comments (1)

photo
1

You should make the objects beforehand, and then use Condition to Show Object to make them visible when you want


https://wiki.geogebra.org/e...

© 2021 International GeoGebra Institute