Previous Page Next Page Contents

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

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




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000