E

E

E(
    input: str,
    mode: ParseMode = ParseMode.Symbolica,
    default_namespace: str | None = None,
) -> Expression

Parse a Symbolica expression from a string.

Parameters

  • input (str) An input string. UTF-8 characters are allowed.
  • mode (ParseMode) The parsing mode to use. Use ParseMode.Mathematica to parse Mathematica expressions.
  • default_namespace (Optional[str]) The default namespace to use when parsing symbols.

Examples

e = E('x^2+y+y*4')
print(e)
x^2+5*y
e = E('Cos[test`x] (2+ 3 I)', mode=ParseMode.Mathematica)
print(e)
cos(test::x)(2+3i)

Raises

  • ValueError: If the input is not a valid expression.