Class Riemannsum
Extends
JXG.Curve.
This element is used to provide a constructor for Riemann sums, which is realized as a special curve.
The returned element has the method Value() which returns the sum of the areas of the rectangles.
Defined in: Curve.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Riemannsum(f,n,type_,a_,b_)
|
- Fields borrowed from class JXG.Curve:
- curveType, handDrawing, numberPoints
- Fields borrowed from class JXG.GeometryElement:
- addEvent, ancestors, board, childElements, descendants, draft, dump, elementClass, elType, eventHandlers, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlighted, highlightFillOpacity, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, scalable, stdform, strokeOpacity, subs, symbolic, trace, traceAttributes, traces, transformations, type, visProp, withLabel
- Methods borrowed from class JXG.Curve:
- addTransform, allocatePoints, generateTerm, hasPoint, isDistOK, isSegmentOutside, maxX, minX, notifyParents, setPosition, setPositionDirectly, update, updateCurve, updateDataArray, updateParametricCurve, updateParametricCurveNaive, updateRenderer, updateTransform, Z
- Methods borrowed from class JXG.GeometryElement:
- addChild, addRotation, animate, bounds, clearTrace, cloneToBackground, createLabel, dash, fillColor, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, hideElement, highlight, highlightFillColor, highlightStrokeColor, labelColor, noHighlight, off, on, remove, resolveShortcuts, setArrow, setAttribute, setLabelText, setProperty, shadow, showElement, snapToGrid, strokeColor, strokeWidth, triggerEventHandlers, visible
- Events borrowed from class JXG.GeometryElement:
- attribute, attribute:<attribute><attribute>, down, drag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, touchdown, touchdrag, touchup, up
// Create Riemann sums for f(x) = 0.5*x*x-2*x. var s = board.create('slider',[[0,4],[3,4],[0,4,10]],{snapWidth:1}); var f = function(x) { return 0.5*x*x-2*x; }; var r = board.create('riemannsum', [f, function(){return s.Value();}, 'upper', -2, 5], {fillOpacity:0.4} ); var g = board.create('functiongraph',[f, -2, 5]); var t = board.create('text',[-1,-1, function(){ return 'Sum=' + r.Value().toFixed(4); }]);
- Parameters:
- {function_number|function_string|function_function|number_function|number} f,n,type_,a_,b_
- Parent elements of Riemannsum are a
function term f(x) describing the function graph which is filled by the Riemann rectangles.
n determines the number of rectangles, it is either a fixed number or a function.
type is a string or function returning one of the values: 'left', 'right', 'middle', 'lower', 'upper', or 'trapezodial'. Default value is 'left'.
Further parameters are an optional number or function for the left interval border a, and an optional number or function for the right interval border b.
Default values are a=-10 and b=10.
- See:
- JXG.Curve