fexpr_builtin.h – builtin symbols¶
This module defines symbol names with a predefined meaning for use in symbolic expressions. These symbols will eventually all support LaTeX rendering as well as symbolic and numerical evaluation (where applicable).
By convention, all builtin symbol names are at least two characters long and start with an uppercase letter. Single-letter symbol names and symbol names beginning with a lowercase letter are reserved for variables.
For any builtin symbol name Symbol, the header file
fexpr_builtin.h defines a C constant FEXPR_Symbol as an
index to a builtin symbol table.
The symbol will be documented as Symbol below.
C helper functions¶
-
slong
fexpr_builtin_lookup(const char *s)¶ Returns the internal index used to encode the builtin symbol with name s in expressions. If s is not the name of a builtin symbol, returns -1.
Variables and iteration¶
Expressions involving the following symbols have a special role in binding variables.
-
For¶ Generator expression. This is a syntactical construct which does not represent a mathematical object on its own. In general,
For(x, ...)defines the symbolxas a locally bound variable in the scope of the parent expression. The following arguments...specify an evaluation range, set or point. Their interpretation depends on the parent operator. The following cases are possible.Case 1:
For(x, S)specifies iteration or comprehension forxranging over the values of the setS. This interpretation is used in operators that aggregate values over a set. TheForexpression may be followed by a filter predicateP(x)restricting the range to a subset ofS. Examples:Set(f(x), For(x, S))denotes \(\{f(x) : x \in S\}\).Set(f(x), For(x, S), P(x))denotes \(\{f(x) : x \in S \operatorname{and} P(x)\}\).Sum(f(x), For(x, S))denotes \(\sum_{x \in S} f(x)\).Sum(f(x), For(x, S), P(x))denotes \(\sum_{x \in S, \, P(x)} f(x)\).Case 2:
For(x, a, b)specifies thatxranges between the endpointsaandbin the context ofSum,Product,Integral, and similar operators. Examples:Sum(f(n), For(n, a, b))denotes \(\sum_{n=a}^b f(n)\). The iteration is empty if \(b < a\).Integral(f(x), For(x, a, b))denotes \(\int_a^b f(x) dx\), where the integral follows a straight-line path from a to b. Swapping a and b negates the value.Case 3:
For(x, a)specifies thatxapproaches the pointain the context ofLimit-type operator, or differentiation with respect toxat the pointain the context of aDerivative-type operator. Examples:Derivative(f(x), For(x, a))denotes \(f'(a)\).Limit(f(x), For(x, a))denotes \(\lim_{x \to a} f(x)\).Case 4:
For(x, a, n)specifies differentiation with respect toxat the pointato ordernin the context of aDerivative-type operator. Examples:Derivative(f(x), For(x, a, n))denotes \(f^{(n)}(a)\).
-
Where¶ Where(f(x), Def(x, a))defines the symbolxas an alias for the expressionaand evaluates the expressionf(x)with this bound value ofx. This is equivalent tof(a). This may be rendered as \(f(x) \; \operatorname{where} x = a\).Where(f(x), Def(f(t), a))defines the symbolfas a function mapping the dummy variablettoa.Where(Add(a, b), Def(Tuple(a, b), T))is a destructuring assignment.
-
Def¶ Definition expression. This is a syntactical construct which does not represent a mathematical object on its own. The
Defexpression is used only within aWhere-expression; see that documentation of that symbol for more examples.Def(x, a)defines the symbolxas an alias for the expressiona.Def(f(x, y, z), a)defines the symbolfas a function of three variables. The dummy variablesx,yandzmay appear within the expressiona.
-
Fun¶ Fun(x, expr)defines an anonymous univariate function mapping the symbolxto the expressionexpr. The symbolxbecomes locally bound within thisFunexpression.
-
Step¶
-
Repeat¶
Booleans and logic¶
-
Equal¶ Equal(a, b), signifying \(a = b\), isTrueifaandbrepresent the same object, andFalseotherwise. This operator can be called with any number of arguments, in which case it evaluates whether all arguments are equal.
-
NotEqual¶ NotEqual(a, b), signifying \(a \ne b\), is equivalent toNot(Equal(a, b)).
-
Same¶ Same(a, b)givesa(or equivalentlyb) ifaandbrepresent the same object, andUndefinedotherwise. This can be used to assert or emphasize that two expressions represent the same value within a formula. This operator can be called with any number of arguments, in which case it asserts that all arguments are equal.
-
True¶ Trueis a logical constant.
-
False¶ Falseis a logical constant.
-
Not¶ Not(x)is the logical negation ofx.
-
And¶ And(x, y)is the logical AND ofxandy. This function can be called with any number of arguments.
-
Or¶ Or(x, y)is the logical OR ofxandy. This function can be called with any number of arguments.
-
Equivalent¶ Equivalent(x, y)denotes the logical equivalence \(x \Leftrightarrow y\). Semantically, this is the same asEqualcalled with logical arguments.
-
Implies¶ Implies(x, y)denotes the logical implication \(x \implies y\).
-
Exists¶ Existence quantifier.
Exists(f(x), For(x, S))denotes \(f(x) \;\text{ for some } x \in S\).Exists(f(x), For(x, S), P(x))denotes \(f(x) \;\text{ for some } x \in S \text{ with } P(x)\).
-
All¶ Universal quantifier.
All(f(x), For(x, S))denotes \(f(x) \;\text{ for all } x \in S\).All(f(x), For(x, S), P(x))denotes \(f(x) \;\text{ for all } x \in S \text{ with } P(x)\).
-
Cases¶ Cases(Case(f(x), P(x)), Case(g(x), Otherwise))denotes:\[\begin{split}\begin{cases} f(x), & P(x)\\g(x), & \text{otherwise}\\ \end{cases}\end{split}\]Cases(Case(f(x), P(x)), Case(g(x), Q(x)), Case(h(x), Otherwise))denotes:\[\begin{split}\begin{cases} f(x), & P(x)\\g(x), & Q(x)\\h(x), & \text{otherwise}\\ \end{cases}\end{split}\]If both \(P(x)\) and \(Q(x)\) are true simultaneously, no ordering is implied; it is assumed that \(f(x)\) and \(g(x)\) give the same value for any such \(x\). More generally, this operator can be called with any number of case distinctions.
If the Otherwise case is omitted, the result is undefined if neither predicate is true.
-
Case¶ See
Cases.
-
Otherwise¶ See
Cases.
Tuples, lists and sets¶
-
Tuple¶
-
List¶
-
Set¶
-
Item¶
-
Element¶
-
NotElement¶
-
EqualAndElement¶
-
Length¶
-
Cardinality¶
-
Concatenation¶
-
Union¶
-
Intersection¶
-
SetMinus¶
-
Subset¶
-
SubsetEqual¶
-
CartesianProduct¶
-
CartesianPower¶
-
Subsets¶ Subsets(S)is the power set \(\mathscr{P}(S)\) comprising all subsets of the setS.
-
Sets¶ Setsis the class \(\operatorname{Sets}\) of all sets.
-
Tuples¶ Tuplesis the class of all tuples.Tuples(S)is the set of all tuples with elements in the setS.Tuples(S, n)is the set of all length-ntuples with elements in the setS.
Numbers and arithmetic¶
Particular numbers¶
-
Pi¶ Piis the constant \(\pi\).
-
NumberI¶ NumberIis the imaginary unit \(i\). The verbose name leavesiandIto be used as a variable names.
-
NumberE¶ NumberEis the base of the natural logarithm \(e\). The verbose name leaveseandEto be used as a variable names.
-
GoldenRatio¶ GoldenRatiois the golden ratio \(\varphi\).
-
Euler¶ Euleris Euler’s constant \(\gamma\).
-
CatalanConstant¶ CatalanConstantis Catalan’s constant \(G\).
-
KhinchinConstant¶ KhinchinConstantis Khinchin’s constant \(K\).
-
GlaisherConstant¶ GlaisherConstantis Glaisher’s constant \(A\).
-
RootOfUnity¶ RootOfUnity(n)is the principal complex n-th root of unity \(\zeta_n = e^{2 \pi i / n}\).RootOfUnity(n, k)is the complex n-th root of unity \(\zeta_n^k\).
Number constructors¶
Remark: the rational number with numerator p and denominator q
can be constructed as Div(p, q).
-
Decimal¶ Decimal(str)gives the rational number specified by the string str in ordinary decimal floating-point notation (for example-3.25e-725).
-
AlgebraicNumberSerialized¶
-
PolynomialRootIndexed¶
-
PolynomialRootNearest¶
-
Enclosure¶
-
Approximation¶
-
Guess¶
-
Unknown¶
Sets of numbers¶
-
NN¶ NNis the set of natural numbers (including 0), \(\mathbb{N}\).
-
ZZ¶ ZZis the set of integers, \(\mathbb{Z}\).
-
QQ¶ QQis the set of rational numbers, \(\mathbb{Q}\).
-
RR¶ RRis the set of real numbers, \(\mathbb{R}\).
-
CC¶ CCis the set of complex numbers, \(\mathbb{C}\).
-
Primes¶ Primesis the set of positive prime numbers, \(\mathbb{P}\)
-
IntegersGreaterEqual¶ IntegersGreaterEqual(x), given an extended real number x, gives the set \(\mathbb{Z}_{\ge x}\) of integers greater than or equal to x.
-
IntegersLessEqual¶ IntegersLessEqual(x), given an extended real number x, gives the set \(\mathbb{Z}_{\le x}\) of integers less than or equal to x.
-
Range¶ Range(a, b), given integers a and b, gives the set \(\{a, a+1, \ldots, b\}\) of integers between a and b. This is the empty set if a is greater than b.
-
AlgebraicNumbers¶ The set of complex algebraic numbers \(\overline{\mathbb{Q}}\).
-
RealAlgebraicNumbers¶ The set of real algebraic numbers \(\overline{\mathbb{Q}}_{\mathbb{R}}\).
-
Interval¶ Interval(a, b), given extended real numbers a and b, gives the closed interval \([a, b]\).
-
OpenInterval¶ OpenInterval(a, b), given extended real numbers a and b, gives the open interval \((a, b)\).
-
ClosedOpenInterval¶ ClosedOpenInterval(a, b), given extended real numbers a and b, gives the closed-open interval \([a, b)\).
-
OpenClosedInterval¶ OpenClosedInterval(a, b), given extended real numbers a and b, gives the closed-open interval \((a, b]\).
-
RealBall¶ RealBall(m, r), given a real number m and an extended real number r, gives the the closed real ball \([m \pm r]\) with center m and radius r.
-
OpenRealBall¶ OpenRealBall(m, r), given a real number m and an extended real number r, gives the the open real ball \((m \pm r)\) with center m and radius r.
-
OpenComplexDisk¶ OpenComplexDisk(m, r), given a complex number m and an extended real number r, gives the open complex disk \(D(m, r)\) with center m and radius r.
-
ClosedComplexDisk¶ ClosedComplexDisk(m, r), given a complex number m and a real number r, gives the closed complex disk \(\overline{D}(m, r)\) with center m and radius r.
-
UpperHalfPlane¶ UpperHalfPlaneis the set \(\mathbb{H}\) of complex numbers with positive imaginary part.
-
UnitCircle¶
-
BernsteinEllipse¶
-
Lattice¶
Infinities and extended numbers¶
-
Infinity¶ Infinityis the positive signed infinity \(\infty\).
-
UnsignedInfinity¶ UnsignedInfinityis the unsigned infinity \(\tilde \infty\).
-
RealSignedInfinities¶ RealSignedInfinitiesis the set of real signed infinities \(\{+\infty, -\infty\}\).
-
ComplexSignedInfinities¶ ComplexSignedInfinitiesis the set of complex signed infinities \(\{e^{i \theta} \cdot \infty : \theta \in \mathbb{R}\}\).
-
RealInfinities¶ RealInfinitiesis the set of real infinities (signed and unsigned) \(\{+\infty, -\infty\} \cup \{\tilde \infty\}\).
-
ComplexInfinities¶ ComplexInfinitiesis the set of complex infinities (signed and unsigned) \(\{e^{i \theta} \cdot \infty : \theta \in \mathbb{R}\} \cup \{\tilde \infty\}\).
-
ExtendedRealNumbers¶ ExtendedRealNumbersis the set of extended real numbers \(\mathbb{R} \cup \{+\infty, -\infty\}\).
-
ProjectiveRealNumbers¶ ProjectiveRealNumbersis the set of projectively extended real numbers \(\mathbb{R} \cup \{\tilde \infty\}\).
-
SignExtendedComplexNumbers¶ SignExtendedComplexNumbersis the set of complex numbers extended with signed infinities \(\mathbb{C} \cup \{e^{i \theta} \cdot \infty : \theta \in \mathbb{R}\}\).
-
ProjectiveComplexNumbers¶ ProjectiveComplexNumbersis the set of projectively extended complex numbers (also known as the Riemann sphere) \(\mathbb{C} \cup \{\tilde \infty\}\).
-
RealSingularityClosure¶ RealSingularityClosureis the Calcium singularity closure for real functions, encompassing real numbers, signed infinities, unsigned infinity, and undefined (u). This set is defined as \(\mathbb{R}_{\text{Sing}} = \mathbb{R} \cup \{+\infty, -\infty\} \cup \{\tilde \infty\} \cup \{ \mathfrak{u} \}\).
-
ComplexSingularityClosure¶ ComplexSingularityClosureis the Calcium singularity closure for complex functions, encompassing complex numbers, signed infinities, unsigned infinity, and undefined (u). This set is defined as \(\mathbb{C}_{\text{Sing}} = \mathbb{C} \cup \{e^{i \theta} \cdot \infty : \theta \in \mathbb{R}\} \cup \{\tilde \infty\} \cup \{ \mathfrak{u} \}\).
Operators and calculus¶
Limits¶
-
Limit¶
-
SequenceLimit¶
-
RealLimit¶
-
LeftLimit¶
-
RightLimit¶
-
ComplexLimit¶
-
MeromorphicLimit¶
-
SequenceLimitInferior¶
-
SequenceLimitSuperior¶
-
AsymptoticTo¶
Matrices and linear algebra¶
-
Matrix¶
-
Row¶
-
Column¶
-
RowMatrix¶
-
ColumnMatrix¶
-
DiagonalMatrix¶
-
Matrix2x2¶
-
ZeroMatrix¶
-
IdentityMatrix¶
-
Det¶
-
Spectrum¶
-
SingularValues¶
-
Matrices¶
-
SL2Z¶
-
PSL2Z¶
-
SpecialLinearGroup¶
-
GeneralLinearGroup¶
-
HilbertMatrix¶
Polynomials, series and rings¶
-
Pol¶
-
Ser¶
-
Polynomial¶
-
Coefficient¶
-
PolynomialDegree¶
-
Polynomials¶
-
PolynomialFractions¶
-
FormalPowerSeries¶
-
FormalLaurentSeries¶
-
FormalPuiseuxSeries¶
-
Zero¶
-
One¶
-
Characteristic¶
-
Rings¶
-
CommutativeRings¶
-
Fields¶
-
QuotientRing¶
-
FiniteField¶
-
EqualQSeriesEllipsis¶
-
IndefiniteIntegralEqual¶
-
QSeriesCoefficient¶
-
Call¶
-
CallIndeterminate¶
Special functions¶
Number parts and step functions¶
-
Abs¶
-
Sign¶
-
Re¶
-
Im¶
-
Arg¶
-
Conjugate¶
-
Csgn¶
-
RealAbs¶
-
Max¶
-
Min¶
-
Floor¶
-
Ceil¶
-
KroneckerDelta¶
Primes and divisibility¶
-
IsOdd¶
-
IsEven¶
-
CongruentMod¶
-
Divides¶
-
Mod¶
-
GCD¶
-
LCM¶
-
XGCD¶
-
IsPrime¶
-
Prime¶
-
PrimePi¶
-
DivisorSigma¶
-
MoebiusMu¶
-
EulerPhi¶
-
DiscreteLog¶
-
LegendreSymbol¶
-
JacobiSymbol¶
-
KroneckerSymbol¶
-
SquaresR¶
-
LiouvilleLambda¶
Elementary functions¶
-
Exp¶
-
Log¶
-
Sin¶
-
Cos¶
-
Tan¶
-
Cot¶
-
Sec¶
-
Csc¶
-
Sinh¶
-
Cosh¶
-
Tanh¶
-
Coth¶
-
Sech¶
-
Csch¶
-
Asin¶
-
Acos¶
-
Atan¶
-
Acot¶
-
Asec¶
-
Acsc¶
-
Asinh¶
-
Acosh¶
-
Atanh¶
-
Acoth¶
-
Asech¶
-
Acsch¶
-
Atan2¶
-
Sinc¶
-
LambertW¶
Combinatorial functions¶
-
SloaneA¶
-
SymmetricPolynomial¶
-
Cyclotomic¶
-
Fibonacci¶
-
BernoulliB¶
-
BernoulliPolynomial¶
-
StirlingCycle¶
-
StirlingS1¶
-
StirlingS2¶
-
EulerE¶
-
EulerPolynomial¶
-
BellNumber¶
-
PartitionsP¶
-
LandauG¶
Gamma function and factorials¶
-
Factorial¶
-
Binomial¶
-
Gamma¶
-
LogGamma¶
-
DoubleFactorial¶
-
RisingFactorial¶
-
FallingFactorial¶
-
HarmonicNumber¶
-
DigammaFunction¶
-
DigammaFunctionZero¶
-
BetaFunction¶
-
BarnesG¶
-
LogBarnesG¶
-
StirlingSeriesRemainder¶
-
LogBarnesGRemainder¶
Orthogonal polynomials¶
-
ChebyshevT¶
-
ChebyshevU¶
-
LegendreP¶
-
JacobiP¶
-
HermiteH¶
-
LaguerreL¶
-
GegenbauerC¶
-
SphericalHarmonicY¶
-
LegendrePolynomialZero¶
-
GaussLegendreWeight¶
Exponential integrals¶
-
Erf¶
-
Erfc¶
-
Erfi¶
-
UpperGamma¶
-
LowerGamma¶
-
IncompleteBeta¶
-
IncompleteBetaRegularized¶
-
LogIntegral¶
-
ExpIntegralE¶
-
ExpIntegralEi¶
-
SinIntegral¶
-
SinhIntegral¶
-
CosIntegral¶
-
CoshIntegral¶
-
FresnelC¶
-
FresnelS¶
Bessel and Airy functions¶
-
AiryAi¶
-
AiryBi¶
-
AiryAiZero¶
-
AiryBiZero¶
-
BesselJ¶
-
BesselI¶
-
BesselY¶
-
BesselK¶
-
HankelH1¶
-
HankelH2¶
-
BesselJZero¶
-
BesselYZero¶
-
CoulombF¶
-
CoulombG¶
-
CoulombH¶
-
CoulombC¶
-
CoulombSigma¶
Hypergeometric functions¶
-
Hypergeometric0F1¶
-
Hypergeometric1F1¶
-
Hypergeometric1F2¶
-
Hypergeometric2F1¶
-
Hypergeometric2F2¶
-
Hypergeometric2F0¶
-
Hypergeometric3F2¶
-
HypergeometricU¶
-
HypergeometricUStar¶
-
HypergeometricUStarRemainder¶
-
Hypergeometric0F1Regularized¶
-
Hypergeometric1F1Regularized¶
-
Hypergeometric1F2Regularized¶
-
Hypergeometric2F1Regularized¶
-
Hypergeometric2F2Regularized¶
-
Hypergeometric3F2Regularized¶
Zeta and L-functions¶
-
RiemannZeta¶
-
RiemannZetaZero¶
-
RiemannHypothesis¶
-
RiemannXi¶
-
HurwitzZeta¶
-
LerchPhi¶
-
PolyLog¶
-
MultiZetaValue¶
-
DirichletL¶
-
DirichletLZero¶
-
DirichletLambda¶
-
DirichletCharacter¶
-
DirichletGroup¶
-
PrimitiveDirichletCharacters¶
-
GeneralizedRiemannHypothesis¶
-
ConreyGenerator¶
-
GeneralizedBernoulliB¶
-
StieltjesGamma¶
-
KeiperLiLambda¶
-
GaussSum¶
Elliptic integrals¶
-
AGM¶
-
AGMSequence¶
-
EllipticK¶
-
EllipticE¶
-
EllipticPi¶
-
IncompleteEllipticF¶
-
IncompleteEllipticE¶
-
IncompleteEllipticPi¶
-
CarlsonRF¶
-
CarlsonRG¶
-
CarlsonRJ¶
-
CarlsonRD¶
-
CarlsonRC¶
-
CarlsonHypergeometricR¶
-
CarlsonHypergeometricT¶
Elliptic, theta and modular functions¶
-
JacobiTheta¶
-
JacobiThetaQ¶
-
DedekindEta¶
-
ModularJ¶
-
ModularLambda¶
-
EisensteinG¶
-
EisensteinE¶
-
DedekindSum¶
-
WeierstrassP¶
-
WeierstrassZeta¶
-
WeierstrassSigma¶
-
EllipticRootE¶
-
HilbertClassPolynomial¶
-
EulerQSeries¶
-
DedekindEtaEpsilon¶
-
ModularGroupAction¶
-
ModularGroupFundamentalDomain¶
-
ModularLambdaFundamentalDomain¶
-
PrimitiveReducedPositiveIntegralBinaryQuadraticForms¶
-
JacobiThetaEpsilon¶
-
JacobiThetaPermutation¶
Nonsemantic markup¶
-
Ellipsis¶ Ellipsisrenders as \(\ldots\) in LaTeX. It can be used to indicate missing function arguments for display purposes, but it has no predefined builtin semantics.
-
Parentheses¶ Parentheses(x)semantically representsx, but renders with parentheses (\(\left(x\right)\)) when converted to LaTeX.
-
Brackets¶ Brackets(x)semantically representsx, but renders with brackets (\(\left[x\right]\)) when converted to LaTeX.
-
Braces¶ Braces(x)semantically representsx, but renders with braces (\(\left\{x\right\}\)) when converted to LaTeX.
-
AngleBrackets¶ AngleBrackets(x)semantically representsx, but renders with angle brackets (\(\left\langle x\right\rangle\)) when converted to LaTeX.
-
Logic¶ Logic(x)semantically representsx, but forces logical expressions within x to be rendered using symbols instead of text.
-
ShowExpandedNormalForm¶ ShowExpandedNormalForm(x)semantically representsx, but displays the expanded normal form of the expression instead of rendering the expression verbatim. Warning: this triggers a nontrivial (potentially very expensive) computation.
-
Subscript¶