assign function to an existing function
Hi,
Consider the following code:
sage.var('R')
rho = sage.function('rho')(R)
r = rho(R=R).function(R)
Is there a way to assign some function to rho
such that r
is modified? For instance, if I do:
y = sage.function('y')(R)
rho = sage.desolve(sage.diff(y,R) - y(R), dvar=y, ivar=R, ics=[0,1]).function(R)
->R |--> e^R
Then I get:
r(0)
->rho(0)
rho(0)
->1
So rho
is of course modified, but not r
.
Thanks!
Martin
Sure, in Python (and hence Sage) you can assign anything to
r
. But we would need to see a more specific example. Also, be aware that some commands have a side effect, but returnNone
, so you have to be careful about that - for instance, the bare commandshow(plot())
might give an empty plot to show, but the actual Python value returned isNone
, not what you might be looking for.Thanks! Just updated my question. Any idea?
Ah, this is more of a Python question, which I'll let others answer. By the way, you don't need the
sage
bits unless you are importing Sage explicitly in Python. Maybe you are.Thanks! Yes, I prefer python standalone (makes it easier to use other python libraries) with
import sage.all as sage
(makes it where each function comes from).