Comment #5 on issue 2043 by smichr: expand log can be more complete
(was "logcombine can be less strict")
http://code.google.com/p/sympy/issues/detail?id=2043
Instead of patching code to be symbolic, why don't we just have a function
to make all vanilla symbols take on whatever property is necessary for
symbolic behavior typically, 'positive real' is enough (but if it's
positive it must be real, right).
def posify(eq):
reps = dict([(s, Symbol(s.name, positive=1)) for s in eq.atoms(Symbol) if
s.is_positive is None])
eq = eq.subs(reps)
return eq, dict([(r,s) for s, r in reps.iteritems()])
posify(Symbol('x') + Symbol('p', positive=True) + Symbol('n',
negative=True))
(n + p + _x, {_x: x})
Note that only the vanilla x gets replaced.
So then when we need symbolic behavior we do
eq, reps = posify(eq)
.
... compute answer
.
return ans.subs(reps)
I really would like to get rid of all the patcched code and replace it with
this one function (and a call to it when necessary). Someday, I think it
would be good, then, to return with the solution obtained in such a way,
an "assumptions dictionary" that can be inspected while numerically
evaluating the answer.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.