# week10

## 1361 days ago by wldnd1217

#homogeneous linear ODEs of second order #1 y=var('y') solve(y^2+5*y-14==0,y) var('x') y=function('y',x) de=desolve(diff(y,x,2)+5*diff(y,x)-14*y==0,[y,x]) print(de)
 k1*e^(2*x) + k2*e^(-7*x) k1*e^(2*x) + k2*e^(-7*x)
#2 y=var('y') solve(y^2+y-2==0,y) var('x') y=function('y',x) de=desolve(diff(y,x,2)+2*diff(y,x)-2*y==0,[y,x],ics=[0,4,-5]) print(de)
 -1/6*(sqrt(3) - 12)*e^((sqrt(3) - 1)*x) + 1/6*(sqrt(3) + 12)*e^(-(sqrt(3) + 1)*x) -1/6*(sqrt(3) - 12)*e^((sqrt(3) - 1)*x) + 1/6*(sqrt(3) + 12)*e^(-(sqrt(3) + 1)*x)
#3 var('x') y=var('y') y=function('y',x) de=desolve(9*diff(y,x,2)+6*diff(y,x)+y==0,[y,x]) print(de)
 (k2*x + k1)*e^(-1/3*x) (k2*x + k1)*e^(-1/3*x)
#4 var('x') y=var('y') y=function('y',x) de=desolve(diff(y,x,2)-4*diff(y,x)+4*y,[y,x],ics=[0,3,1]) print(de)
 -(5*x - 3)*e^(2*x) -(5*x - 3)*e^(2*x)
#5 var('x') y=var('y') y=function('y',x) de=desolve(diff(y,x,2)-2*diff(y,x)+10*y==0,[y,x]) print(de)
 (k1*sin(3*x) + k2*cos(3*x))*e^x (k1*sin(3*x) + k2*cos(3*x))*e^x
#6 var('x') y=var('y') y=function('y',x) de=desolve(4*diff(y,x,2)+4*diff(y,x)+17*y==0,[y,x],ics=[0,-1,2]) print(de)
 1/4*(3*sin(2*x) - 4*cos(2*x))*e^(-1/2*x) 1/4*(3*sin(2*x) - 4*cos(2*x))*e^(-1/2*x)
#7 var('x') y=var('y') y=function('y',x) de=desolve(diff(y,x,2)+0.2*diff(y,x)+4.01*y==0,[y,x],ics=[0,0,2]) print(de)
 e^(-1/10*x)*sin(2*x) e^(-1/10*x)*sin(2*x)
#euler-cauchy equation #1 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-2*x*diff(y,x)-4*y==0,[y,x]) print(de)
 k2*x^4 - 1/5*k1/x k2*x^4 - 1/5*k1/x
#2 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-2*x*diff(y,x)+2*y==0,[y,x],ics=[1,2,2]) print(de)
 2*x 2*x
#3 var('x') y=function('y',x) de=desolve(9*x^2*diff(y,x,2)+15*diff(y,x)+y==0,[y,x]) print(de)
 Traceback (click to the left of this block for traceback) ... NotImplementedError: Maxima was unable to solve this ODE. Consider to set option contrib_ode to True. Traceback (most recent call last): File "", line 1, in File "_sage_input_17.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IzMKdmFyKCd4JykKeT1mdW5jdGlvbigneScseCkKZGU9ZGVzb2x2ZSg5KnheMipkaWZmKHkseCwyKSsxNSpkaWZmKHkseCkreT09MCxbeSx4XSkKcHJpbnQoZGUp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpK0R7Ii/___code___.py", line 5, in de=desolve(_sage_const_9 *x**_sage_const_2 *diff(y,x,_sage_const_2 )+_sage_const_15 *diff(y,x)+y==_sage_const_0 ,[y,x]) File "/root/sage-5.8/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 447, in desolve raise NotImplementedError("Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.") NotImplementedError: Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.
#4 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-3*x*diff(y,x)+4*y==0,[y,x],ics=[1,0,3]) print(de)
 3*x^2*log(x) 3*x^2*log(x)
#5 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)+7*x*diff(y,x)+13*y==0,[y,x]) print(de)
 (k1*sin(2*log(x)) + k2*cos(2*log(x)))/x^3 (k1*sin(2*log(x)) + k2*cos(2*log(x)))/x^3
#6 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-9*x*diff(y,x)+41*y==0,[y,x],ics=[1,2,6]) print(de)
 -(sin(4*log(x)) - 2*cos(4*log(x)))*x^5 -(sin(4*log(x)) - 2*cos(4*log(x)))*x^5
#nonhomogeneous ODEs #1 var('x') y=function('y',x) de=desolve(diff(y,x,2)-6*diff(y,x)+9*y==6*x^2+2-12*e^(3*x),[y,x]) print(de)
 -6*x^2*e^(3*x) + (k2*x + k1)*e^(3*x) + 2/3*x^2 + 8/9*x + 2/3 -6*x^2*e^(3*x) + (k2*x + k1)*e^(3*x) + 2/3*x^2 + 8/9*x + 2/3
