Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.lsmp.djep.xjep.function
Class Trapezium

    java.lang.Object
      org.nfunk.jep.function.PostfixMathCommand
          org.lsmp.djep.xjep.function.SumType
              org.lsmp.djep.xjep.function.Trapezium

All Implemented Interfaces:
  CallbackEvaluationI, PostfixMathCommandI

Direct Known Subclasses:
  Simpson

    public class Trapezium

extends SumType

The trapezium rule for approximation to a definite integral. h * (y0 + yn + 2(y1+y2+...+y_(n-1)) /2 where h = (xn-x0)/n, yi = f(xi) Trapezium(x^2,x,0,10,0.5) finds an approximation for int(x^2) where x runs from 0 to 10 in steps of h=0.5.

Author:
  Rich Morris Created on 10-Sept-2004

Field Summary

Fields inherited from class org.lsmp.djep.xjep.function.SumType
`name`

Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
`curNumberOfParameters, numberOfParameters`

Constructor Summary
`Trapezium()`
`Trapezium(java.lang.String name)`

Method Summary
`java.lang.Object` | `evaluate(Node node, Variable var, double min, double max, double inc, EvaluatorI pv)` Evaluates the node by repeatibly setting the value of the variable from min to max, and calculating the value of the first argument.
`java.lang.Object` | `evaluate(java.lang.Object[] elements)` Evaluates the function given the set of y values.

Methods inherited from class org.lsmp.djep.xjep.function.SumType
`checkNumberOfParameters, evaluate, run`

Methods inherited from class org.nfunk.jep.function.PostfixMathCommand
`checkStack, getNumberOfParameters, setCurNumberOfParameters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Trapezium

    public Trapezium()

### Trapezium

    public Trapezium(java.lang.String name)

Method Detail

### evaluate

    public java.lang.Object evaluate(java.lang.Object[] elements)
                              throws ParseException

  Description copied from class: `SumType`
  Evaluates the function given the set of y values. For example for Sum(x^2,x,1,5) the function will be passed the array [1,4,9,16,25].

  Specified by:
    `evaluate` in class `SumType`
  Parameters:
    `elements` - the y values
  Returns:
    the result of the function
  Throws:
    `ParseException`

### evaluate

    public java.lang.Object evaluate(Node node,
                                     Variable var,
                                     double min,
                                     double max,
                                     double inc,
                                     EvaluatorI pv)
                              throws ParseException

  Description copied from class: `SumType`
  Evaluates the node by repeatibly setting the value of the variable from min to max, and calculating the value of the first argument. Sub classes generally do not need to implement this method as `SumType.evaluate(Object[])` is more useful. If they do they should follow the pattern used here.

  Overrides:
    `evaluate` in class `SumType`
  Returns:
    the result of evaluation
  Throws:
    `ParseException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

http://www.singularsys.com/jep Copyright © 2007 Singular Systems