Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd88db1 commit ce6e888Copy full SHA for ce6e888
reimann.py
@@ -0,0 +1,35 @@
1
+#!/usr/bin/python
2
+
3
+def func(x):
4
+ y = x * x
5
+ return y
6
7
+def main():
8
+ # Domain start and end
9
+ xStart = 0.0
10
+ xEnd = 2.0 * 3.1415
11
12
+ # Number of total samples
13
+ numRectangles = 10
14
15
+ # Rectangle width
16
+ width = (xEnd-xStart) / numRectangles
17
18
+ # Empty list of Rectangle areas
19
+ area_of_each_rectangle = []
20
21
+ for i in range(0,numRectangles - 1):
22
+ x = i * width
23
+ y = func(x)
24
+ area_of_each_rectangle.append(x * y)
25
26
+ # Calculate the "Total" area
27
+ total_area = 0.0
28
29
30
+ total_area += area_of_each_rectangle[i]
31
32
+ # Output the total area
33
+ print total_area
34
35
+main()
0 commit comments