Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
right_rect(e, x, a, b, n) := block([h: (b - a) / n, s: 0],
|
||||
for i from 1 thru n do s: s + subst(x = a + i * h, e),
|
||||
s * h)$
|
||||
|
||||
left_rect(e, x, a, b, n) := block([h: (b - a) / n, s: 0],
|
||||
for i from 1 thru n do s: s + subst(x = a + (i - 1) * h, e),
|
||||
s * h)$
|
||||
|
||||
mid_rect(e, x, a, b, n) := block([h: (b - a) / n, s: 0],
|
||||
for i from 1 thru n do s: s + subst(x = a + (i - 1/2) * h, e),
|
||||
s * h)$
|
||||
|
||||
trapezium(e, x, a, b, n) := block([h: (b - a) / n, s: 0],
|
||||
for i from 1 thru n - 1 do s: s + subst(x = a + i * h, e),
|
||||
((subst(x = a, e) + subst(x = b, e)) / 2 + s) * h)$
|
||||
|
||||
simpson(e, x, a, b, n) := block([h: (b - a) / n, s: 0],
|
||||
for i from 1 thru n do
|
||||
s: s + subst(x = a + i * h, e) + 2 * subst(x = a + (i - 1/2) * h, e),
|
||||
(subst(x = a, e) - subst(x = b, e) + 2 * s) * h / 6)$
|
||||
|
||||
/* some tests */
|
||||
|
||||
simpson(log(x), x, 1, 2, 20), bfloat;
|
||||
2 * log(2) - 1 - %, bfloat;
|
||||
|
||||
trapezium(1/x, x, 1, 100, 10000) - log(100), bfloat;
|
||||
Loading…
Add table
Add a link
Reference in a new issue