## `student::plotRiemann` -- plot of a numerical approximation to an integral using rectangles

#### Introduction

`student::plotRiemann``(f, x=a..b, n)` computes a numerical approximation to the integral int(f(x),x=a..b) using rectangles and returns a plot of the numerical process.

#### Call(s)

`student::plotRiemann(f, x=a..b <, n> <, opt1>...)`
`student::plotRiemann(f, x=a..b <, n>, method <, opt1>...)`

#### Parameters

`f` | - | functional expression in `x`
`x` | - | identifier
`a, b` | - | arithmetical expressions
`n` | - | a positive integer (number of rectangles)
`method` | - | one of the options Left, Middle, or Right
`opt1` | - | plot option(s) for two-dimensional graphical objects

#### Options

`Left` | - | The height of each rectangle is determined by the value of the function at the leftpoint of each interval.
`Middle` | - | The height of each rectangle is determined by the value of the function at the middlepoint of each interval (the default method).
`Right` | - | The height of each rectangle is determined by the value of the function at the rightpoint of each interval.

#### Returns

a graphical object of the domain type `plot::Group`.

#### Related Functions

`plot`, `plot::Group`, `student::plotSimpson`, `student::plotTrapezoid`, `student::riemann`

#### Details

- `student::plotRiemann``(f, x=a..b, n)` computes a numerical approximation to the integral int(f(x),x=a..b) using n rectangles and returns a graphical object of the numerical process that can be displayed with the function `plot`.

  The height of each rectangle is determined by the value of the function at the middlepoint of each interval (as with option Middle).

- With `student::plotRiemann``(f, x=a..b, n, Left)`, the height of each rectangle is determined by the value of the function at the leftpoint of each interval.

  Use option Right, if the rightpoint of each interval should be taken.

- `n` is the number of rectangles to use. The default value is 4.
- The plot options `opt1`... must be valid plot options for two-dimensional graphical objects. See `plot2d` for details.

  Note that scene options are not allowed! You may give scene options as optional arguments for the function `plot`, or use `plot::Scene` to create an object representing a graphical scene.

- The graphical object returned has three operands: a group of the (filled) rectangles, a group of rectangles for the frames of the filled rectangles, as well as the function graph of `f` (of the domain type `plot::Function2d`). The first two operands are objects of the domain `plot::Group`.

#### Example 1

The following call returns a visualization of the numerical approximation to the integral int(e^x,x=-1..1) using 10 rectangles:

    >> p := student::plotRiemann(exp(x), x = -1..1, 10)

                                   plot::Group()

    >> plot(p)

#### Example 2

You can change plot parameters of the visualization returned by `student::plotRiemann`. For example, to change the color of the filled rectangles to blue, we must set the plot option `Color` of the first operand of `p` to the value `RGB::Blue`:

    >> (p[1])::Color := RGB::Blue:
       plot(p, Axes = Box)

Here we changed the style of the axes of the graphical scene to the value `Box`.

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000