org.matheclipse.core.reflection.system
Class HarmonicNumber
- java.lang.Object
-
- org.matheclipse.core.reflection.system.HarmonicNumber
-
- All Implemented Interfaces:
- IFunctionEvaluator, IEvaluator
public class HarmonicNumber extends java.lang.Object implements IFunctionEvaluator
Harmonic number of a given integer value See: Harmonic number
-
-
Constructor Summary
Constructors Constructor and Description HarmonicNumber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description IExprevaluate(IAST ast)Symbolic evaluation of a function.BigFractionharmonicNumber(int n)The Harmonic number at the index specifiedIExprnumericEval(IAST functionList)Numeric evaluation of a function.voidsetUp(ISymbol symbol)This method will be called every time a new ISymbol will be created.
-
-
-
Method Detail
-
evaluate
public IExpr evaluate(IAST ast)
Description copied from interface:IFunctionEvaluatorSymbolic evaluation of a function.ast.get(0)contains the head (i.e. the function symbol) of this abstract syntax tree (AST).ast.get(1)toast.get(n)contains the first to n-th argument of the function.
If necessary use the methods from theValidateclass to check the number or types of arguments in the evaluate method.
Note: if the symbolic evaluation isn't possible or no result is found the evaluate method returns with anullvalue without throwing an exception!- Specified by:
evaluatein interfaceIFunctionEvaluator- Parameters:
ast- the abstract syntax tree (AST) which should be evaluated- Returns:
- the evaluated object or
null, if evaluation isn't possible - See Also:
Validate
-
numericEval
public IExpr numericEval(IAST functionList)
Description copied from interface:IFunctionEvaluatorNumeric evaluation of a function.ast.get(0)contains the head (i.e. the function symbol) of this abstract syntax tree (AST).ast.get(1)toast.get(n)contains the first to n-th argument of the function.
If necessary use the methods from theValidateclass to check the number or types of arguments in the evaluate method.- Specified by:
numericEvalin interfaceIFunctionEvaluator- Parameters:
functionList- the abstract syntax tree (AST) which should be evaluated- Returns:
- the evaluated object or
null, if evaluation isn't possible - See Also:
Validate
-
harmonicNumber
public BigFraction harmonicNumber(int n)
The Harmonic number at the index specified- Parameters:
n- the index, non-negative.- Returns:
- the H_1=1 for n=1, H_2=3/2 for n=2 etc. For values of n less than 1, zero is returned.
-
setUp
public void setUp(ISymbol symbol) throws SyntaxError
Description copied from interface:IEvaluatorThis method will be called every time a new ISymbol will be created. In this method you can set ISymbol attributes or constants for the symbol- Specified by:
setUpin interfaceIEvaluator- Parameters:
symbol- the symbol which should be set up- Throws:
SyntaxError
-
-
DMelt 3.0 © DataMelt by jWork.ORG