Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Modules | Functions
Scalar algebra

Module Description

Functionality to make Cadabra interface with the scalar computer algebra systems (e.g.

Sympy and Mathematica). It converts scalar parts of Cadabra expressions ('things without indices') to one of these systems, runs them through, and then converts back to Cadabra notation.

Modules

 Sympy bridge
 
 Mathematica bridge
 

Functions

static cadabra::Ex::iterator MMA::apply_mma (const cadabra::Kernel &, cadabra::Ex &, cadabra::Ex::iterator &, const std::vector< std::string > &wrap, const std::string &args, const std::string &method)
 Functionality to act with Mathematica functions on (parts of) Cadabra Ex expressions and read the result back into the same Ex. More...
 
boost::python::object Ex_to_Sympy (const cadabra::Ex &)
 Outputs a Cadabra 'Ex' as a Sympy expression. More...
 
cadabra::Ex::iterator sympy::apply (const cadabra::Kernel &, cadabra::Ex &, cadabra::Ex::iterator &, const std::vector< std::string > &wrap, const std::string &args, const std::string &method)
 Functionality to act with Sympy on all scalar parts of an expression, and keep the result in-place. More...
 
cadabra::Ex sympy::invert_matrix (const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules)
 Use Sympy to invert a matrix, given a set of rules determining its sparse components. More...
 

Function Documentation

cadabra::Ex::iterator sympy::apply ( const cadabra::Kernel kernel,
cadabra::Ex ex,
cadabra::Ex::iterator &  it,
const std::vector< std::string > &  wrap,
const std::string &  args,
const std::string &  method 
)

Functionality to act with Sympy on all scalar parts of an expression, and keep the result in-place.

This is a higher-level function than 'apply' below.

Functionality to act with Sympy functions on (parts of) Cadabra Ex expressions and read the result back into the same Ex. This duplicates some of the logic in PythonCdb.hh, in particular make_Ex_from_string, but it is best to keep these two completely separate.

Ex::iterator MMA::apply_mma ( const cadabra::Kernel ,
cadabra::Ex ,
cadabra::Ex::iterator &  ,
const std::vector< std::string > &  wrap,
const std::string &  args,
const std::string &  method 
)
static

Functionality to act with Mathematica functions on (parts of) Cadabra Ex expressions and read the result back into the same Ex.

This duplicates some of the logic in PythonCdb.hh, in particular make_Ex_from_string, but it is best to keep these two completely separate.

boost::python::object Ex_to_Sympy ( const cadabra::Ex )

Outputs a Cadabra 'Ex' as a Sympy expression.

This first converts the Cadabra expression to a string, and then reads that back in by calling sympy.parsing.sympy_parser.parse_expr. Is mapped to a 'sympy()' function on each Ex object. When you feed an Ex object to a Sympy function, the Ex gets converted to a Sympy object in 'sympy.sympify' because the latter attempts to call sympy on every object that you feed it.

Ex sympy::invert_matrix ( const cadabra::Kernel kernel,
cadabra::Ex ex,
cadabra::Ex rules 
)

Use Sympy to invert a matrix, given a set of rules determining its sparse components.

Will return a set of Cadabra rules for the inverse matrix.