#2 var('x') y=function('y',x) de=desolve(diff(y,x,2)+y==sec(x)*tan(x),[y,x]) print(de)
 k1*sin(x) + k2*cos(x) + x*cos(x) - 1/2*log(1/2*cos(2*x) + 1/2)*sin(x) - sin(x) k1*sin(x) + k2*cos(x) + x*cos(x) - 1/2*log(1/2*cos(2*x) + 1/2)*sin(x) - sin(x)
#3 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-x*diff(y,x)+y==x,[y,x],ics=[1,2,1]) print(de)
 1/2*x*log(x)^2 - (log(x) - 2)*x 1/2*x*log(x)^2 - (log(x) - 2)*x

#4 var('x') y=function('y',x) de=desolve(diff(y,x,2)+diff(y,x)==sec(x)*tan(x),[y,x]) print(de)
 k2*e^(-x) + k1 - (2*e^x*sin(2*x)*sin(x)*cos(x) - e^x*sin(2*x)^2 - e^x*cos(2*x)^2 + 2*e^x*cos(x)^2 + 2*(e^x*cos(x)^2 - e^x)*cos(2*x) - 2*(sin(2*x)^2*cos(x) + cos(2*x)^2*cos(x) + 2*cos(2*x)*cos(x) + cos(x))*integrate((e^x*sin(2*x)*sin(x) + e^x*cos(2*x)*cos(x) + e^x*cos(x))/(sin(2*x)^2 + cos(2*x)^2 + 2*cos(2*x) + 1), x) - e^x)/(e^x*sin(2*x)^2*cos(x) + e^x*cos(2*x)^2*cos(x) + 2*e^x*cos(2*x)*cos(x) + e^x*cos(x)) k2*e^(-x) + k1 - (2*e^x*sin(2*x)*sin(x)*cos(x) - e^x*sin(2*x)^2 - e^x*cos(2*x)^2 + 2*e^x*cos(x)^2 + 2*(e^x*cos(x)^2 - e^x)*cos(2*x) - 2*(sin(2*x)^2*cos(x) + cos(2*x)^2*cos(x) + 2*cos(2*x)*cos(x) + cos(x))*integrate((e^x*sin(2*x)*sin(x) + e^x*cos(2*x)*cos(x) + e^x*cos(x))/(sin(2*x)^2 + cos(2*x)^2 + 2*cos(2*x) + 1), x) - e^x)/(e^x*sin(2*x)^2*cos(x) + e^x*cos(2*x)^2*cos(x) + 2*e^x*cos(2*x)*cos(x) + e^x*cos(x))
#5 var('x') y=function('y',x) de=desolve(diff(y,x,3)-diff(y,x,2)==3*e^x+sin(x),[y,x]) print(de)
 Traceback (click to the left of this block for traceback) ... NotImplementedError: Maxima was unable to solve this ODE. Consider to set option contrib_ode to True. Traceback (most recent call last): File "", line 1, in File "_sage_input_33.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IzUKdmFyKCd4JykKeT1mdW5jdGlvbigneScseCkKZGU9ZGVzb2x2ZShkaWZmKHkseCwzKS1kaWZmKHkseCwyKT09MyplXngrc2luKHgpLFt5LHhdKQpwcmludChkZSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmp5MCDnE/___code___.py", line 5, in de=desolve(diff(y,x,_sage_const_3 )-diff(y,x,_sage_const_2 )==_sage_const_3 *e**x+sin(x),[y,x]) File "/root/sage-5.8/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 447, in desolve raise NotImplementedError("Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.") NotImplementedError: Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.
#6 var('x') y=function('y',x) de=desolve(diff(y,x,2)+2*diff(y,x)+5*y==1.25*e^(0.5*x)+40*cos(4*x)-55*sin(4*x),[y,x]) print(de)
 (k1*sin(2*x) + k2*cos(2*x))*e^(-x) + 1/5*e^(1/2*x) + 5*sin(4*x) (k1*sin(2*x) + k2*cos(2*x))*e^(-x) + 1/5*e^(1/2*x) + 5*sin(4*x)
#7 var('x') y=function('y',x) de=desolve(diff(y,x,2)+diff(y,x)==2*e^(-x)*sin(x),[y,x]) print(de)
 -(sin(x) - cos(x))*e^(-x) + k2*e^(-x) + k1 -(sin(x) - cos(x))*e^(-x) + k2*e^(-x) + k1
#8 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-3*x*diff(y,x)+3*y==2*x^4*e^x,[y,x]) print(de)
 k1*x^3 + 2*(x^2 - x)*e^x + k2*x k1*x^3 + 2*(x^2 - x)*e^x + k2*x
#9 var('x') y=function('y',x) de=desolve(x^2*diff(y,x,2)-4*x*diff(y,x)+4*y==3*x^2,[y,x]) print(de)
 k1*x^4 + k2*x - 3/2*x^2 k1*x^4 + k2*x - 3/2*x^2