Created
August 29, 2015 10:52
Numerical integration with Python. Full article at http://www.firsttimeprogrammer.blogspot.com/2015/03/numerical-integration-with-python.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output | |
# >>> ================================ RESTART ================================ | |
# >>> | |
# Actual area: 5208.333333333333 | |
# | |
# Approximating using rectangular rule... | |
# Percentage error: -0.0104123281966 % | |
# Approximation: (5207.7910245730936, -0.010412328196596356) | |
# | |
# Approximating using trapezoidal rule... | |
# Percentage error: 0.0208246563932 % | |
# Approximation: (5209.4179508538109, 0.020824656393175246) | |
# ############################################################# | |
# Approximating using rectangular rule with: 15 points, percentage error: -1.5625 % | |
# Approximating using rectangular rule with: 25 points, percentage error: -0.127551020408 % | |
# Approximating using rectangular rule with: 35 points, percentage error: -0.0434027777778 % | |
# 5206.07277199 | |
# Approximating using trapezoidal rule with: 15 points, percentage error: 3.125 % | |
# Approximating using trapezoidal rule with: 25 points, percentage error: 0.255102040816 % | |
# Approximating using trapezoidal rule with: 35 points, percentage error: 0.0868055555556 % | |
# Approximating using trapezoidal rule with: 45 points, percentage error: 0.0432525951557 % | |
# 5210.58607266 | |
# >>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment