I would say they should pass the symbol to use; in order to do anything
with it (like substitute a value) they will have to create the symbol. And
if you create it and put assumptions on it (like being an integer) but they
don't then their subs will fail:
>>> Symbol('t').subs(Symbol('t',integer=1),2)
t
>>> Symbol('t').subs(Symbol('t'),2)
2
An alternative is to just pass back the parameter (or None if there is
none) and the solution:
diop_solve(eq) -> (_t, solution)
where _t is generated by uniqparam as follows
```
>>> def uniqparam(eq, t='t'):
... s = eq.atoms(Symbol)
... if not any(si.name == t for si in s):
... return Symbol(t)
... while any(si.name == t for si in s):
... t = "_" + t
... return Symbol(t)
...
>>> uniqparam(x)
t
>>> uniqparam(t)
_t
>>> uniqparam(Symbol('_t'))
t
>>> uniqparam(Symbol('_t')+Symbol('t'))
__t
```
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.