Package org.matheclipse.core.interfaces
Interface ISymbol
-
- All Superinterfaces:
edu.jas.structure.AbelianGroupElem<IExpr>,org.hipparchus.CalculusFieldElement<IExpr>,Comparable<IExpr>,edu.jas.structure.Element<IExpr>,org.hipparchus.FieldElement<IExpr>,edu.jas.structure.GcdRingElem<IExpr>,IExpr,edu.jas.structure.MonoidElem<IExpr>,edu.jas.structure.RingElem<IExpr>,Serializable
- All Known Subinterfaces:
IBuiltInSymbol
- All Known Implementing Classes:
BuiltInDummy,BuiltInRubi,BuiltInSymbol,Symbol
public interface ISymbol extends IExpr
An expression representing a symbol (i.e. variable- constant- or function-name)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.matheclipse.core.interfaces.IExpr
IExpr.COMPARE_TERNARY
-
-
Field Summary
Fields Modifier and Type Field Description static intCONSTANTISymbol attribute to indicate that a symbol has a constant valuestatic intDIRTY_FLAG_ASSIGNED_VALUEISymbol flag to indicate that the symbols value is used by a methodstatic intFLATISymbol attribute for an associative function transformation.static intFLATORDERLESSISymbol attribute combination (ISymbol.FLAT and ISymbol.ORDERLESS)static intHOLDALLISymbol attribute for a function, where no argument should be evaluatedstatic intHOLDALLCOMPLETEISymbol attribute for a function, where no argument should be evaluatedstatic intHOLDCOMPLETEISymbol attribute for a function, where no argument should be evaluatedstatic intHOLDFIRSTISymbol attribute for a function, where the first argument should not be evaluatedstatic intHOLDRESTISymbol attribute for a function, where only the first argument should be evaluatedstatic intLISTABLEISymbol attribute for a function with lists as argumentsstatic intLOCKEDISymbol attribute for a locked symbol.static intNHOLDALLISymbol attribute for a function, which should not be evaluated numericallystatic intNHOLDFIRSTISymbol attribute for a function, where the first argument should not be evaluated numericallystatic intNHOLDRESTISymbol attribute for a function, where the rest of the arguments should not be evaluated numerically.static intNO_EVAL_ENGINE_ATTRIBUTEA mask which tests if any evaluation engine attribute is setsstatic intNOATTRIBUTEISymbol attribute which means that no attribute is set.static intNUMERICFUNCTIONISymbol attribute for a numeric functionstatic intONEIDENTITYISymbol attribute for a function transformation: f(x) ==> xstatic intORDERLESSISymbol attribute for a commutative function transformation.static intPACKAGE_LOADEDISymbol flag for a symbol which has already loaded it's package definitionstatic intPROTECTEDISymbol attribute for a symbol where no rule definition should be possiblestatic intREADPROTECTEDISymbol attribute for a symbol where the definition shouldn't be displayedstatic intSEQUENCEHOLDISymbol attribute for a function, where noSequence()argument should be flattend outstatic intSETDELAYED_FLAG_ASSIGNED_VALUEISymbol flag to indicate that the symbols value is defined by SetDelayed-
Fields inherited from interface org.matheclipse.core.interfaces.IExpr
ASTID, BDDEXPRID, BIOSEQUENCEID, BLANKID, BYTEARRAYID, COMPILEFUNCTONID, COMPLEXID, DATAID, DATASETID, DATEOBJECTEXPRID, DISPATCHID, DOUBLECOMPLEXID, DOUBLEID, FILEEXPRID, FITTEDMODELID, FRACTIONID, GEOPOSITIONID, GRAPHEXPRID, IMAGEID, INPUTSTREAMEXPRID, INTEGERID, INTERPOLATEDFUNCTONID, JAVACLASSEXPRID, JAVAOBJECTEXPRID, LINEARSOLVEUNCTONID, METHODSYMBOLID, NUMERICARRAYID, OUTPUTSTREAMEXPRID, PATTERNID, QUANTITYID, SERIESID, SPARSEARRAYID, STRINGID, SYMBOLID, TESTREPORTOBJECT, TESTRESULTOBJECT, TIMEOBJECTEXPRID
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaddAttributes(int attributes)Add the attributes to the existing attributes bit-set.IExprassignedValue()Get theOwnValuesvalue which is assigned to the symbol ornull, if no value is assigned.default voidassignValue(IExpr value)Set theOwnValuesvalue of this variable.voidassignValue(IExpr value, boolean setDelayed)Set theOwnValuesvalue of this variablevoidclear(EvalEngine engine)Clear the associated rules (OwnValues,DownValuesandUpValues) for this symbol but don't clear the attribute flags.voidclearAll(EvalEngine engine)Clear all associated rules (OwnValues,DownValuesandUpValues) and attribute flags for this symbol.voidclearAttributes(int attributes)Remove the attribute flags from the existing attributes bit-set.voidclearEvalFlags(int flags)Remove the evaluation flags from the existing flags bit-set.voidclearValue()Clear theOwnValuesvalue which is assigned to this symbol.booleancontainsRules()Check if ths symbol contains a "DownRule" or "UpRule"RulesDatacreateRulesData(int[] sizes)Create internal rules data structure with precalculated sizes index 0 - number of equal rules inRULESIASTdefinition()Return a list of the rules associated to this symbolStringdefinitionToString()Return the rules associated to this symbol inStringrepresentationdefault IExprevalAsLeadingTerm(ISymbol x, IExpr logx, int cdir)IExprevalDownRule(EvalEngine engine, IExpr expression)Evaluate the given expression for the "down value" rules associated with this symbolIExprevalMessage(String messageName)IExprevalUpRules(IExpr expression, EvalEngine engine)Evaluate the given expression for the "up value" rules (i.e.default IASTf(IExpr arg1)default IASTf(IExpr arg1, IExpr arg2)default IASTf(IExpr arg1, IExpr arg2, IExpr arg3)default IExprget()Deprecated.useassignedValue()insteadintgetAttributes()Get the Attributes of this symbol (i.e.ContextgetContext()Get the context this symbol is assigned to.default StringgetContextSymbolName()Get the full symbol name string with the context prefix included.IExprgetDefaultValue()Get the general default value for this symbol (i.e.IExprgetDefaultValue(int position)Get the default value at the arguments position for this symbol (i.e.RulesDatagetRulesData()Get the pattern matching rules associated with a symbol.StringgetSymbolName()Get the pure symbol name string without the context prefix.booleanhasAssignedSymbolValue()Is a (local or global) value assigned for this symbol?booleanhasFlatAttribute()Does this symbols attribute set contains theFlatattribute?static booleanhasFlatAttribute(int attributes)Does the attributes flag set contains theFLATbit set?booleanhasHoldAllCompleteAttribute()Does this symbols attribute set contains theHOLDALLCOMPLETEattribute?static booleanhasHoldAllCompleteAttribute(int attributes)Does the attributes flag set contains theHOLDALLCOMPLETEbit set?booleanhasListableAttribute()Does this symbols attribute set contains theListableattribute?static booleanhasListableAttribute(int attributes)Does the attributes flag set contains theLISTABLEbit set?booleanhasOneIdentityAttribute()Does this symbols attribute set contains theOneIdentityattribute?booleanhasOrderlessAttribute()Does this symbols attribute set contains theOrderlessattribute?static booleanhasOrderlessAttribute(int attributes)Does this symbols attribute set contains theOrderlessattribute?booleanhasOrderlessFlatAttribute()Does this symbols attribute set contains theFlatandOrderlessattribute?static booleanhasOrderlessFlatAttribute(int attributes)Does the attributes flag set contains theISymbol.FlatandISymbol.Orderlessbits set?default booleanisBooleanFormula()Test if this expression is a boolean formula (i.e.default booleanisConstantAttribute()Test if this expression is a symbol with attributeConstant.default booleanisContext(Context context)Givestrueif this symbol is in thecontext.default booleanisDollarSymbol()booleanisLocked()Givestrueif the system is in server mode and cannot be modifiedbooleanisLocked(boolean packageMode)Givestrueif the system is in server mode and cannot be modifieddefault booleanisNumericFunction(boolean allowList)Test if this expression is a numeric function (i.e.default booleanisNumericFunctionAttribute()default booleanisOneIdentityAttribute()default booleanisProtected()booleanisString(String symbolName)Tests if this symbols name equals the given stringdefault booleanisSymbolID(int... ids)Returnstrue, if this symbol is in the set of definedids.booleanisSymbolName(String name)Returnstrue, if this symbol has the given name.default IExpr[]linear(IExpr variable)If this is a linear expressiona + b * xreturn the addendaat index0and the multiplicantbat index1default IExpr[]linearPower(IExpr variable)If this is an expression of the forma + b * x^nwithninteger, return the addend at index0and the multiplicant at index1and the exponentnat index2.default IExprmapConstantDouble(DoubleFunction<IExpr> function)If this symbol has attributeISymbol.CONSTANTand the symbol's evaluator is of instanceINumericConstant, then apply the constants double value to the given function and return the result, otherwise returnF.NIL.default IExprof(boolean... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....default IExprof(int... args)Evaluate this symbol for the arguments as functionsymbol(F.ZZ(arg1), F.ZZ(arg2), ....default IExprof(String... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....IExprof(EvalEngine engine, Object... args)Evaluate this symbol for the arguments converted toIExprfunctionsymbol(expr1, expr2, ....IExprof(EvalEngine engine, IExpr... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....default IExprof(IExpr... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....IExprof1(EvalEngine engine, IExpr arg, IExpr... parts)Evaluate this symbol for the arguments as functionsymbol(arg, part1, part2, ....default doubleofN(double... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....IExprofNIL(EvalEngine engine, IExpr... args)This method returnsF.NILif no evaluation was possible.default IExprofObject(Object... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....booleanofQ(EvalEngine engine, IExpr... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....booleanofQ(IExpr... args)Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....default intordinal()Get the ordinal number of this built-in symbol in the enumeration of built-in symbols.default IPatternMatcherputDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, boolean packageMode)Associate a new "down value" rule with default priority to this symbol.IPatternMatcherputDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.default IPatternMatcherputDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, boolean packageMode)Associate a new "down value" rule with default priority to this symbol.IPatternMatcherputDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.voidputDownRule(PatternMatcherAndInvoker pmEvaluator)Deprecated.voidputMessage(int setSymbol, String messageName, IStringX message)IPatternMatcherputUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide)Associate a new "up value" rule with default priority to this symbol.IPatternMatcherputUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority)Associate a new "up value" rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.voidreadRules(ObjectInputStream stream)Deserialize the rules associated to this objectIExpr[]reassignSymbolValue(Function<IExpr,IExpr> function, ISymbol functionSymbol, EvalEngine engine)Apply the function to the currently assigned value of the symbol and reassign the result value to the symbol.IExpr[]reassignSymbolValue(IASTMutable ast, ISymbol functionSymbol, EvalEngine engine)Apply the ast to the currently assigned value of the symbol and reassign the result value to the symbol.booleanremoveRule(int setSymbol, boolean equalRule, IExpr leftHandSide, boolean packageMode)Remove the rules associate with this symbol, which equals the givenleftHandSideexpression.voidsetAttributes(int attributes)Set the Attributes of this symbol (i.e.voidsetDefaultValue(int position, IExpr expr)Set the default value at the arguments position for this symbol (i.e.voidsetDefaultValue(IExpr expr)Set the general default value for this symbol (i.e.voidsetRulesData(RulesData rd)booleanwriteRules(ObjectOutputStream stream)Serialize the rule definitions associated to this symbol-
Methods inherited from interface org.hipparchus.CalculusFieldElement
getExponent, isFinite, isInfinite, isNaN, norm, round
-
Methods inherited from interface org.matheclipse.core.interfaces.IExpr
$div, $minus, $plus, $times, $up, abs, accept, accept, accept, accept, acos, acosh, add, add, addEvalFlags, and, apply, apply, argSize, asBaseExp, asCoeffAdd, asCoeffAdd, asCoeffAdd, asCoeffExponent, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffMul, asCoeffMul, asin, asinh, asLeadingTerm, asLeadingTerm, asLeadingTerm, asLeadingTerm, asNumerDenom, asPowersDict, asType, atan, atan2, atanh, base, cancel, cbrt, ceil, compareTo, compareToNumerical, complexArg, conjugate, constantArray, copySign, copySign, copySign, cos, cosh, dec, depth, determinePrecision, divide, divide, egcd, equalsArgs, equalsArgs, equalsAt, equalTernary, equalTo, erf, erfc, eval, eval, evalBinary64, evalComplex, evalDouble, evalf, evalf, evalfc, evalfc, evalNIL, evalNumber, evalReal, evaluate, evaluateHead, evaluateOrElse, exists, exp, expm1, exponent, factory, first, floor, forAll, fresnelC, fresnelS, fullFormString, gaussianIntegers, gcd, getArg, getAt, getField, getOptionalValue, getPi, getReal, greater, greaterEqual, greaterEqualThan, greaterEqualThan, greaterThan, greaterThan, has, has, has, has, hasComplexNumber, hasFree, head, headID, hierarchy, hypergeometric0F1, hypergeometric1F1, hypergeometric2F1, hypot, ifPresent, im, inc, indexOf, indexOf, indexOf, internalFormString, internalJavaString, internalScalaString, intSlot, inverse, isAbs, isAllExpanded, isAlternatives, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAssociation, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isAST0, isAST1, isAST2, isAST3, isASTOrAssociation, isASTSizeGE, isAtom, isBlank, isBooleanFormulaSymbol, isBooleanFunction, isBooleanResult, isBuiltInSymbol, isBuiltInSymbolID, isComparatorFunction, isComparatorFunctionSymbol, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConditionalExpression, isConjugate, isContinuousDistribution, isCoreFunctionSymbol, isCos, isCosh, isDataset, isDefer, isDerivative, isDerivativeAST1, isDirectedInfinity, isDirectedInfinity, isDiscreteDistribution, isDistribution, isE, isEdge, isEmpty, isEmptyIntervalData, isEmptyList, isEqual, isEvalFlagOff, isEvalFlagOn, isEvenResult, isExactNumber, isExcept, isExp, isExpanded, isFactorSqrtExpr, isFalse, isFlatAST, isFraction, isFree, isFree, isFree, isFree, isFreeAST, isFreeAST, isFreeOfPatterns, isFunction, isFunctionID, isGEOrdered, isGTOrdered, isHoldAllCompleteAST, isHoldOrHoldFormOrDefer, isHoldPatternOrLiteral, isHyperbolicFunction, isImaginaryUnit, isIndeterminate, isInexactNumber, isInexactVector, isInfinity, isInteger, isIntegerResult, isInterval, isInterval1, isIntervalData, isInvalid, isLEOrdered, isList, isList, isList, isList1, isList2, isList3, isList4, isListableAST, isListOfEdges, isListOfLists, isListOfMatrices, isListOfPoints, isListOfRules, isListOfRules, isListOfRulesOrAssociation, isListOfStrings, isListOrAssociation, isLog, isLTOrdered, isMachineNumber, isMathematicalIntegerNegative, isMathematicalIntegerNonNegative, isMatrix, isMatrix, isMatrixIgnore, isMember, isMember, isMinusOne, isModule, isModuleOrWithCondition, isNegative, isNegativeImaginaryUnit, isNegativeInfinity, isNegativeResult, isNegativeSigned, isNIL, isNonEmptyList, isNonNegativeResult, isNonZeroComplexResult, isNonZeroRealResult, isNot, isNotDefined, isNotEmpty, isNumber, isNumberOrInfinity, isNumEqualInteger, isNumEqualRational, isNumeric, isNumericArgument, isNumericArgument, isNumericArray, isNumericAST, isNumericFunction, isNumericFunction, isNumericFunction, isNumericFunction, isNumericMode, isNumIntValue, isOne, isONE, isOneIdentityAST1, isOptional, isOptionsPattern, isOr, isOrderlessAST, isPattern, isPatternDefault, isPatternExpr, isPatternMatchingFunction, isPatternOptional, isPatternSequence, isPatternTest, isPi, isPiecewise, isPlus, isPlus2, isPlus3, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPolynomialStruct, isPositive, isPositiveResult, isPossibleZero, isPower, isPowerReciprocal, isPredicateFunctionSymbol, isPresent, isPureFunction, isQuantity, isRational, isRationalResult, isRationalValue, isReal, isRealConstant, isRealMatrix, isRealNumber, isRealResult, isRealVector, isReNegativeResult, isRepeated, isRePositiveResult, isRGBColor, isRule, isRuleAST, isRuleDelayed, isSame, isSame, isSameHeadSizeGE, isSequence, isSin, isSinh, isSlot, isSlotSequence, isSpan, isSparseArray, isSqrt, isSqrtExpr, isString, isStringIgnoreCase, isSubscript, isSymbol, isSymbolOrPattern, isTan, isTanh, isTimes, isTimes2, isTimes3, isTrigFunction, isTrue, isUndefined, isUnequalResult, isUnevaluated, isUnit, isValue, isVariable, isVariable, isVector, isWith, isZero, isZERO, isZeroResult, last, leadTerm, leadTerm, leafCount, leafCountSimplify, less, lessEqual, lessEqualThan, lessEqualThan, lessThan, lessThan, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, log, log10, log1p, lower, makeAST, makeList, mapExpr, mapMatrixColumns, mapThread, minus, mod, most, multiply, multiply, multiply, multiplyDistributed, negate, negative, newInstance, normal, one, opposite, optional, or, orElse, orElseGet, orElseThrow, partition, partitionPlus, partitionTimes, plus, pow, pow, pow, power, power, re, reciprocal, remainder, remainder, replaceAll, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, rest, rewrite, rint, rootN, roundExpr, scalb, second, sign, signum, sin, sinCos, sinh, sinhCosh, size, sqr, sqrt, subs, subtract, subtract, sum, tan, tanh, times, timesDistributed, toBooleanMatrix, toBooleanVector, toBooleValueVector, toByteMatrix, toComplexMatrix, toComplexVector, toDegrees, toDoubleDefault, toDoubleDefault, toDoubleMatrix, toDoubleMatrixIgnore, toDoubleVector, toDoubleVectorIgnore, together, toIntDefault, toIntDefault, toIntMatrix, toIntVector, toLongDefault, toLongDefault, toMMA, toNumber, toNumber, topHead, toRadians, toRealMatrix, toRealMatrixIgnore, toRealVector, toScript, toScriptFactory, toWolframString, trigsimp, ulp, unequalTo, unitStep, upper, variables2Slots, zero
-
-
-
-
Field Detail
-
CONSTANT
static final int CONSTANT
ISymbol attribute to indicate that a symbol has a constant value- See Also:
- Constant Field Values
-
FLAT
static final int FLAT
ISymbol attribute for an associative function transformation. The evaluation of the function will flatten the arguments list- See Also:
- Constant Field Values
-
HOLDFIRST
static final int HOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluated- See Also:
- Constant Field Values
-
HOLDREST
static final int HOLDREST
ISymbol attribute for a function, where only the first argument should be evaluated- See Also:
- Constant Field Values
-
HOLDALL
static final int HOLDALL
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
HOLDCOMPLETE
static final int HOLDCOMPLETE
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
SEQUENCEHOLD
static final int SEQUENCEHOLD
ISymbol attribute for a function, where noSequence()argument should be flattend out- See Also:
- Constant Field Values
-
HOLDALLCOMPLETE
static final int HOLDALLCOMPLETE
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
LISTABLE
static final int LISTABLE
ISymbol attribute for a function with lists as arguments- See Also:
- Constant Field Values
-
NHOLDFIRST
static final int NHOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluated numerically- See Also:
- Constant Field Values
-
NHOLDREST
static final int NHOLDREST
ISymbol attribute for a function, where the rest of the arguments should not be evaluated numerically.- See Also:
- Constant Field Values
-
NHOLDALL
static final int NHOLDALL
ISymbol attribute for a function, which should not be evaluated numerically- See Also:
- Constant Field Values
-
NOATTRIBUTE
static final int NOATTRIBUTE
ISymbol attribute which means that no attribute is set.- See Also:
- Constant Field Values
-
NUMERICFUNCTION
static final int NUMERICFUNCTION
ISymbol attribute for a numeric function- See Also:
- Constant Field Values
-
PACKAGE_LOADED
static final int PACKAGE_LOADED
ISymbol flag for a symbol which has already loaded it's package definition- See Also:
- Constant Field Values
-
ONEIDENTITY
static final int ONEIDENTITY
ISymbol attribute for a function transformation: f(x) ==> x- See Also:
- Constant Field Values
-
ORDERLESS
static final int ORDERLESS
ISymbol attribute for a commutative function transformation. The evaluation of the function will sort the arguments.- See Also:
- Constant Field Values
-
FLATORDERLESS
static final int FLATORDERLESS
ISymbol attribute combination (ISymbol.FLAT and ISymbol.ORDERLESS)- See Also:
- Constant Field Values
-
PROTECTED
static final int PROTECTED
ISymbol attribute for a symbol where no rule definition should be possible- See Also:
- Constant Field Values
-
READPROTECTED
static final int READPROTECTED
ISymbol attribute for a symbol where the definition shouldn't be displayed- See Also:
- Constant Field Values
-
LOCKED
static final int LOCKED
ISymbol attribute for a locked symbol. If a symbol is once locked, you cannot reset the lock.- See Also:
- Constant Field Values
-
NO_EVAL_ENGINE_ATTRIBUTE
static final int NO_EVAL_ENGINE_ATTRIBUTE
A mask which tests if any evaluation engine attribute is sets- See Also:
- Constant Field Values
-
DIRTY_FLAG_ASSIGNED_VALUE
static final int DIRTY_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is used by a method- See Also:
- Constant Field Values
-
SETDELAYED_FLAG_ASSIGNED_VALUE
static final int SETDELAYED_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is defined by SetDelayed- See Also:
- Constant Field Values
-
-
Method Detail
-
addAttributes
void addAttributes(int attributes)
Add the attributes to the existing attributes bit-set.- Parameters:
attributes-
-
assignValue
default void assignValue(IExpr value)
Set theOwnValuesvalue of this variable. The value is assigned with the '=' operator.- Parameters:
value- the assigned 'right-hand-side' expression
-
assignValue
void assignValue(IExpr value, boolean setDelayed)
Set theOwnValuesvalue of this variable- Parameters:
value- the assigned 'right-hand-side' expressionsetDelayed- iftrue, the value is assigned with the ':=' SetDelayed operator otherwise with the '=' operator.
-
assignedValue
IExpr assignedValue()
Get theOwnValuesvalue which is assigned to the symbol ornull, if no value is assigned.- Returns:
null, if no value is assigned.
-
clear
void clear(EvalEngine engine)
Clear the associated rules (OwnValues,DownValuesandUpValues) for this symbol but don't clear the attribute flags.- Parameters:
engine- the evaluation engine
-
clearValue
void clearValue()
Clear theOwnValuesvalue which is assigned to this symbol.
-
clearAll
void clearAll(EvalEngine engine)
Clear all associated rules (OwnValues,DownValuesandUpValues) and attribute flags for this symbol.- Parameters:
engine- the evaluation engine
-
clearAttributes
void clearAttributes(int attributes)
Remove the attribute flags from the existing attributes bit-set.- Parameters:
attributes-
-
clearEvalFlags
void clearEvalFlags(int flags)
Remove the evaluation flags from the existing flags bit-set.- Parameters:
flags-
-
containsRules
boolean containsRules()
Check if ths symbol contains a "DownRule" or "UpRule"- Returns:
trueif this symbol contains a "DownRule" or "UpRule"
-
createRulesData
RulesData createRulesData(int[] sizes)
Create internal rules data structure with precalculated sizes- index 0 - number of equal rules in
RULES
- Parameters:
sizes-
- index 0 - number of equal rules in
-
definition
IAST definition()
Return a list of the rules associated to this symbol- Returns:
-
definitionToString
String definitionToString() throws IOException
Return the rules associated to this symbol inStringrepresentation- Returns:
- the
Stringrepresentation of the symbol definition - Throws:
IOException
-
evalDownRule
IExpr evalDownRule(EvalEngine engine, IExpr expression)
Evaluate the given expression for the "down value" rules associated with this symbol- Parameters:
engine-expression-- Returns:
F.NILif no evaluation was possible
-
evalUpRules
IExpr evalUpRules(IExpr expression, EvalEngine engine)
Evaluate the given expression for the "up value" rules (i.e. defined with UpSet and UpsetDelayed) associated with this symbol.- Parameters:
expression-engine-- Returns:
F.NILif no evaluation was possible
-
get
@Deprecated default IExpr get()
Deprecated.useassignedValue()insteadGet the value which is assigned to the symbol ornull, if no value is assigned.- Returns:
null, if no value is assigned.
-
getAttributes
int getAttributes()
Get the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)- Returns:
- See Also:
FLAT
-
getContext
Context getContext()
Get the context this symbol is assigned to.- Returns:
-
getDefaultValue
IExpr getDefaultValue()
Get the general default value for this symbol (i.e.1is the default value forTimes,0is the default value forPlus). The general default value is used in pattern-matching for expressions likea_. * b_. + c_- Returns:
- the default value or
F.NILif undefined.
-
getDefaultValue
IExpr getDefaultValue(int position)
Get the default value at the arguments position for this symbol (i.e.1is the default value forPoweratposition2). The default value is used in pattern-matching for expressions likea ^ b_.- Parameters:
position- the position for the default value- Returns:
- the default value or
F.NILif undefined.
-
getRulesData
RulesData getRulesData()
Get the pattern matching rules associated with a symbol.RulesDatacontainsDownValuesandUpValuesrules for pattern matching. Note:OwnValuesare directly stored in a symbol.- Returns:
nullif no rules are defined
-
getSymbolName
String getSymbolName()
Get the pure symbol name string without the context prefix.- Returns:
-
getContextSymbolName
default String getContextSymbolName()
Get the full symbol name string with the context prefix included.- Returns:
-
hasAssignedSymbolValue
boolean hasAssignedSymbolValue()
Is a (local or global) value assigned for this symbol?- Returns:
trueif this symbol has an assigned value.
-
hasFlatAttribute
boolean hasFlatAttribute()
Does this symbols attribute set contains theFlatattribute?- Returns:
trueif this symbols attribute set contains theFlatattribute.
-
hasHoldAllCompleteAttribute
boolean hasHoldAllCompleteAttribute()
Does this symbols attribute set contains theHOLDALLCOMPLETEattribute?- Returns:
-
hasListableAttribute
boolean hasListableAttribute()
Does this symbols attribute set contains theListableattribute?- Returns:
trueif this symbols attribute set containsThetaListableattribute.
-
hasFlatAttribute
static boolean hasFlatAttribute(int attributes)
Does the attributes flag set contains theFLATbit set?- Returns:
trueif this attribute set contains theISymbol.Flatattribute.
-
hasHoldAllCompleteAttribute
static boolean hasHoldAllCompleteAttribute(int attributes)
Does the attributes flag set contains theHOLDALLCOMPLETEbit set?- Parameters:
attributes-- Returns:
-
hasListableAttribute
static boolean hasListableAttribute(int attributes)
Does the attributes flag set contains theLISTABLEbit set?- Parameters:
attributes-- Returns:
-
hasOrderlessAttribute
static boolean hasOrderlessAttribute(int attributes)
Does this symbols attribute set contains theOrderlessattribute?- Returns:
trueif this symbols attribute set contains theOrderlessattribute.
-
hasOrderlessFlatAttribute
static boolean hasOrderlessFlatAttribute(int attributes)
Does the attributes flag set contains theISymbol.FlatandISymbol.Orderlessbits set?- Returns:
trueif this attribute set contains theISymbol.FlatandISymbol.Orderlessattribute.
-
hasOneIdentityAttribute
boolean hasOneIdentityAttribute()
Does this symbols attribute set contains theOneIdentityattribute?- Returns:
trueif this symbols attribute set contains theOneIdentityattribute.
-
hasOrderlessAttribute
boolean hasOrderlessAttribute()
Does this symbols attribute set contains theOrderlessattribute?- Returns:
trueif this symbols attribute set contains theOrderlessattribute.
-
hasOrderlessFlatAttribute
boolean hasOrderlessFlatAttribute()
Does this symbols attribute set contains theFlatandOrderlessattribute?- Returns:
trueif this symbols attribute set contains theFlatand theOrderlessattribute.
-
isBooleanFormula
default boolean isBooleanFormula()
Test if this expression is a boolean formula (i.e. a symbol or a boolean functionAnd, Equivalent, Nand, Nor, Not, Or, Xorwhere all arguments are also "boolean formulas")- Specified by:
isBooleanFormulain interfaceIExpr- Returns:
true, if the given expression is a boolean formula or a symbol.- See Also:
IExpr.isRealResult()
-
isConstantAttribute
default boolean isConstantAttribute()
Description copied from interface:IExprTest if this expression is a symbol with attributeConstant. Therefore numbers returnfalsefor this method!- Specified by:
isConstantAttributein interfaceIExpr- Returns:
- See Also:
IExpr.isRealResult(),IExpr.isNumericFunction(boolean)
-
isContext
default boolean isContext(Context context)
Givestrueif this symbol is in thecontext.- Returns:
-
isDollarSymbol
default boolean isDollarSymbol()
- Returns:
trueif this is of typeIBuiltInSymboland the symbol name starts with a '$';falseotherwise.
-
isLocked
boolean isLocked()
Givestrueif the system is in server mode and cannot be modified- Returns:
-
isLocked
boolean isLocked(boolean packageMode)
Givestrueif the system is in server mode and cannot be modified- Returns:
-
isNumericFunction
default boolean isNumericFunction(boolean allowList)
Description copied from interface:IExprTest if this expression is a numeric function (i.e. a number, a symbolic constant or a function (with attribute NumericFunction) where all arguments are also "numeric functions")- Specified by:
isNumericFunctionin interfaceIExpr- Parameters:
allowList- iftrueaList(...)AST is seen, as if it has attributeNUMERICFUNCTION- Returns:
true, if the given expression is a numeric function or value.- See Also:
IExpr.isRealResult()
-
isNumericFunctionAttribute
default boolean isNumericFunctionAttribute()
-
isOneIdentityAttribute
default boolean isOneIdentityAttribute()
-
isProtected
default boolean isProtected()
-
isString
boolean isString(String symbolName)
Tests if this symbols name equals the given string
-
isSymbolName
boolean isSymbolName(String name)
Returnstrue, if this symbol has the given name. The comparison of the symbols name with the given name is done according to theConfig.PARSER_USE_LOWERCASE_SYMBOLSsetting.- Parameters:
name- the symbol name- Returns:
-
isSymbolID
default boolean isSymbolID(int... ids)
Returnstrue, if this symbol is in the set of definedids.- Parameters:
ids- the symbol ordinal number- Returns:
- See Also:
ID
-
linear
default IExpr[] linear(IExpr variable)
Description copied from interface:IExprIf this is a linear expressiona + b * xreturn the addendaat index0and the multiplicantbat index1
-
linearPower
default IExpr[] linearPower(IExpr variable)
Description copied from interface:IExprIf this is an expression of the forma + b * x^nwithninteger, return the addend at index0and the multiplicant at index1and the exponentnat index2.- Specified by:
linearPowerin interfaceIExpr- Parameters:
variable- the variablexin the formula- Returns:
nullif this is not an expression of the forma+b*x^n
-
mapConstantDouble
default IExpr mapConstantDouble(DoubleFunction<IExpr> function)
If this symbol has attributeISymbol.CONSTANTand the symbol's evaluator is of instanceINumericConstant, then apply the constants double value to the given function and return the result, otherwise returnF.NIL.- Parameters:
function- applys the function to adoublevalue, resulting in an object of typeIExpr.- Returns:
- the resulting expression from the function or
F.NIL. - See Also:
org.matheclipse.core.reflection.system.Abs,org.matheclipse.core.reflection.system.Ceiling,org.matheclipse.core.reflection.system.Floor
-
of
IExpr of(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN).- Parameters:
engine- the current evaluation engineargs- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
IExpr of(EvalEngine engine, Object... args)
Evaluate this symbol for the arguments converted toIExprfunctionsymbol(expr1, expr2, .... ,exprN).- Parameters:
engine- the current evaluation engineargs- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression
-
of1
IExpr of1(EvalEngine engine, IExpr arg, IExpr... parts)
Evaluate this symbol for the arguments as functionsymbol(arg, part1, part2, .... , partN).- Parameters:
engine- the current evaluation enginearg- the main argumentparts- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
default IExpr of(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN).- Parameters:
args- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
default IExpr of(int... args)
Evaluate this symbol for the arguments as functionsymbol(F.ZZ(arg1), F.ZZ(arg2), .... ,F.ZZ(argN))by converting the args toIIntegerobjects.- Parameters:
args-- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
ofN
default double ofN(double... args) throws ArgumentTypeExceptionEvaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN), Theargsare converted from Java double toINumvalues.- Parameters:
args-- Returns:
- Throws:
ArgumentTypeException
-
of
default IExpr of(String... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN), Theargsare converted from JavaStringtoIStringXvalues.- Parameters:
args- the string arguments of the function- Returns:
-
of
default IExpr of(boolean... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN), Theargsare converted from Java boolean toS.TrueorS.Falsevalues.- Parameters:
args-- Returns:
-
ofNIL
IExpr ofNIL(EvalEngine engine, IExpr... args)
This method returnsF.NILif no evaluation was possible. Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN).- Parameters:
engine- the current evaluation engineargs- the arguments for which this function symbol should be evaluated- Returns:
F.NILif no evaluation was possible.
-
ofQ
boolean ofQ(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)to a boolean value. If the result isn't a boolean value returnfalse.- Parameters:
engine- the current evaluation engineargs- the arguments for which this function symbol should be evaluated- Returns:
- if the result isn't a boolean value return
false.
-
ofQ
boolean ofQ(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)to a boolean value. If the result isn't a boolean value returnfalse.- Parameters:
args- the arguments for which this function symbol should be evaluated- Returns:
- if the result isn't a boolean value return
false.
-
ofObject
default IExpr ofObject(Object... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN), The objects are converted from Java form to IExpr for according to methodObject2Expr.convert(Object, boolean, boolean).- Parameters:
args- the objects which should be used as arguments- Returns:
-
ordinal
default int ordinal()
Get the ordinal number of this built-in symbol in the enumeration of built-in symbols. If this is no built-in symbol return-1(ID.UNKNOWN)- Returns:
-
putDownRule
default IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-packageMode-trueif we are on "package mode"- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-priority- the priority of the rulepackageMode-trueif we are on "package mode"- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
default IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-packageMode-trueif we are on "package mode"- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-priority- the priority of the rulepackageMode-trueif we are on "package mode"- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
@Deprecated void putDownRule(PatternMatcherAndInvoker pmEvaluator)
Deprecated.Associate a new rule, which invokes a method, to this symbol.
Deprecated: don't use dynamically called methods.
- Parameters:
pmEvaluator-
-
putUpRule
IPatternMatcher putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide)
Associate a new "up value" rule with default priority to this symbol.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putUpRule
IPatternMatcher putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority)
Associate a new "up value" rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayedwas used for defining this ruleequalRule-trueif the leftHandSide could be matched with equalityleftHandSide-rightHandSide-priority- the priority of the rule- Returns:
nullif no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
readRules
void readRules(ObjectInputStream stream) throws IOException, ClassNotFoundException
Deserialize the rules associated to this object- Parameters:
stream-- Throws:
IOExceptionClassNotFoundException
-
reassignSymbolValue
IExpr[] reassignSymbolValue(Function<IExpr,IExpr> function, ISymbol functionSymbol, EvalEngine engine)
Apply the function to the currently assigned value of the symbol and reassign the result value to the symbol. Used for functions likeAppendTo, AssociateTo, Decrement, Increment, PrependTo,...- Parameters:
function- the function which should be appliedfunctionSymbol- if this method throws an exception the symbol will be displayed in the exceptions messageengine- the evaluation engine- Returns:
- an array with the currently assigned value of the symbol and the new calculated value
of the symbol or
nullif the reassignment isn't possible.
-
reassignSymbolValue
IExpr[] reassignSymbolValue(IASTMutable ast, ISymbol functionSymbol, EvalEngine engine)
Apply the ast to the currently assigned value of the symbol and reassign the result value to the symbol. Used for functions like AppendTo, Decrement, Increment,...- Parameters:
ast-ast- the ast which should be evaluated by replacing the first argument with the current value of the symbolfunctionSymbol- if this method throws an exception the symbol will be displayed in the exceptions messageengine- the evaluation engine- Returns:
- an array with the currently assigned value of the symbol and the new calculated value
of the symbol or
nullif the reassignment isn't possible.
-
removeRule
boolean removeRule(int setSymbol, boolean equalRule, IExpr leftHandSide, boolean packageMode)Remove the rules associate with this symbol, which equals the givenleftHandSideexpression.- Parameters:
setSymbol-equalRule-leftHandSide-packageMode-- Returns:
trueif a rule could be removed,falseotherwise
-
setAttributes
void setAttributes(int attributes)
Set the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)- Parameters:
attributes- the Attributes of this symbol
-
setDefaultValue
void setDefaultValue(IExpr expr)
Set the general default value for this symbol (i.e.1is the default value forTimes,0is the default value forPlus). The general default value is used in pattern-matching for expressions likea_. * b_. + c_- Parameters:
expr- the general default value- See Also:
getDefaultValue()
-
setDefaultValue
void setDefaultValue(int position, IExpr expr)Set the default value at the arguments position for this symbol (i.e.1is the default value forPoweratposition2). The default value is used in pattern-matching for expressions likea ^ b_.- Parameters:
position- the position for the default valueexpr- the default value for the given position- See Also:
getDefaultValue(int)
-
setRulesData
void setRulesData(RulesData rd)
-
writeRules
boolean writeRules(ObjectOutputStream stream) throws IOException
Serialize the rule definitions associated to this symbol- Parameters:
stream-- Returns:
falseif the symbol contains no rule definion.- Throws:
IOException
-
evalAsLeadingTerm
default IExpr evalAsLeadingTerm(ISymbol x, IExpr logx, int cdir)
- Specified by:
evalAsLeadingTermin interfaceIExpr
-
-