The argument to subs should either be subs(old, new), or an iterable
of (old, new) pairs, so subs(x, q0) or subs([(x, q0)]) (you can also
pass in a dictionary like subs({x: q0})).

Aaron Meurer

On Tue, Mar 24, 2015 at 4:44 PM, Sudhanshu Mishra <mrsu...@gmail.com> wrote:
> Hi Scott,
>
> It looks like your subs call is wrong. It should be fn.subs(x, q0)
>
> Hope this helps.
>
> Sudhanshu Mishra
>
> On Wed, Mar 25, 2015 at 3:06 AM, Scott Guthery <sguth...@gmail.com> wrote:
>>
>> Any insight into the following will be greatly appreciated.  Many thanks.
>>
>> from sympy import *
>>
>> x = symbols('x', integer=True)
>>
>> def main(fns, q0):
>>     for fn in fns:
>>         print(fn)
>>         print(fn.subs([x,q0]))
>>
>> if __name__ == '__main__':
>>     f1=x
>>     f2=x+2
>>     main([f1,f2], 3)
>>
>> yields
>>
>> x
>> Traceback (most recent call last):
>>   File ".../Subs.py", line 13, in <module>
>>     main([f1,f2], 3)
>>   File ".../Subs.py", line 8, in main
>>     print(fn.subs([x,q0]))
>>   File "C:\Python34\lib\site-packages\sympy\core\basic.py", line 842, in
>> subs
>>     o, n = sequence[i]
>> TypeError: 'Symbol' object is not iterable
>>
>> --
>> 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 sympy+unsubscr...@googlegroups.com.
>> To post to this group, send email to sympy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sympy.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/b96b9f35-cd77-449a-bcf4-99668181633e%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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 sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAFW_KCR2DpZKsWXuWJYW%3Dpwo1AsJf6sgCHbM0%3D%2BbfTMwF7bkLA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6JRjXBEi6ViEsn-pe2UXjdb%2BS-RsSgX-UDqrMUF3wpY2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to