org.lsmp.djep.xjep.function
Class Simpson
java.lang.Object
org.nfunk.jep.function.PostfixMathCommand
org.lsmp.djep.xjep.function.SumType
org.lsmp.djep.xjep.function.Simpson
- All Implemented Interfaces:
- PostfixMathCommandI, SpecialEvaluationI
- public class Simpson
- extends SumType
A sum function Sum(x^2,x,1,10) finds the sum of x^2 with x running from 1 to 10.
Sum(x^2,x,1,10,2) calculates the 1^2+3^2+5^2+7^2+9^2 i.e. in steps of 2.
- Author:
- Rich Morris
Created on 10-Sept-2004
Fields inherited from class org.lsmp.djep.xjep.function.SumType |
name |
Method Summary |
java.lang.Object |
evaluate(Node node,
Variable var,
double min,
double max,
double inc,
java.lang.Object data,
ParserVisitor pv,
java.util.Stack stack)
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Simpson
public Simpson()
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,
java.lang.Object data,
ParserVisitor pv,
java.util.Stack stack)
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
- Overrides:
evaluate
in class SumType
- Parameters:
node
- var
- min
- max
- inc
- data
- pv
- stack
-
- Returns:
-
- Throws:
ParseException
http://www.singularsys.com/jep Copyright © 2004 Singular Systems