1) Write a function that will return an arithmetic sequence beginning at a, jumping by d, and containing n terms:
a, a+d, a+2d, a+3d, ..., a+(n-1)d
|
|
Notice how zero based indexing can simplify things:
|
|
\newcommand{\Bold}[1]{\mathbf{#1}}\left[a, a + d, a + 2 \, d, a + 3 \, d, a + 4 \, d, a + 5 \, d, a + 6 \, d, a + 7 \, d, a + 8 \, d, a + 9 \, d\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[a, a + d, a + 2 \, d, a + 3 \, d, a + 4 \, d, a + 5 \, d, a + 6 \, d, a + 7 \, d, a + 8 \, d, a + 9 \, d\right]
|
2) Write a function that will return a geometric sequence beginning at g, growing by r, and containing n terms:
g, gr, gr^2, gr^3, ..., gr^{n-1}
|
|
Again, zero based indexing can simplify things:
|
|
\newcommand{\Bold}[1]{\mathbf{#1}}\left[g, g r, g r^{2}, g r^{3}, g r^{4}, g r^{5}, g r^{6}, g r^{7}, g r^{8}, g r^{9}\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[g, g r, g r^{2}, g r^{3}, g r^{4}, g r^{5}, g r^{6}, g r^{7}, g r^{8}, g r^{9}\right]
|
3) Write a function that will evaluate \sum_{x=a}^{b}f(x).
|
|
\newcommand{\Bold}[1]{\mathbf{#1}}\left[1, 4, 9, 16, 25, 36, 49, 64, 81, 100\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[1, 4, 9, 16, 25, 36, 49, 64, 81, 100\right]
|
\newcommand{\Bold}[1]{\mathbf{#1}}385
\newcommand{\Bold}[1]{\mathbf{#1}}385
|
4) Write a function to find the area of a trapezoid with bases b_1 and b_2 and height h.
|
|
5) Write a function that will approximate the area under some algebraic function f(x). The area under f(x) will be approximated by slicing it up into trapezoids:
|
|
|
|
|
|