rsums

Interactive evaluation of Riemann sums

Syntax

rsums(f)
rsums(f,a,b)
rsums(f,[a,b])

Description

rsums(f) interactively approximates the integral of f(x) by Middle Riemann sums for x from 0 to 1. rsums(f) displays a graph of f(x) using 10 terms (rectangles). You can adjust the number of terms taken in the Middle Riemann sum by using the slider below the graph. The number of terms available ranges from 2 to 128. f can be a string or a symbolic expression. The height of each rectangle is determined by the value of the function in the middle of each interval.

rsums(f,a,b) and rsums(f,[a,b]) approximates the integral for x from a to b.

Examples

expand all

Visualize Riemann Sums

Use rsums('exp(-5*x^2)') or rsums exp(-5*x^2) to create the following plot.

rsums exp(-5*x^2)

Was this topic helpful?