Quantcast
Viewing latest article 1
Browse Latest Browse All 6

Comment by kcrisman for The simplest way is just to use the subs (or substitute) method of your symbolic expression like so:sage: t = var('t') sage: uR = function('uR', t) sage: iL = function('iL', t) sage: uC = function('uC', t) sage: sage: SE = uR(t) == 3*iL(0) + uC(0)/2 - 4 sage: SE.subs(iL(0)==0) uR(t) == 1/2*uC(0) - 4 sage: SE.subs(uC(0)==0) uR(t) == 3*iL(0) - 4 sage: SE uR(t) == 3*iL(0) + 1/2*uC(0) - 4 You see from the last line that the object SE is not changed during the substitution, so you should assign the result of the substitution. Also, you can do both (or arbitrarily many) substitutions using a dictionary:sage: R = SE.subs({iL(0):0, uC(0):0}) sage: R uR(t) == -4

@Ondra: Your original syntax had that problem too. It's hard to see without formatting, so I will put this in an answer, but @benjaminfjones has answered your question :)

Viewing latest article 1
Browse Latest Browse All 6

Trending Articles