0

I want to plot the middle Riemann sum of half a circle from the interval -1 to 1. Half the circle is:

Sqrt[1 - x^2]

Currently I'm getting the right Riemann sum by getting the x axis, and y axis and then getting a table for the rectangles.

rectangles[x_, y_] := 
Table[Rectangle[{x[[i]], 0.}, {x[[i + 1]], y[[i]]}], {i,Length[x] - 1}]

I then show the plot

Show[{Plot[y, {x, -1, 1}], 
Graphics[{Opacity[0.3], Pink, EdgeForm[Thin],rectangles[xaxis,       
yaxis]}]}]

and get the sum:

area = Sum[(xaxis[[i + 1]] - xaxis[[i]]) yaxis[[i]], {i, 1, 
Length[xaxis] - 1}] // N

What do I change to plot the middle sum and get the area of it?

Caroline
  • 3
  • 1
  • If you modify your post to show the code demonstrating exactly how you are getting your rectangles then someone can probably show how to change that slightly to get the middle. Right now you have "there is this function and I give it some stuff and I get some stuff and the stuff is wrong, what do I change?" Precisely what's the "stuff"? Thanks – Bill May 03 '16 at 18:10
  • FYI, you may be able to get better help on the [[mathematica.se]] site. – Pang May 04 '16 at 03:18

0 Answers0