# Numerical Integration Analysis — Data!

We wanted to follow up with a post that contains a dump of our data. This includes, essentially, our percent error from the expected value of the given test functions:

• $\cos{x}$ over [0, $\pi{}$]
• $2x + 1$ over [0, 1]
• $4-x^2$ over [0, 2]
• $5x^3 – 6x^2 + 0.3x$ over [-1, 3]
• $x^3$ over [-1, 3]
• $x^3 -27x^2 + 8x$ over [0, 3]

We tested 5 different deltas (rectangle widths), $dx$, namely, $0.1$, $0.01$, $0.001$, $0.0001$, $0.00001$. But we are not going to put tables for each method and each delta; it’s just too much. However, we will do the first delta ($0.1$) and the last delta ($0.00001$).

### Summary of Methods for $\cos{x}$ over [0, $\pi{}$]

Method Delta Percent Error
Trapezoidal $0.100000$ -0.33364
Trapezoidal $0.000010$ -0.00000
Midpoint $0.100000$ -0.20893
Midpoint $0.000010$ -0.00000
Simpsons $0.100000$ 0.05475
Simpsons $0.000010$ 0.00000
Left Rectangle $0.100000$ -4.97995
Left Rectangle $0.000010$ -0.00050
Right Rectangle $0.100000$ 4.31267
Right Rectangle $0.000010$ 0.00050

### Summary of Methods for $2x + 1$ over [0, 1]

Method Delta Percent Error
Trapezoidal $0.100000$ -14.50000
Trapezoidal $0.000010$ -0.00150
Midpoint $0.100000$ -14.50000
Midpoint $0.000010$ -0.00150
Simpsons $0.100000$ 0.00000
Simpsons $0.000010$ 0.00000
Left Rectangle $0.100000$ -10.00000
Left Rectangle $0.000010$ -0.00100
Right Rectangle $0.100000$ -19.00000
Right Rectangle $0.000010$ -0.00200

### Summary of Methods for $4-x^2$ over [0, 2]

Method Delta Percent Error
Trapezoidal $0.100000$ -0.42813
Trapezoidal $0.000010$ -0.00000
Midpoint $0.100000$ -0.33906
Midpoint $0.000010$ -0.00000
Simpsons $0.100000$ 0.00000
Simpsons $0.000010$ -0.00000
Left Rectangle $0.100000$ -3.81250
Left Rectangle $0.000010$ -0.00038
Right Rectangle $0.100000$ 2.95625
Right Rectangle $0.000010$ 0.00037

### Summary of Methods for $5x^3 – 6x + 0.3x$ over [-1, 3]

Method Delta Percent Error
Trapezoidal $0.100000$ -16.93086
Trapezoidal $0.000010$ -0.00181
Midpoint $0.100000$ -17.10882
Midpoint $0.000010$ -0.00181
Simpsons $0.100000$ -0.00000
Simpsons $0.000010$ -0.00000
Left Rectangle $0.100000$ -7.67699
Left Rectangle $0.000010$ -0.00078
Right Rectangle $0.100000$ -26.18473
Right Rectangle $0.000010$ -0.00284

### Summary of Methods for $x^3$ over [-1, 3]

Method Delta Percent Error
Trapezoidal $0.100000$ -14.87537
Trapezoidal $0.000010$ -2.44034
Midpoint $0.100000$ -15.01091
Midpoint $0.000010$ -2.44034
Simpsons $0.100000$ -2.43902
Simpsons $0.000010$ -2.43902
Left Rectangle $0.100000$ -8.68293
Left Rectangle $0.000010$ -2.43966
Right Rectangle $0.100000$ -21.06780
Right Rectangle $0.000010$ -2.44102

### Summary of Methods for $x^3 – 27x^2 + 8x$ over [0, 3]

Method Delta Percent Error
Trapezoidal $0.100000$ -9.88570
Trapezoidal $0.000010$ -0.00103
Midpoint $0.100000$ -9.97363
Midpoint $0.000010$ -0.00103
Simpsons $0.100000$ 0.00000
Simpsons $0.000010$ -0.00000
Left Rectangle $0.100000$ -5.08032
Left Rectangle $0.000010$ -0.00051
Right Rectangle $0.100000$ -14.69108
Right Rectangle $0.000010$ -0.00154

Of course, we must mention that there is some rounding in the percent errors. Simpsons, Midpoint, and Trapezoidal methods are not perfect.