Ask Your Question

Revision history [back]

First, although you set f to be a function you later overwrite it with the result of desolve which is a symbolic expression. You can, instead of using it as function, simply substitute any other expression for c:

f = desolve(diff(f,x) == f(x), f, ival=x)
sage: f
c*e^x                                                                                  
sage: f.subs(c=10)
10*e^x                                                                                 
sage: f.subs(c=sin(x))
e^x*sin(x)

First, although you set f to be a function you later overwrite it with the result of desolve which is a symbolic expression. You can, instead of using it as function, simply substitute any other expression for c:

f = desolve(diff(f,x) == f(x), f, ival=x)
sage: f
c*e^x                                                                                  
sage: f.subs(c=10)
10*e^x                                                                                 
sage: f.subs(c=sin(x))
e^x*sin(x)

If you want that in functon notation, assign the expression to a function call:

sage: f(x,c)=f
sage: f
(x, c) |--> c*e^x
sage: f(x,10)
10*e^x

First, although you set f to be a function function, you later overwrite it with the result of desolve which is a symbolic expression. You can, instead of using it as function, simply substitute any other expression for c:

f = desolve(diff(f,x) == f(x), f, ival=x)
sage: f
c*e^x                                                                                  
sage: f.subs(c=10)
10*e^x                                                                                 
sage: f.subs(c=sin(x))
e^x*sin(x)

If you want that in functon function notation, assign the expression to a function call:

sage: f(x,c)=f
sage: f
(x, c) |--> c*e^x
sage: f(x,10)
10*e^x