projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2e55885
)
Reorder functions in linexprs.py
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Mon, 18 Aug 2014 22:06:00 +0000
(
00:06
+0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Mon, 18 Aug 2014 22:06:00 +0000
(
00:06
+0200)
linpy/linexprs.py
patch
|
blob
|
history
diff --git
a/linpy/linexprs.py
b/linpy/linexprs.py
index
834c3b4
..
fce77a6
100644
(file)
--- a/
linpy/linexprs.py
+++ b/
linpy/linexprs.py
@@
-518,6
+518,21
@@
class Symbol(LinExpr):
raise TypeError('expr must be a sympy.Symbol instance')
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
class Dummy(Symbol):
"""
A variation of Symbol in which all symbols are unique and identified by
@@
-571,21
+586,6
@@
class Dummy(Symbol):
return '$${}_{{{}}}$$'.format(self.name, self._index)
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
class Rational(LinExpr, Fraction):
"""
A particular case of linear expressions are rational values, i.e. linear