Class Sequences.SeqBase
- java.lang.Object
-
- org.matheclipse.core.eval.interfaces.AbstractEvaluator
-
- org.matheclipse.core.eval.interfaces.AbstractFunctionEvaluator
-
- org.matheclipse.core.sympy.series.Sequences.SeqBase
-
- All Implemented Interfaces:
Iterable<IExpr>,IFunctionEvaluator,IEvaluator,ISeqBase
- Direct Known Subclasses:
Sequences.EmptySequence,Sequences.SeqFormula,Sequences.SeqMul
- Enclosing class:
- Sequences
public static class Sequences.SeqBase extends AbstractFunctionEvaluator implements ISeqBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classSequences.SeqBase.SeqIterator
-
Field Summary
Fields Modifier and Type Field Description protected intlengthprotected IASTMutableseqASTprotected IExprstartprotected IExprstopprotected IASTvariables-
Fields inherited from interface org.matheclipse.core.eval.interfaces.IFunctionEvaluator
ARGS_0_0, ARGS_0_1, ARGS_0_1_0, ARGS_0_2, ARGS_0_2_0, ARGS_0_3, ARGS_0_INFINITY, ARGS_1_1, ARGS_1_2, ARGS_1_2_0, ARGS_1_2_1, ARGS_1_2_2, ARGS_1_3, ARGS_1_3_0, ARGS_1_3_1, ARGS_1_3_2, ARGS_1_4, ARGS_1_4_0, ARGS_1_4_1, ARGS_1_4_2, ARGS_1_5, ARGS_1_5_1, ARGS_1_INFINITY, ARGS_1_INFINITY_0, ARGS_1_INFINITY_1, ARGS_2_2, ARGS_2_2_1, ARGS_2_3, ARGS_2_3_0, ARGS_2_3_1, ARGS_2_3_2, ARGS_2_4, ARGS_2_4_1, ARGS_2_4_2, ARGS_2_INFINITY, ARGS_3_3, ARGS_3_4, ARGS_3_5, ARGS_3_6, ARGS_3_INFINITY, ARGS_4_4, ARGS_5_5, ARGS_6_6
-
-
Constructor Summary
Constructors Constructor Description SeqBase(IASTMutable seqAST)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISeqBase__mul__(ISeqBase other)IExpr[]_intersect_interval(ISeqBase other)Sequences.SeqBase_mul(Sequences.SeqBase other)Should only be used internally.IExprargs0()IASTargs1()IASTMutableasAST()IExprcoeff(IExpr pt)Returns the coefficient at point pt.IExprevaluate(IAST ast, EvalEngine engine)Symbolic evaluation of a function.int[]expectedArgSize(IAST ast)At index 0 return the "from", at index 1 return the "to" number of arguments, which are expected by this function.IASTfind_linear_recurrence(int n, IExpr d, IExpr gfvar)Finds the shortest linear recurrence that satisfies the first n terms of sequence of order ≤n/2if possible.IExprgen()IExprinterval()The interval on which the sequence is definedorg.matheclipse.core.sympy.series.Sequences.ISeqIteratoriterator()voidsetUp(ISymbol newSymbol)Evaluate built-in rules and define Attributes for a function.-
Methods inherited from class org.matheclipse.core.eval.interfaces.AbstractFunctionEvaluator
createRuleFromMethod, determineOptions, extractImaginaryUnit, extractImaginaryUnit, getComplexExpr, getNegativePlusInTimes, getNormalizedNegativeExpression, getNormalizedNegativeExpression, getPeriodicParts, getPowerNegativeExpression, getPureImaginaryPart, imaginaryPart, initSerializedRules, isNegativeWeighted, isNegativeWeighted, peelOff, peelOffPlusI, peelOffPlusRational, peelOfTimes, peelOfTimes, realPart
-
Methods inherited from class org.matheclipse.core.eval.interfaces.AbstractEvaluator
defaultReturn, evalCatched, numericEval
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.matheclipse.core.interfaces.IEvaluator
await, setOptions
-
Methods inherited from interface org.matheclipse.core.eval.interfaces.IFunctionEvaluator
getOptionSymbols, numericFunction, print, status
-
Methods inherited from interface org.matheclipse.core.interfaces.ISeqBase
_eval_coeff, _ith_point, find_linear_recurrence, mul, start, stop, variables
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
seqAST
protected IASTMutable seqAST
-
length
protected int length
-
start
protected IExpr start
-
stop
protected IExpr stop
-
variables
protected IAST variables
-
-
Constructor Detail
-
SeqBase
public SeqBase(IASTMutable seqAST)
-
-
Method Detail
-
asAST
public IASTMutable asAST()
-
interval
public IExpr interval()
Description copied from interface:ISeqBaseThe interval on which the sequence is defined
-
evaluate
public IExpr evaluate(IAST ast, EvalEngine engine)
Description copied from class:AbstractFunctionEvaluatorSymbolic evaluation of a function. The methodIExpr.head()contains the head (i.e. the function symbol) of this abstract syntax tree (AST).From
ast.get(1)toast.get(n)theastcontains the first to n-th argument of the function (alternatively you get the first to fifth argument with the methodsIAST.arg1(),IAST.arg2(),IAST.arg3()...IAST.arg5().Example: the expression
Binomial(n,m)is represented as AST withast.head() <=> F.Binomial,ast.arg1() <=> nandast.arg2() <=> mIf necessary use the methods from the
Validateclass 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 a
F.NILvalue without throwing an exception!- Specified by:
evaluatein interfaceIFunctionEvaluator- Specified by:
evaluatein classAbstractFunctionEvaluator- Parameters:
ast- the abstract syntax tree (AST) which should be evaluatedengine- the users current evaluation engine- Returns:
- the evaluated object or
F#NIL, if evaluation isn't possible - See Also:
Validate
-
expectedArgSize
public int[] expectedArgSize(IAST ast)
Description copied from interface:IFunctionEvaluatorAt index 0 return the "from", at index 1 return the "to" number of arguments, which are expected by this function. If the returnedintarray has length 3, the function allows headers unequal to the built-in function name (i.e. the function can be in "operator form").- Specified by:
expectedArgSizein interfaceIFunctionEvaluator- Parameters:
ast- the abstract syntax tree (AST) those arguments should be checked- Returns:
nullif no range for the number of arguments is specified.
-
_mul
public Sequences.SeqBase _mul(Sequences.SeqBase other)
Should only be used internally.
this._mul(other) returns a new, term-wise multiplied sequence if this knows how to multiply with other, otherwise it returns
null.- Parameters:
other-- Returns:
null
-
find_linear_recurrence
public IAST find_linear_recurrence(int n, IExpr d, IExpr gfvar)
Description copied from interface:ISeqBaseFinds the shortest linear recurrence that satisfies the first n terms of sequence of order ≤n/2if possible. Ifdis specified, find shortest linear recurrence of order ≤ min(d, n/2) if possible. Returns list of coefficients{b(1), b(2), ...}corresponding to the recurrence relationx(n) = b(1)*x(n-1) + b(2)*x(n-2) + ...Returns{}2if no recurrence is found. Ifgfvaris specified, also returns ordinary generating function as a function ofgfvar.- Specified by:
find_linear_recurrencein interfaceISeqBase- Returns:
-
setUp
public void setUp(ISymbol newSymbol)
Description copied from class:AbstractFunctionEvaluatorEvaluate built-in rules and define Attributes for a function.- Specified by:
setUpin interfaceIEvaluator- Overrides:
setUpin classAbstractFunctionEvaluator- Parameters:
newSymbol- the symbol which should be set up
-
-