Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Testing
Views: 29
# Verifying a solution to an ODE # example y’’ - 2y’ + y = 0 ( must put all terms on one side ) check that y=xe^x+e^x is a solution x=var('x') # Defines independent variable y=x^2*(1+ln(x)) # Defines the equation we want to check as a solution expand(diff(y,x,2) - (3*x*diff(y,x)-4*y)/(x^2)) # Defines the left side of the ODE. We are checking to see if it is equal to 0. # Since the results is 0 we have verified that it is a solution.
0
# Define a function x=var('x') # Defines independent variable y = x^2*(1+ln(x)) # Defines function # Evaluates the function y(e)
2*e^2
# Define a function x=var('x') # Defines independent variable y = x^2*(1+ln(x)) # Defines function # Evaluates the function z = diff(y,x) z(e)
5*e
# Plotting a sequence of solution curves with a direction field for an ODE # example y'+2*y=-x^2*e^(-2*x) which has solutions y=e^(-2*x)*(x^4/4+C) x,y= var('x,y') I=sum( plot ((c*(e^x)+(x^3)+3*(x^2)+6*x+6),(x,-0.5,2)) for c in range (-5,1)) #varies the constant c in the general solution y=e^( -2*x)*(x ^4/4+ c) D= plot_slope_field(y-x^3,(x,-.5,2),(y , -4 ,38),headaxislength=3, headlength =3) # plots the direction field (solve for y' and put in right hand side) P= plot (((-2*(e^x)+(x^3)+3*(x^2)+6*x+6)),(x,-0.5,2),color='red') #emphasizes a specific solution in red show (I+D+P)
︠595a633e-44bd-4cb2-9635-8a6068943a71︠ x,y= var('x,y') D= plot_slope_field((2-((3*y)/(500-x))),(x,-.5,1),(y , -4 ,20),headaxislength=3, headlength =3) #P= plot (,(x,-0.5,1),color='red')