reset()
x=var('x')            #initialize variable
y=function('y',x)     #define the variables in the function.eg. y=f(x).
DE=x*diff(y,x)-2*y    #write the ODE
S=desolve(DE,y,x)      #use desolve()
print S

DE=diff(S, x)*x - 2*S     #validate the solution
#SAGE could possibly modify desolve() to accept as an argument from the user,a solution to the ODE and
#return true or false(or 0 or 1) depending upon whether the solution satisfies the equation or not.
#As you can see in the output desolve() evaluates the general solution but doesn't provide any facility to
#test for a solution.
print DE

SageDays/Kreyszig-1.1-1-S (last edited 2010-08-09 14:04:37 by GauravLuthra)