MathNot , MathAnd , MathOr , BitAnd, BitOr, BitXor , Equals , GreaterThan, LessThan , Math... , Fast... , ShiftLeft, ShiftRight .

Built-in (core) functions

Yacas comes with a small core of built-in functions and a large library of user-defined functions. It is important for a developer to know which functions are built-in and cannot be redefined or Retract-ed. 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:

MathNot built-in logical "not"
MathAnd built-in logical "and"
MathOr built-in logical "or"
BitAnd, BitOr, BitXor bitwise arithmetic
Equals built-in equality check
GreaterThan, LessThan arithmetic predicates
Math... arbitrary-precision math functions
Fast... double-precision math functions
ShiftLeft, ShiftRight built-in bit shifts

SetCommand(LispSubtract, "MathSubtract");
Here LispSubtract is the Yacas internal name for the function and MathSubtract is the name visible to the Yacas language.

Built-in bodied functions and infix operators are declared in the same file.


MathNot -- built-in logical "not"

Internal function
Calling format:
MathNot(expression)

MathNot(expression) : Returns "False" if "expression" evaluates to "True", and vice versa.


MathAnd -- built-in logical "and"

Calling format:
MathAnd(...)

Lazy logical And: returns True if all args evaluate to True, and does this by looking at first, and then at the second argument, until one is False. If one is False it immediately returns False without evaluating the rest. This is faster, but also means that none of the arguments should cause side effects when they are evaluated.


MathOr -- built-in logical "or"

Internal function
Calling format:
MathOr(...)

MathOr is the basic logical "or" function. Similarly to And, it is lazy-evaluated. And(...) and Or(...) do also exist. You can define 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, BitOr, BitXor -- bitwise arithmetic

Internal function
Calling format:
BitAnd(n,m), BitOr(n,m), BitXor(n,m)

BitAnd(n,m), BitOr(n,m), BitXor(n,m) : return bitwise and, or and xor of two numbers.


Equals -- built-in equality check

Internal function
Calling format:
Equals(a,b)

Equals(a,b) : Compares evaluated a and b recursively (stepping into expressions). so "Equals(a,b)" returns "True" if the expressions would be printed exactly the same, and "False" otherwise.


GreaterThan, LessThan -- arithmetic predicates

Internal function
Calling format:
LessThan(a,b), GreaterThan(a,b)

LessThan(a,b), GreaterThan(a,b) : Comparing numbers.


Math... -- arbitrary-precision math functions

Internal function
Calling format:
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), MathMod(x,y), 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)

Calculation of sin,cos,tan etc. of x. x HAS to be a number. The reason Math is prepended to the names is you might want to derive equivalent non-evaluating functions. The Math... versions require the arguments to be numbers.


Fast... -- double-precision math functions

Internal function
Calling format:
FastExp(x), FastLog(x) (Natural logarithm), FastPower(x,y), FastSin(x), FastCos(x), FastTan(x), FastArcSin(x), FastArcCos(x), FastArcTan(x) :

Versions of these functions using the internal c version. These should then at least be faster than the arbitrary precision versions.


ShiftLeft, ShiftRight -- built-in bit shifts

Internal function
Calling format:
ShiftLeft(expr,bits)
ShiftRight(expr,bits)

Description:
Shift bits to the left or to the right.