SLiCAPpythonMaxima.py

SLiCAP module with symbolic math functions executed by maxima CAS.

Imported by the module SLiCAPplots.py.

checkMaxima()
maxEval(maxExpr)

Evaluates the expression ‘maxExpr’ with Maxima CAS and returns the result.

Parameters

maxExpr (str) – Expression in Maxima format to be evaluated.

Returns

String that can be converted into a sympy expression.

Return type

str

Example:

>>> maxEval("result:ilt(1/(s^2 + a^2), s, t);")
'sin(a*t)/a'
maxIntegrate(expr, var, start=None, stop=None, numeric=True)

Calculates definite or indefinite integral of ‘expr’.

Parameters
  • expr (sympy.Expr) – Integrand

  • var (sympy.Symbol, str) – Integration variable

  • start (Bool, int float, sympy.Expr) – Lower limit of the integral.

  • stop (Bool, int float, sympy.Expr) – Upper limit of the integral.

  • numeric (bool) – True will force Maxima to use (big) floats for numeric values.

Returns

Integral

Return type

sympy.Expr

maxLimit(expr, var, val, pm, numeric=True)

Calculates the limit of an expression for ‘var’ approaches ‘val’ from ‘pm’.

Parameters
  • expr (sympy.Expr, str) – Expression of which the limit must be evaluated.

  • var (sympy.Symbol, str) – Variable that should approach the limit value.

  • val (sympy.Symbol, str, sp.Expr, int, float) – Limit value of the variable.

  • pm (str) – Direction: ‘plus’ or ‘minus’

  • numeric (bool) – True will force Maxima to use (big) floats for numeric values.

Returns

Calculated limit

Return type

sympy.Expr

maxima2python(expr)

Converts a maxima expression into string that can be converted into a sympy expression.

Parameters

expr (str) – maxima expression

Returns

sympy compatible expression

Return type

str

class maximaHandler(port, host, maxima, timeout=0.5)
active = False
getResponse()
maxEval(maxExpr)

Evaluates the expression ‘maxExpr’ with Maxima CAS and returns the result.

Parameters

maxExpr (str) – Expression in Maxima format to be evaluated.

Returns

String that can be converted into a sympy expression.

Return type

str

Example:

>>> maxEval("result:ilt(1/(s^2 + a^2), s, t);")
'sin(a*t)/a'
mut = <unlocked _thread.lock object>
parseMaxima(maxInstr)
restartMaxima()
runMaxima()
startMaxima(**kwargs)
python2maxima(expr)

Converts a sympy expression into a Maxima expression.

Parameters

expr (sympy.Ex) – sympy expression

Returns

maxima expression

Return type

str

restartMaxima()
sign2signum(expr)

Performs a non-overlapping replacement of sign(expr) with signum(expr)

Parameters

expr (str) – text string

Returns

expr

Return type

str

signum2sign(expr)

Performs a non-overlapping replacement of signum(expr) with sign(expr)

Parameters

expr (str) – text string

Returns

expr

Return type

str

startMaxima()
start_new_thread(function)
wait_until(somepredicate, timeout, period=0.25, *args, **kwargs)