org.lsmp.djep.xjep.function
Class Sum

java.lang.Object
  extended by org.nfunk.jep.function.PostfixMathCommand
      extended by org.lsmp.djep.xjep.function.SumType
          extended by org.lsmp.djep.xjep.function.Sum
All Implemented Interfaces:
CallbackEvaluationI, PostfixMathCommandI
Direct Known Subclasses:
MSum

public class Sum
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

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
Sum(JEP j)
           
 
Method Summary
 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, 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

Sum

public Sum(JEP j)
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


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