Guest User

Untitled

a guest
Nov 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. findSeriesSolution[y_,x_,nTerms_]:=Module[
  2. {roots,pt=0,ode,s0,s1,ic,eq,sol},ic={y[0]->0,y'[0]->0};
  3. ode=y''[x]-4 x-y[x]^2;
  4. s0=Series[ode,{x,pt,nTerms}];
  5. s0=s0/.ic;
  6. roots=Solve@LogicalExpand[s0==0];
  7. s1=Series[y[x],{x,pt,nTerms+2}];
  8. sol=Normal[s1]/.ic/.roots[[1]]
  9. ]
  10.  
  11. findSeriesSolution[y,x,5]
  12. (* (2 x^3)/3 *)
Add Comment
Please, Sign In to add comment