First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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)
click to hide/show revision 2
No.2 Revision

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
click to hide/show revision 3
No.3 Revision

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