> I would say that this is the case. I am actually surprised that subs
> replaces ints, and I wouldn't rely on it.

subs sympifies its arguments, so I believe it will always work,
replacing any Integer
(even the negative one in front of an expression):

>>> (-c*d + 1).subs(-1,d)
c*d**2 - d

>  For example, if b were 1 and a were 2, it
> would never work because the final expression would not
> actually contain a 1.

subs is smart enough to recognize the -1 as demonstrated above.

> What I would do instead is use symbols for a and b and use subs to
> replace them with integers whenever you need them. That will always
> work.
>

Yes. Also, see the "Variables" section of
http://docs.sympy.org/dev/gotchas.html

/Chris

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to