create_literal¶
- pqp.symbols.create_literal(name, arity=1, sep=', ', name_tex=None, sep_tex=None)¶
Class factory for creating expression literals
Suppose you have a function f that takes a single expression as an argument and you want to use this function in a symbolic expression.
>>> F = create_literal("f") >>> x = Variable("x") >>> F(x) f(x) >>> F(x).to_latex() $f(x)$
- Parameters:
name (str) – The name of the new class
arity (int, optional) – The arity of the new class. Defaults to 1. Zero is allowed.
sep (str, optional) – The separator to use when printing the expression. Defaults to “, “.
name_tex (str, optional) – The name of the new class in LaTeX. Defaults to name.
sep_tex (str, optional) – The separator to use when printing the expression in LaTeX. Defaults to sep.
- Returns:
A new subclass of AbstractExpression