Skip to content

Instantly share code, notes, and snippets.

@JasonSpine
Created January 23, 2017 09:03
Show Gist options
  • Save JasonSpine/fd6e22967a538edb5a18e96f0b075ec8 to your computer and use it in GitHub Desktop.
Save JasonSpine/fd6e22967a538edb5a18e96f0b075ec8 to your computer and use it in GitHub Desktop.
Integral - rectangle method
#python < 3.0
import math
x=1.0 #starting argument
dx=0.0001 #delta
result=0.0
while x<=200.0: #ending argument
x+=dx
fx=1.0/x #integrable function
result+=dx*fx
print("%20.53lf"%(result)) #output the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment