Midpoint Rule Numerical integration using python

I created a program to evaluate definite integrals using the Midpoint Rule.

Firstly, the midpoint rule states that:

Since evaluating definite integrals using the midpoint rule is a repetitious method, it would be best if a program would do it. Increasing the value of n would increase the integral's accuracy, but it would be more difficult to do by hand.

Here is my python code for the definite integral of \(\sin^2(x)\). You can change the function in the code to integrate any function you want. Increasing the number of midpoints increases accuracy.


Note by Krishna Venkatraman
4 months, 2 weeks ago

No vote yet
1 vote

  Easy Math Editor

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 \( 2 \times 3 \)
2^{34} \( 2^{34} \)
a_{i-1} \( a_{i-1} \)
\frac{2}{3} \( \frac{2}{3} \)
\sqrt{2} \( \sqrt{2} \)
\sum_{i=1}^3 \( \sum_{i=1}^3 \)
\sin \theta \( \sin \theta \)
\boxed{123} \( \boxed{123} \)


Sort by:

Top Newest

Raji is the first continuous human cell line of hematopoietic origin and was derived 40 years ago from a patient with Burkitt's lymphoma (BL). Cell lines of BL origin were soon found to harbor the Epstein–Barr virus (EBV), leading to the discovery and isolation of this virus.

Wendy Wilson - 3 months ago

Log in to reply

ChIP is commonly used in the study of transcriptional factor binding site or protein modification site. With the development of NGS, the combination of CHIP and NGS, Chromatin Immunoprecipitation Sequencing (ChIP-Seq), is now able to screen and identify the protein binding sites on the entire chromosomal scale with high efficiency and accuracy.


Shangery Fortina - 1 month ago

Log in to reply

lol you're just Wendy Wilson

Krishna Venkatraman - 2 weeks, 2 days ago

Log in to reply


Problem Loading...

Note Loading...

Set Loading...