Trapezoidal Rule Calculator
Approximate the definite integral of f(x) using the trapezoidal rule. Split [a, b] into n subintervals and view the result, step size, and each sample point.
Input
Enter a function f(x), the limits a and b, and the number of subintervals n to approximate the definite integral with the trapezoidal rule.
e.g. sin(x), x^2, exp(-x^2). Supports pi, e, and implicit multiplication such as 2x.
Result
Approximation of ∫ from 0 to 3.1416 of f(x) dx
1.9998355039
Subintervals n
100
Step size h
0.0314159265
Sample points
101
Sample points
Rows are thinned out when there are many points. Endpoints have weight 1 and interior points have weight 2.
| k | x | f(x) | Weight |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 1 | 0.0314159265 | 0.0314107591 | 2 |
| 2 | 0.0628318531 | 0.0627905195 | 2 |
| 3 | 0.0942477796 | 0.0941083133 | 2 |
| 4 | 0.1256637061 | 0.1253332336 | 2 |
| 5 | 0.1570796327 | 0.156434465 | 2 |
| 6 | 0.1884955592 | 0.1873813146 | 2 |
| 7 | 0.2199114858 | 0.2181432414 | 2 |
| 8 | 0.2513274123 | 0.2486898872 | 2 |
| 9 | 0.2827433388 | 0.278991106 | 2 |
| 10 | 0.3141592654 | 0.3090169944 | 2 |
| 11 | 0.3455751919 | 0.3387379202 | 2 |
| 12 | 0.3769911184 | 0.3681245527 | 2 |
| 13 | 0.408407045 | 0.3971478906 | 2 |
| 14 | 0.4398229715 | 0.4257792916 | 2 |
| 15 | 0.471238898 | 0.4539904997 | 2 |
| 16 | 0.5026548246 | 0.4817536741 | 2 |
| 17 | 0.5340707511 | 0.5090414158 | 2 |
| 18 | 0.5654866776 | 0.535826795 | 2 |
| 19 | 0.5969026042 | 0.5620833779 | 2 |
| 20 | 0.6283185307 | 0.5877852523 | 2 |
| 21 | 0.6597344573 | 0.6129070537 | 2 |
| 22 | 0.6911503838 | 0.6374239897 | 2 |
| 23 | 0.7225663103 | 0.6613118653 | 2 |
| 24 | 0.7539822369 | 0.6845471059 | 2 |
| 25 | 0.7853981634 | 0.7071067812 | 2 |
| 26 | 0.8168140899 | 0.7289686274 | 2 |
| 27 | 0.8482300165 | 0.7501110696 | 2 |
| 28 | 0.879645943 | 0.7705132428 | 2 |
| 29 | 0.9110618695 | 0.7901550124 | 2 |
| 30 | 0.9424777961 | 0.8090169944 | 2 |
| 31 | 0.9738937226 | 0.8270805743 | 2 |
| 32 | 1.0053096491 | 0.8443279255 | 2 |
| 33 | 1.0367255757 | 0.860742027 | 2 |
| 34 | 1.0681415022 | 0.87630668 | 2 |
| 35 | 1.0995574288 | 0.8910065242 | 2 |
| 36 | 1.1309733553 | 0.9048270525 | 2 |
| 37 | 1.1623892818 | 0.9177546257 | 2 |
| 38 | 1.1938052084 | 0.9297764859 | 2 |
| 39 | 1.2252211349 | 0.940880769 | 2 |
| 40 | 1.2566370614 | 0.9510565163 | 2 |
| 41 | 1.288052988 | 0.9602936857 | 2 |
| 42 | 1.3194689145 | 0.9685831611 | 2 |
| 43 | 1.350884841 | 0.9759167619 | 2 |
| 44 | 1.3823007676 | 0.9822872507 | 2 |
| 45 | 1.4137166941 | 0.9876883406 | 2 |
| 46 | 1.4451326207 | 0.9921147013 | 2 |
| 47 | 1.4765485472 | 0.9955619646 | 2 |
| 48 | 1.5079644737 | 0.9980267284 | 2 |
| 49 | 1.5393804003 | 0.9995065604 | 2 |
| 50 | 1.5707963268 | 1 | 2 |
| 51 | 1.6022122533 | 0.9995065604 | 2 |
| 52 | 1.6336281799 | 0.9980267284 | 2 |
| 53 | 1.6650441064 | 0.9955619646 | 2 |
| 54 | 1.6964600329 | 0.9921147013 | 2 |
| 55 | 1.7278759595 | 0.9876883406 | 2 |
| 56 | 1.759291886 | 0.9822872507 | 2 |
| 57 | 1.7907078125 | 0.9759167619 | 2 |
| 58 | 1.8221237391 | 0.9685831611 | 2 |
| 59 | 1.8535396656 | 0.9602936857 | 2 |
| 60 | 1.8849555922 | 0.9510565163 | 2 |
| 61 | 1.9163715187 | 0.940880769 | 2 |
| 62 | 1.9477874452 | 0.9297764859 | 2 |
| 63 | 1.9792033718 | 0.9177546257 | 2 |
| 64 | 2.0106192983 | 0.9048270525 | 2 |
| 65 | 2.0420352248 | 0.8910065242 | 2 |
| 66 | 2.0734511514 | 0.87630668 | 2 |
| 67 | 2.1048670779 | 0.860742027 | 2 |
| 68 | 2.1362830044 | 0.8443279255 | 2 |
| 69 | 2.167698931 | 0.8270805743 | 2 |
| 70 | 2.1991148575 | 0.8090169944 | 2 |
| 71 | 2.230530784 | 0.7901550124 | 2 |
| 72 | 2.2619467106 | 0.7705132428 | 2 |
| 73 | 2.2933626371 | 0.7501110696 | 2 |
| 74 | 2.3247785637 | 0.7289686274 | 2 |
| 75 | 2.3561944902 | 0.7071067812 | 2 |
| 76 | 2.3876104167 | 0.6845471059 | 2 |
| 77 | 2.4190263433 | 0.6613118653 | 2 |
| 78 | 2.4504422698 | 0.6374239897 | 2 |
| 79 | 2.4818581963 | 0.6129070537 | 2 |
| 80 | 2.5132741229 | 0.5877852523 | 2 |
| 81 | 2.5446900494 | 0.5620833779 | 2 |
| 82 | 2.5761059759 | 0.535826795 | 2 |
| 83 | 2.6075219025 | 0.5090414158 | 2 |
| 84 | 2.638937829 | 0.4817536741 | 2 |
| 85 | 2.6703537556 | 0.4539904997 | 2 |
| 86 | 2.7017696821 | 0.4257792916 | 2 |
| 87 | 2.7331856086 | 0.3971478906 | 2 |
| 88 | 2.7646015352 | 0.3681245527 | 2 |
| 89 | 2.7960174617 | 0.3387379202 | 2 |
| 90 | 2.8274333882 | 0.3090169944 | 2 |
| 91 | 2.8588493148 | 0.278991106 | 2 |
| 92 | 2.8902652413 | 0.2486898872 | 2 |
| 93 | 2.9216811678 | 0.2181432414 | 2 |
| 94 | 2.9530970944 | 0.1873813146 | 2 |
| 95 | 2.9845130209 | 0.156434465 | 2 |
| 96 | 3.0159289474 | 0.1253332336 | 2 |
| 97 | 3.047344874 | 0.0941083133 | 2 |
| 98 | 3.0787608005 | 0.0627905195 | 2 |
| 99 | 3.1101767271 | 0.0314107591 | 2 |
| 100 | 3.1415926536 | 0 | 1 |
How it works
- The composite trapezoidal rule divides the interval [a, b] into n equal subintervals and approximates each piece as a trapezoid, then sums the areas.
- The step size is h = (b - a) / n and the sample points are x_k = a + k·h for k = 0, 1, …, n.
- The approximation is h × ( f(x0)/2 + f(x1) + … + f(x_{n-1}) + f(xn)/2 ). Endpoints carry weight 1 and interior points carry weight 2.
- Increasing n reduces the error and converges toward the true value; for a smooth f the error decreases roughly in proportion to h².
- Expressions are evaluated by a built-in safe parser supporting + - * / ^, parentheses, implicit multiplication, the variable x, the constants pi and e, and functions such as sin, cos, tan, exp, log, and sqrt.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Trapezoidal Rule Calculator