Uppgift A:4 

restart 

`:=`(ode, {y(0) = 2, diff(y, x) = `+`(`*`(3, `*`(`^`(x, 2), `*`(y))))}) 

{y(0) = 2, diff(y(x), x) = `+`(`*`(3, `*`(`^`(x, 2), `*`(y(x)))))} (1.1)
 

`:=`(sol, dsolve(ode)) 

y(x) = `+`(`*`(2, `*`(exp(`*`(`^`(x, 3)))))) (1.2)
 

taylor(rhs(sol), x = 0, 16) 

series(`+`(2, `*`(2, `*`(`^`(x, 3))), `^`(x, 6), `*`(`/`(1, 3), `*`(`^`(x, 9))), `*`(`/`(1, 12), `*`(`^`(x, 12))), `*`(`/`(1, 60), `*`(`^`(x, 15))))+O(`^`(x, 16)),x,16) (1.3)
 

assume(n, integer) 

`:=`(y[0], 2) 

2 (1.4)
 

for n from 0 to 4 do `:=`(y[`+`(n, 1)], `+`(2, int(`+`(`*`(3, `*`(`^`(x, 2), `*`(y[n])))), x = 0 .. x))) end do 

 

 

 

 

`+`(2, `*`(2, `*`(`^`(x, 3))))
`+`(2, `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3))))
`+`(2, `*`(`/`(1, 3), `*`(`^`(x, 9))), `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3))))
`+`(2, `*`(`/`(1, 12), `*`(`^`(x, 12))), `*`(`/`(1, 3), `*`(`^`(x, 9))), `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3))))
`+`(2, `*`(`/`(1, 60), `*`(`^`(x, 15))), `*`(`/`(1, 12), `*`(`^`(x, 12))), `*`(`/`(1, 3), `*`(`^`(x, 9))), `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3)))) (1.5)
 

seq(y[n], n = 0 .. 4) 

2, `+`(2, `*`(2, `*`(`^`(x, 3)))), `+`(2, `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3)))), `+`(2, `*`(`/`(1, 3), `*`(`^`(x, 9))), `*`(`^`(x, 6)), `*`(2, `*`(`^`(x, 3)))), `+`(2, `*`(`/`(1, 12), `*`(`^`(x, 12)... (1.6)
 

plot([rhs(sol), y[5]], x = 1.5 .. 2.4, thickness = 2) 

Plot_2d