raise TypeError('expr must be a sympy.Symbol instance')
+def symbols(names):
+ """
+ This function returns a tuple of symbols whose names are taken from a comma
+ or whitespace delimited string, or a sequence of strings. It is useful to
+ define several symbols at once.
+
+ >>> x, y = symbols('x y')
+ >>> x, y = symbols('x, y')
+ >>> x, y = symbols(['x', 'y'])
+ """
+ if isinstance(names, str):
+ names = names.replace(',', ' ').split()
+ return tuple(Symbol(name) for name in names)
+
+
class Dummy(Symbol):
"""
A variation of Symbol in which all symbols are unique and identified by
return '$${}_{{{}}}$$'.format(self.name, self._index)
-def symbols(names):
- """
- This function returns a tuple of symbols whose names are taken from a comma
- or whitespace delimited string, or a sequence of strings. It is useful to
- define several symbols at once.
-
- >>> x, y = symbols('x y')
- >>> x, y = symbols('x, y')
- >>> x, y = symbols(['x', 'y'])
- """
- if isinstance(names, str):
- names = names.replace(',', ' ').split()
- return tuple(Symbol(name) for name in names)
-
-
class Rational(LinExpr, Fraction):
"""
A particular case of linear expressions are rational values, i.e. linear