# Issues with substitution

I have a list L = [a13 == a10, a14 == a11, a15 == a12, a16 == a7, a17 == a8, a18 == a9]

I then have a running through a loop giving it these values

a = 1

a = 2a15a16 + 2a13a17 + 2a13a18 +1849

etc

I have

print(a)

a.subs(L)

print(a)

and it indicates no change, but I would of thought/ expected substitution to of taken place. Maybe I am being idiot, but please tell me where. I also posted this on stack overflow, sorry if I am not meant to post on both.

Thanks.

edit retag close merge delete

Cross-posted at http://stackoverflow.com/questions/42... (which is fine, by the way).

( 2017-02-27 13:10:37 -0600 )edit

Sort by ยป oldest newest most voted

This works as expected:

V = [var("a{}".format(k)) for k in [7..18]]
L = [a13 == a10, a14 == a11, a15 == a12, a16 == a7, a17 == a8, a18 == a9]
a = 2*a15*a16 + 2*a13*a17 + 2*a13*a18 + 1849
print a
b = a.subs(L)
print b


Please note: a.subs(L) does not change a in place.

more

Please start posting anonymously - your entry will be published after you log in or create a new account.

## Stats

Asked: 2017-02-27 11:33:19 -0600

Seen: 51 times

Last updated: Feb 28