Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Course Project MAT4109/EDG1109

Project: Mate 4
Views: 11
%md ## Problem 1 ### Solve the following diferential equation subject to the initial conditions given: $(D-2)^3 (D^2 +9)y=x^2 e^x + xsin (3x) \ ; \ y(0)=y'(0)=y"(0)=y^(3)*(0)=y^(4)*(0)=1$

Problem 1

Solve the following diferential equation subject to the initial conditions given:

(D2)3(D2+9)y=x2ex+xsin(3x) ; y(0)=y(0)=y"(0)=y(3)(0)=y(4)(0)=1(D-2)^3 (D^2 +9)y=x^2 e^x + xsin (3x) \ ; \ y(0)=y'(0)=y"(0)=y^(3)*(0)=y^(4)*(0)=1

# Let us first find the characteristic equation and solve it: var('r') solve([(r-2)^3*(r^2 + 9)== 0],r)
r [r == (-3*I), r == (3*I), r == 2]
# Among the roots from the characteristic equations that were found, there is one with multiplicity 3 and this one will be used to find the complementary solution. Let's start with the particular one: #We have multiplied everything times x to take out the duplicity. var ('x,A,B,C,D,E,F,G') yp=(A+B*x+C*x^2)*exp(x)+(D*x+E*x^2)*cos(3*x)+(F*x+G*x^2)*sin(3*x) show(yp)
(x, A, B, C, D, E, F, G)
(Ex2+Dx)cos(3x)+(Cx2+Bx+A)ex+(Gx2+Fx)sin(3x)\displaystyle {\left(E x^{2} + D x\right)} \cos\left(3 \, x\right) + {\left(C x^{2} + B x + A\right)} e^{x} + {\left(G x^{2} + F x\right)} \sin\left(3 \, x\right)
#Now, we will substitute the previous equation into the original differential equation: rem0= diff(yp,x,2)+9*yp rem1= diff(rem0,x)-2*rem0 rem2= diff(rem1,x)-2*rem1 rem3= diff(rem2,x)-2*rem2 remfinal= rem3-x^2*exp(x)-x*sin(3*x) show(remfinal)
x2ex54(2Ex+D)cos(3x)+276(2Gx+F)cos(3x)+524Ecos(3x)162Gcos(3x)10(Cx2+Bx+A)ex+28(2Cx+B)ex50Cex276(2Ex+D)sin(3x)54(2Gx+F)sin(3x)+162Esin(3x)+524Gsin(3x)xsin(3x)\displaystyle -x^{2} e^{x} - 54 \, {\left(2 \, E x + D\right)} \cos\left(3 \, x\right) + 276 \, {\left(2 \, G x + F\right)} \cos\left(3 \, x\right) + 524 \, E \cos\left(3 \, x\right) - 162 \, G \cos\left(3 \, x\right) - 10 \, {\left(C x^{2} + B x + A\right)} e^{x} + 28 \, {\left(2 \, C x + B\right)} e^{x} - 50 \, C e^{x} - 276 \, {\left(2 \, E x + D\right)} \sin\left(3 \, x\right) - 54 \, {\left(2 \, G x + F\right)} \sin\left(3 \, x\right) + 162 \, E \sin\left(3 \, x\right) + 524 \, G \sin\left(3 \, x\right) - x \sin\left(3 \, x\right)
#Now, we will find the coefficients of the previous equation coeffEx=remfinal.coefficient(exp(x)) coeffCos=remfinal.coefficient(cos(3*x)) coeffSin=remfinal.coefficient(sin(3*x)) #We will use the command Solve to find the coefficients A, B, C. solve([coeffEx.coefficient(x,0)==0,coeffEx.coefficient(x,1)==0, coeffEx.coefficient(x,2)==0],A,B,C)
[[A == (-267/250), B == (-14/25), C == (-1/10)]]
#And now, we will find the remaining coefficients of the problem, which are the coefficients D, E, F, G. solve ([coeffCos.coefficient(x,0)==0,coeffCos.coefficient(x,1)==0, coeffSin.coefficient(x,0)==0,coeffSin.coefficient(x,1)==0],D,E,F,G)
[[D == (-251/114244), E == (-23/13182), F == (1379/514098), G == (-3/8788)]]
#In short, the values of the coefficients found are the following ones: A=-267/250; B=-14/25; C=-1/10; D=-251/114244; E=-23/13182; F=1379/514098; G=-3/8788; #We are now finally able to find the complementary solution as follows: var ('c1,c2,c3,c4,c5') yc=c1*exp(2*x)+c2 *x*exp(2*x)+c3*x^2*exp(2*x)+c4*cos(3*x)+c5*sin(3*x)+(A+B*x+C*x^2)*exp(x)+(D*x+E*x^2)*cos(3*x)+(F*x+G*x^2)*sin(3*x) show(yc)
(c1, c2, c3, c4, c5)
c3x2e(2x)+c2xe(2x)1342732(598x2+753x)cos(3x)+c4cos(3x)+c1e(2x)1250(25x2+140x+267)ex11028196(351x22758x)sin(3x)+c5sin(3x)\displaystyle c_{3} x^{2} e^{\left(2 \, x\right)} + c_{2} x e^{\left(2 \, x\right)} - \frac{1}{342732} \, {\left(598 \, x^{2} + 753 \, x\right)} \cos\left(3 \, x\right) + c_{4} \cos\left(3 \, x\right) + c_{1} e^{\left(2 \, x\right)} - \frac{1}{250} \, {\left(25 \, x^{2} + 140 \, x + 267\right)} e^{x} - \frac{1}{1028196} \, {\left(351 \, x^{2} - 2758 \, x\right)} \sin\left(3 \, x\right) + c_{5} \sin\left(3 \, x\right)
#Solving for the coeffients c1, c2, c3, c4, c5 we find: solve([yc.substitute(x=0)==1,diff(yc,x).substitute(x=0)==1,diff(yc,x,2).substitute(x=0)==1,diff(yc,x,3).substitute(x=0)==1,diff(yc,x,4).substitute(x=0)==1],c1,c2,c3,c4,c5)
[[c1 == (774782/371293), c2 == (-43330/28561), c3 == (1020/2197), c4 == (-1737019/92823250), c5 == (-4850123/556939500)]]
#In short, the values of the coefficients c1, c2, c3, c4, c5 are: c1 =774782/371293; c2 = -43330/28561; c3 =1020/2197; c4= -1737019/92823250; c5 = -4850123/556939500 #And my complete solution (complementary and particular)for the differential equation with the initial conditions given, is: yc=c1*exp(2*x)+c2*x*exp(2*x)+c3*x^2*exp(2*x)+c4*cos(3*x)+c5*sin(3*x)+(A+B*x+C*x^2)*exp(x)+(D*x+E*x^2)*cos(3*x)+(F*x+G*x^2)*sin(3*x) show ( yc )
10202197x2e(2x)1342732(598x2+753x)cos(3x)4333028561xe(2x)1250(25x2+140x+267)ex11028196(351x22758x)sin(3x)173701992823250cos(3x)+774782371293e(2x)4850123556939500sin(3x)\displaystyle \frac{1020}{2197} \, x^{2} e^{\left(2 \, x\right)} - \frac{1}{342732} \, {\left(598 \, x^{2} + 753 \, x\right)} \cos\left(3 \, x\right) - \frac{43330}{28561} \, x e^{\left(2 \, x\right)} - \frac{1}{250} \, {\left(25 \, x^{2} + 140 \, x + 267\right)} e^{x} - \frac{1}{1028196} \, {\left(351 \, x^{2} - 2758 \, x\right)} \sin\left(3 \, x\right) - \frac{1737019}{92823250} \, \cos\left(3 \, x\right) + \frac{774782}{371293} \, e^{\left(2 \, x\right)} - \frac{4850123}{556939500} \, \sin\left(3 \, x\right)