Manual pages
Every algorithm and every property has a manual page with examples,
which you can view online here, or by pressing F1
in
the Cadabra notebook interface when your cursor is located on an
algorithm or property name. Consider this the "dry" version of the
documentation: to-the-point, but not very useful if you do not have
an understanding of the big picture yet.
For a more introductory description of the basics of Cadabra, you may be better off first reading or skimming through the tutorials or the Cadabra book.
Packages
Cadabra comes with various add-on packages, which can be imported in
the usual Python way with import
. Their content is
listed below.
cdb.core.component | |||
Simple access to component expressions | |||
get_component | Extract a single component from an expression. | ||
remove_zero_components | Remove all components of an expression that are equal to zero. | ||
components_to_subrule | Turn a component expression (the result of a \texttt{evaluate | ||
cdb.core.manip | |||
Manipulating equations, inequalities and similar expressions | |||
eq_to_subrule | Create substitution rule from an equation. | ||
multiply_through | Multiply all terms by the same factor. | ||
add_through | Add a factor to both sides of an equation. | ||
apply_through | Apply an operator through both sides of an equation. | ||
get_lhs | Return left-hand side of an expression | ||
get_rhs | Return right-hand side of an expression | ||
swap_sides | Swap the left and right-hand sides of an expression. | ||
get_factor | Get all multiplicative factors of term in node | ||
get_basis_component | Returns the multiplicative coefficients of \texttt{basis | ||
to_rhs | Move the indicated term of the expression to the right-hand side. | ||
to_lhs | Move the indicated term of the expression to the left-hand side. | ||
isolate | Isolates a term on the left hand side of an equation or inequality | ||
cdb.core.trace | |||
Manipulating Trace objects | |||
combine_traces | Combine separate trace nodes into one sum. | ||
cdb.graphics.plot | |||
Plotting of functions | |||
plot | Plot a function of one variable given the range. | ||
plot3d | Plot a function of two variables given their ranges. | ||
cdb.numeric.evaluate | |||
Numeric evaluation of Cadabra expressions | |||
evalf | Evaluate an expression to a floating point number | ||
lambdify | Create a Python function which evaluates an expression with the given parameters | ||
cdb.numeric.integrate | |||
Functions for numeric integration and numeric solutions to differential equations | |||
integrate_ode | Numerically integrate a system of ODEs over a range of values | ||
cdb.relativity.abstract | |||
Core general relativity package, mainly a library of various standard expressions. | |||
riemann_from_christoffel | Generates an equality which determines the Riemann tensor in terms of the Christoffel symbols. | ||
christoffel_from_metric | Generates an equality which determines the Christoffel symbols in terms of the metric. | ||
riemann_to_ricci | Convert contractions of Riemann tensors to Ricci tensors or scalars. | ||
cdb.sympy.calculus | |||
Use SymPy calculus functionality on Cadabra expressions. | |||
diff | Differentiate an expression with respect to one or more variables. | ||
integrate | Integrate a definite or indefinite integral. | ||
limit | Take the limit of an expression. | ||
series | Construct a Taylor series. | ||
factor | Factorise an expression | ||
cdb.sympy.solvers | |||
Access to Sympy solver functions. | |||
dsolve | Solve (system of) ordinary differential equation(s). | ||
linsolve | Solve a linear system for unknowns. | ||
nonlinsolve | Solve a system of non-linear equations. | ||
solve | Solve an equation or system of equations. | ||
cdb.utils.develop | |||
Helper functions to aid development, debugging and testing | |||
class Algorithm | Base class for user defined tree-traversal algorithms | ||
algo | Decorator for creating tree-traversal algorithms | ||
time_algo | Simple function to time the execution of an algorithm with given inputs. | ||
CadabraTestError | Exception derived from AssertionError raised by testing functions when an assertion fails | ||
test_algo | Decorator to aid defining unit tests for algorithms. | ||
inherit_kernel | Find a kernel in the stack. | ||
cdb.utils.indices | |||
Additional functionality to deal with indices | |||
all_index_positions | Generate all possible combinations of covariant and contravariant indices | ||
replace_index | Rename indices | ||
get_indices | Return a list of all indices inside \texttt{Node | ||
get_dummy_indices | Return a list of all dummy indices inside \texttt{Node | ||
get_free_indices | Return a list of all free indices inside \texttt{Node | ||
symmetrise_slots | Symmetrise or antisymmetrise an expression in the given slots | ||
cdb.utils.node | |||
Helper functions for working with ExNode objects | |||
n_indices | Return the number of first-level indices a node has | ||
nth_index | Gets the nth index of an ExNode object | ||
n_args | Returns the number of first-level arguments a node has | ||
nth_arg | Gets the nth first-level argument of an ExNode object | ||
arg_tuple | Returns a tuple containing the first n arguments of an ExNode object | ||
n_children | Returns the number of first-level children a node has | ||
nth_child | Gets the nth first-level child of an ExNode object | ||
child_tuple | Returns a tuple containing the first n children of an ExNode object | ||
empty_sum | Returns an Ex object with just one \textbackslash sum node with no children | ||
empty_product | Returns an Ex object with just one \textbackslash product node with no children | ||
cdb.utils.types | |||
Determining semantic properties of nodes | |||
is_relational_operator | Returns True for $=$, $<$ and $>$ nodes | ||
is_relational_expression | Returns True for expressions which contain a top node which is a relational operator and exactly two children | ||
Core algorithms
A | asym | Anti-symmetrise or symmetrise an expression in indicated indices or arguments | |
C | canonicalise | Bring a tensorial expression to canonical form by re-ordering indices. | |
collect_factors | Collect identical factors in a product. | ||
collect_terms | Collect identical terms in a sum. | ||
combine | Combine two consecutive indexbracket objects | ||
complete | Complete a set of substitution rules to cover related objects. | ||
D | decompose | Decompose a tensor monomial on a given basis of monomials. | |
decompose_product | Decompose a product of tensors by using Young projectors. | ||
distribute | Distribute factors over sums. | ||
drop_weight | Drop terms with given weight | ||
E | einsteinify | Raise or lower indices of pairs which are both upper or lower. | |
eliminate_kronecker | Eliminate Kronecker delta symbols. | ||
eliminate_metric | Eliminate metrics by raising or lowering indices. | ||
eliminate_vielbein | Eliminates vielbein objects. | ||
epsilon_to_delta | Replace a product of two epsilon tensors with a generalised delta | ||
evaluate | Evaluate components of a tensor expression. | ||
expand | Write out products of objects with implicit indices. | ||
expand_delta | Expand generalised Kronecker delta symbols | ||
expand_diracbar | Simplify the Dirac bar of a composite object. | ||
expand_power | Expand powers into repeated products | ||
explicit_indices | Make indices explicit on an expression with implicit indices. | ||
F | factor_in | Collect terms in a sum that differ only by given pre-factors. | |
factor_out | Isolate common factors in a sum of products | ||
fierz | Perform a Fierz transformation on a product of four spinors | ||
I | integrate_by_parts | Integrate by parts away from the indicated expression | |
J | join_gamma | Work out the product of two generalised Dirac gamma matrices. | |
K | keep_weight | Keep terms with indicated weight | |
L | lower_free_indices | Make all free indices in an expression subscripts. | |
lr_tensor | Compute the tensor product of two Young tableaux | ||
M | map_sympy | Map Sympy algorithms to Cadabra expressions | |
meld | Combine terms when allowed by symmetries. | ||
N | nevaluate | Numerically evaluate an expression. | |
P | product_rule | Apply the Leibnitz rule to a derivative of a product | |
R | raise_free_indices | Make all free indices in an expression superscripts. | |
reduce_delta | Simplify a self-contracted generalised delta. | ||
rename_dummies | Rename dummy indices, within a set or from one set to another. | ||
replace_match | Put the result of a sub-computation back into the original expression | ||
rewrite_indices | Rewrite indices by contracting with vielbein or metric. | ||
S | simplify | Simplify the scalar part of an expression. | |
slot_asym | Anti-symmetrise or symmetrise an expression in indicated index slots | ||
sort_product | Sort factors in a product | ||
sort_spinors | Sort Majorana spinor bilinears | ||
sort_sum | Sort terms in a sum. | ||
split_gamma | Split a Dirac gamma matrix off a generalised product of gamma matrices. | ||
split_index | Split the range of an index into two subsets | ||
substitute | Generic substitution algorithm. | ||
T | take_match | Select a subset of terms in a sum for further computations. | |
U | untrace | Take objects out of traces | |
unwrap | Move objects out of derivatives, accents or exterior products. | ||
V | vary | Generic variation algorithm for functional derivatives. | |
Y | young_project_product | Project all tensors in a product with their Young tableau projector. | |
young_project_tensor | Project tensors with their Young projector. | ||
Z | zoom | Only show selected terms in a sum, and restrict subsequent algorithms to these terms. |
Core properties
A | Accent | Turn a symbol into an accent. | |
AntiCommuting | Make objects anti-commuting. | ||
AntiSymmetric | Make an object anti-symmetric in all indices. | ||
C | Commuting | Make components commuting. | |
CommutingAsProduct | Makes an object behave as a product when commuting. | ||
CommutingAsSum | Makes an object behave as a sum when commuting. | ||
Coordinate | Declare a symbol to be a coordinate label. | ||
D | DAntiSymmetric | Gives object the symmetries of the derivative of a fully antisymmetric tensor. | |
Depends | Makes an object implicitly dependent on other objects. | ||
Derivative | Declare an operator to satisfy the Leibnitz rule. | ||
Determinant | Declares an object to be the determinant of a matrix or metric. | ||
Diagonal | Declares a tensor to only have non-zero diagonal entries. | ||
DiracBar | An accent representing the Dirac conjugation operation. | ||
Distributable | Make an operator distributable over its arguments. | ||
E | EpsilonTensor | A fully anti-symmetric tensor with constant components. | |
T | Tableau | A Young-tableau object with unlabelled boxes. | |
G | GammaMatrix | A generalised generator of a Clifford algebra. | |
I | ImplicitIndex | Indicates that an object carries indices which are not written out. | |
IndexInherit | Make an object inherit all indices from its child objects. | ||
Indices | Declare names to be used as indices. | ||
Integer | Indicates that an object takes integer values. | ||
InverseMetric | Make a two-tensor an inverse metric. | ||
K | KroneckerDelta | Turns an object into a generalised Kronecker delta symbol. | |
L | LaTeXForm | Changes the way in which expressions are displayed. | |
M | Metric | Makes a two-tensor a metric. | |
N | NonCommuting | Makes components non-commuting. | |
P | PartialDerivative | Makes an object a partial derivative. | |
R | RiemannTensor | Make an object a Riemann curvature tensor. | |
S | SatisfiesBianchi | Make an object satisfy the generalised Bianchi identity. | |
SelfAntiCommuting | Make components of tensors anti-commute. | ||
SelfCommuting | Make tensor components commute. | ||
SelfNonCommuting | Make tensor components non-commuting. | ||
SortOrder | Set sorting order of objects. | ||
Spinor | Declares an object to transform as a spinor. | ||
Symbol | Make an object not count as index when it is a sub- or super-script | ||
Symmetric | Make an object symmetric in all indices. | ||
T | Tableau | A Young-tableau object with unlabelled boxes. | |
TableauSymmetry | Gives a tensor a generic Young tableau symmetry. | ||
W | Weight | Attach a labelled weight to an object | |
WeightInherit | Make object inherit weights from child nodes |