%md ## PROBLEM 2 ### POWER SERIES: ### Find the firs 6 nonzero terms in each of two linearly ### independent solutions of the form $\sum{c_nx^n} $, for ### the following differential equation: ### $ xy''+(sin x)y'+xy=0$
PROBLEM 2
POWER SERIES:
Find the firs 6 nonzero terms in each of two linearly
independent solutions of the form ∑cnxn, for
the following differential equation:
xy′′+(sinx)y′+xy=0
#generating a sum with 12 terms. reset() n=12 a=list(var('a%d'%i)for i in range(n)) x=var('x') y=function('y')(x) var('a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11') a0=0 a1=1 y(x)=a0+a1*x+a2*x^2+a3*x^3+a4*x^4+a5*x^5+a6*x^6+a7*x^7+a8*x^8+a9*x^9+a10*x^10+a11*x^11 show(y(x))
(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
a11x11+a10x10+a9x9+a8x8+a7x7+a6x6+a5x5+a4x4+a3x3+a2x2+x
#expanding the sine function using the McLaurin polynomial to use it in the differential equation sinX=taylor(sin(x),x,0,12) show (sinX) a0=0 a1=1 eq = expand (x*diff(y,x,2)+sinX*diff(y,x,1)+x*y(x)==0) #Substituting the expansion in the differential equation given show(eq)
−399168001x11+3628801x9−50401x7+1201x5−61x3+x
x ↦ −36288001a11x21−39916801a10x20+36288011a11x19−44352001a9x19+362881a10x18−49896001a8x18−504011a11x17−57024001a7x17+403201a9x17−5041a10x16−66528001a6x16+453601a8x16+12011a11x15−79833601a5x15+518401a7x15−5601a9x15+121a10x14−99792001a4x14+604801a6x14−6301a8x14−611a11x13−133056001a3x13+725761a5x13−7201a7x13+403a9x13−35a10x12+a11x12−199584001a2x12+907201a4x12−8401a6x12+151a8x12+a10x11+11a11x11+1209601a3x11−10081a5x11+1207a7x11−23a9x11+10a10x10+110a11x10+1814401a2x10−12601a4x10+201a6x10−34a8x10+a9x10−399168001x11+90a10x9−16801a3x9+241a5x9−67a7x9+a8x9+9a9x9−25201a2x8+301a4x8−a6x8+a7x8+8a8x8+72a9x8+3628801x9+401a3x7−65a5x7+a6x7+7a7x7+56a8x7+601a2x6−32a4x6+a5x6+6a6x6+42a7x6−50401x7−21a3x5+a4x5+5a5x5+30a6x5−31a2x4+a3x4+4a4x4+20a5x4+1201x5+a2x3+3a3x3+12a4x3+2a2x2+6a3x2−61x3+2a2x+x2+x=0
#grouping the coefficients of x and solving the system to find a2 we have : solve ([eq.lhs().coefficient(x,1)==0],a2) show (solve([eq.lhs().coefficient(x,1)==0],a2))
[a2 == (-1/2)]
[a2=(−21)]
#performing this process recursively to find the other coefficients of our series we have : show (solve([eq.lhs().coefficient(x,2).substitute(a2=-1/2)==0],a3))
[a3=0]
show (solve([eq.lhs().coefficient(x,3).substitute(a2=-1/2,a3=0)==0],a4))
[a4=(181)]
show (solve([eq.lhs().coefficient(x,4).substitute(a2=-1/2,a3=0,a4=1/18)==0],a5))
[a5=(−3607)]
show (solve([eq.lhs().coefficient(x,5).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360)==0],a6))
[a6=(9001)]
show (solve([eq.lhs().coefficient(x,6).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360,a6=1/900)==0],a7))
[a7=(113400157)]
show (solve([eq.lhs().coefficient(x,7).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360,a6=1/900,a7=157/113400)==0],a8))
[a8=(−3969019)]
show (solve([eq.lhs().coefficient(x,8).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360,a6=1/900,a7=157/113400,a8=-19/39690)==0],a9))
[a9=(38102400797)]
show (solve([eq.lhs().coefficient(x,9).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360,a6=1/900,a7=157/113400,a8=-19/39690,a9=797/38102400)==0],a10))
[a10=(30618000923)]
show (solve([eq.lhs().coefficient(x,10).substitute(a2=-1/2,a3=0,a4=1/18,a5=-7/360,a6=1/900,a7=157/113400,a8=-19/39690,a9=797/38102400,a10=923/30618000)==0],a11))
[a11=(−47151720000415519)]
#Now that we have calculated the coefficients we can calculate our first solution y1 (x)=0+1*x+(-1/2)*x^2+(0)*x^3+(1/18)*x^4+(-7/360)*x^5+(1/900)*x^6+(157/113400)*x^7+(-19/39690)*x^8+(797/38102400)*x^9+(923/30618000)*x^10+(-415519/47151720000)*x^11 show (y1(x))
−47151720000415519x11+30618000923x10+38102400797x9−3969019x8+113400157x7+9001x6−3607x5+181x4−21x2+x
#now we do the analogous process for our second linearly independent solution #generating a sum with 12 terms . reset () n=12 a= list (var('a%d'%i) for i in range (n)) x=var('x') y=function('y')(x) var('a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11') a0=1 a1=0 y(x)=a0+a1*x+a2*x^2+a3*x^3+a4*x^4+a5*x^5+a6*x^6+a7*x^7+a8*x^8+a9*x^9+a10*x^10+a11*x^11 show(y(x))
(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
a11x11+a10x10+a9x9+a8x8+a7x7+a6x6+a5x5+a4x4+a3x3+a2x2+1
#expanding the sine function using the Mclaurin polynomial to use it in the differential equation senoX=taylor(sin(x),x,0,12) show (senoX) a0=1 a1=0 eq = expand (x*diff(y,x,2)+senoX*diff(y,x,1)+x*y(x)==0) # Substituting the expansion in the differential equation given show(eq)
−399168001x11+3628801x9−50401x7+1201x5−61x3+x
x ↦ −36288001a11x21−39916801a10x20+36288011a11x19−44352001a9x19+362881a10x18−49896001a8x18−504011a11x17−57024001a7x17+403201a9x17−5041a10x16−66528001a6x16+453601a8x16+12011a11x15−79833601a5x15+518401a7x15−5601a9x15+121a10x14−99792001a4x14+604801a6x14−6301a8x14−611a11x13−133056001a3x13+725761a5x13−7201a7x13+403a9x13−35a10x12+a11x12−199584001a2x12+907201a4x12−8401a6x12+151a8x12+a10x11+11a11x11+1209601a3x11−10081a5x11+1207a7x11−23a9x11+10a10x10+110a11x10+1814401a2x10−12601a4x10+201a6x10−34a8x10+a9x10+90a10x9−16801a3x9+241a5x9−67a7x9+a8x9+9a9x9−25201a2x8+301a4x8−a6x8+a7x8+8a8x8+72a9x8+401a3x7−65a5x7+a6x7+7a7x7+56a8x7+601a2x6−32a4x6+a5x6+6a6x6+42a7x6−21a3x5+a4x5+5a5x5+30a6x5−31a2x4+a3x4+4a4x4+20a5x4+a2x3+3a3x3+12a4x3+2a2x2+6a3x2+2a2x+x=0
solve([eq.lhs().coefficient(x,1)==0],a2) show(solve([eq.lhs().coefficient(x,1)==0],a2))
[a2 == (-1/2)]
[a2=(−21)]
show(solve([eq.lhs().coefficient(x,2).substitute(a2=-1/2)==0],a3))
[a3=(61)]
show(solve([eq.lhs().coefficient(x,3).substitute(a2=-1/2,a3=1/6)==0],a4))
[a4=0]
show(solve([eq.lhs().coefficient(x,4).substitute(a2=-1/2,a3=1/6,a4=0)==0],a5))
[a5=(−601)]
show(solve([eq.lhs().coefficient(x,5).substitute(a2=-1/2,a3=1/6,a4=0,a5=-1/60)==0],a6))
[a6=(1801)]
show(solve([eq.lhs().coefficient(x,6).substitute(a2=-1/2,a3=1/6,a4=0,a5=-1/60,a6=1/180)==0],a7))
[a7=(−50401)]
show(solve([eq.lhs().coefficient(x,7).substitute(a2=-1/2,a3=1/6,a4=0,a5=-1/60,a6=1/180,a7=-1/5040)==0],a8))
[a8=(−25201)]
show(solve([eq.lhs().coefficient(x,8).substitute(a2=-1/2,a3 =1/6,a4=0,a5=-1/60,a6=1/180,a7=-1/5040,a8=-1/2520)==0],a9))
[a9=(9072011)]
show(solve([eq.lhs().coefficient(x,9).substitute(a2=-1/2,a3 =1/6,a4=0,a5=-1/60,a6=1/180,a7=-1/5040,a8=-1/2520,a9=11/90720)==0],a10))
[a10=(−6804001)]
show(solve([eq.lhs().coefficient(x,10).substitute(a2=-1/2,a3=1/6,a4=0,a5=-1/60,a6=1/180,a7=-1/5040,a8=-1/2520,a9=11/90720,a10=-1/680400)==0],a11))
[a11=(−5987520004957)]
y2(x)=1+0*x+(-1/2)*x^2+(1/6)*x^3+(0)*x^4+(-1/60)*x^5+(1/180)*x^6+(-1/5040)*x^7+(-1/2520)*x^8+(11/90720)*x^9+(-1/680400)*x^10+(-4957/598752000)*x^11 show(y2(x))
−5987520004957x11−6804001x10+9072011x9−25201x8−50401x7+1801x6−601x5+61x3−21x2+1