MathNot | built-in logical "not" |
MathAnd | built-in logical "and" |
MathOr | built-in logical "or" |
BitAnd, BitOr, BitXor | bitwise arithmetic |
Equals | check equality |
GreaterThan, LessThan | comparison predicates |
Math... | arbitrary-precision math functions |
Fast... | double-precision math functions |
ShiftLeft, ShiftRight | built-in bit shifts |
IsPromptShown | test for the Yacas prompt option |
MathLibrary | obtain current math library name |
It is important for a developer to know which functions are built-in and cannot be redefined or Retract-ed. Also, core functions may be somewhat faster to execute than functions defined in the script library. All core functions are listed in the file yacasapi.cpp in the src/ subdirectory of the Yacas source tree. The declarations typically look like this:
SetCommand(LispSubtract, "MathSubtract"); |
MathNot(expression) |
MathAnd(...) |
MathOr(...) |
MathOr is the basic logical "or" function. Similarly to And, it is lazy-evaluated. And(...) and Or(...) do also exist, defined in the script library. You can redefine them as infix operators yourself, so you have the choice of precedence. In the standard scripts they are in fact declared as infix operators, so you can write expr1 And expr.
BitAnd(n,m) BitOr(n,m) BitXor(n,m) |
Equals(a,b) |
LessThan(a,b), GreaterThan(a,b) |
In> LessThan(1,1) Out> False; In> LessThan("a","b") Out> True; |
MathGcd(n,m) (Greatest Common Divisor), MathAdd(x,y), MathSubtract(x,y), MathMultiply(x,y), MathDivide(x,y), MathSqrt(x) (square root), MathFloor(x), MathCeil(x), MathAbs(x), MathExp(x), MathLog(x) (natural logarithm), MathPower(x,y), MathSin(x), MathCos(x), MathTan(x), MathArcSin(x), MathArcCos(x), MathArcTan(x), MathDiv(x,y), MathMod(x,y)
FastExp(x), FastLog(x) (natural logarithm), FastPower(x,y), FastSin(x), FastCos(x), FastTan(x), FastArcSin(x), FastArcCos(x), FastArcTan(x)
ShiftLeft(expr,bits) ShiftRight(expr,bits) |
IsPromptShown() |
MathLibrary() |
Possible names are "Internal" and "Gmp", indicating the internal math library libyacasnumbers and the GNU Multiple Precision library libgmp.
In> MathLibrary() Out> "Internal"; |
= And ApplyPure ArrayCreate ArrayGet ArraySet ArraySize Atom Berlekamp BitAnd BitOr BitXor Bodied CTokenizer Check Clear CommonLispTokenizer Concat ConcatStrings CurrentFile CurrentLine DefLoad DefLoadFunction DefaultDirectory DefaultTokenizer Delete DestructiveDelete DestructiveInsert DestructiveReplace DestructiveReverse DllEnumerate DllLoad DllUnload Equals Eval FastArcCos FastArcSin FastArcTan FastAssoc FastCos FastExp FastLog FastPower FastSin FastTan FindFile FindFunction FlatCopy FromBase FromFile FromString FullForm GarbageCollect GenericTypeName GetExtraInfo GetPrecision GreaterThan Head Hold HoldArg If Infix Insert IsAtom IsBodied IsBound IsFunction IsGeneric IsInfix IsInteger IsList IsNumber IsPostfix IsPrefix IsString LazyGlobal LeftPrecedence Length LessThan LispRead LispReadListed List Listify Load Local LocalSymbols MacroClear MacroLocal MacroRule MacroRuleBase MacroRuleBaseListed MacroRulePattern MacroSet MathAbs MathAdd MathAnd MathArcCos MathArcSin MathArcTan MathCeil MathCos MathDiv MathDivide MathExp MathFac MathFloor MathGcd MathLibrary MathLog MathMod MathMultiply MathNot MathNth MathOr MathPi MathPower MathSin MathSqrt MathSubtract MathTan MaxEvalDepth Not OpLeftPrecedence OpPrecedence OpRightPrecedence Or PatchLoad PatchString PatternCreate PatternMatches Postfix Precision Prefix PrettyPrinter Prog Read ReadToken Replace Retract RightAssociative RightPrecedence Rule RuleBase RuleBaseArgList RuleBaseDefined RuleBaseListed RulePattern Secure Set SetExtraInfo SetStringMid ShiftLeft ShiftRight String StringMid Subst SystemCall Tail ToBase ToFile ToString TraceExp TraceRule TraceStack Type UnFence UnList Use Version While Write WriteString XmlExplodeTag XmlTokenizer ` |
In addition, the following functions are declared with special syntax and precedence:
@ --- prefix (prec. 0).
BackQuote --- bodied (prec. KMaxPrecedence).
FromFile --- bodied (prec. KMaxPrecedence).
FromString --- bodied (prec. KMaxPrecedence).
LocalSymbols --- bodied (prec. KMaxPrecedence).
MacroRule --- bodied (prec. KMaxPrecedence).
MacroRulePattern --- bodied (prec. KMaxPrecedence).
Rule --- bodied (prec. KMaxPrecedence).
RulePattern --- bodied (prec. KMaxPrecedence).
Subst --- bodied (prec. KMaxPrecedence).
ToFile --- bodied (prec. KMaxPrecedence).
ToString --- bodied (prec. KMaxPrecedence).
TraceRule --- bodied (prec. KMaxPrecedence).
While --- bodied (prec. KMaxPrecedence).
_ --- prefix (prec. 0).
_ --- infix (prec. 0).
` --- prefix (prec. 0).