# Revision history [back]

The w in sin(t*w) does not refer to whatever the object with identifier w in the current scope. There isn't a way to get Python to work like this. You need to do something like:

sage: var('t w')
(t, w)
sage: f(t) = sin(w*t)
sage: f.subs(w=2).function(t)
t |--> sin(2*t)


The w in sin(t*w) does not refer to whatever the object with identifier w in the current scope. There isn't a way to get Python to work like this. You need to do something like:

sage: var('t var('t, w')
(t, w)
sage: f(t) f(a,b,c,d,e,f,g,t) = sin(w*t)
sin(t*w)
sage: f.subs(w=2).function(t)
t f.subs(w=2).function(*f.arguments())
(a, b, c, d, e, f, g, t) |--> sin(2*t)


The w in sin(t*w) does not refer to whatever the object with identifier w in the current scope. There isn't a way to get Python to work like this. You need to do something like:

sage: var('t, w')
(t, w)
sage: params = {w: 2}
sage: f(a,b,c,d,e,f,g,t) = sin(t*w)
sage: f.subs(w=2).function(*f.arguments())
f.subs(params).function(*f.arguments())
(a, b, c, d, e, f, g, t) |--> sin(2*t)


You just have to define the replacements you want once in a dictionary. You still have to call subs once for every function you want to change.

The w in sin(t*w) does not refer to whatever the object with identifier w in the current scope. There isn't a way to get Python to work like this. You need to do something like:

sage: var('t, w')
(t, w)
sage: params = {w: 2}
sage: f(a,b,c,d,e,f,g,t) = sin(t*w)
sage: f.subs(params).function(*f.arguments())
f.subs(params)
(a, b, c, d, e, f, g, t) |--> sin(2*t)


You just have to define the replacements you want once in a dictionary. You still have to call subs once for every function you want to change.