Guest User

Untitled

a guest
Jul 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. DSolve[{y''[x] + 1/x y'[x] + y[x] == 0, y[0] == 1, y'[0] == 0}, y[x], x]
  2.  
  3. {{y[x] -> BesselJ[0, x]}}
  4.  
  5. sol = NDSolve[{y''[x] + 1/x y'[x] + y[x] == 0, y[0] == 1, y'[0] == 0}, y[x], {x, 0, 10}]
  6.  
  7. Power::infy: Infinite expression 1/0. encountered. >>
  8. Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered. >>
  9. NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 0.`. >>
  10.  
  11. sol = DSolve[{y''[z] + Exp[2 z] y[z] == 0}, y[z], z]
  12.  
  13. ndsol = NDSolve[{x y''[x] + y'[x] + x y[x] == 0,
  14. y[0] == 1, y'[0] == 0}, y[x], {x, 0, 10},
  15. Method -> {"EquationSimplification" -> "Residual"}];
  16.  
  17. dsol = DSolve[{x y''[x] + y'[x] + x y[x] == 0, y[0] == 1, y'[0] == 0},
  18. y[x], {x, 0, 10}];
  19.  
  20. Plot[y[x] /. Join[dsol, ndsol] // Evaluate, {x, 0, 10},
  21. PlotStyle -> {AbsoluteThickness[5], Automatic}]
  22.  
  23. y''[x]/1
  24.  
  25. y''[0] + y''[0]/1 + y[0] == 0 /. y[0] -> 1
  26.  
  27. Solve[%, y''[0]] // Flatten
  28. (*{(y''[0] -> -(1/2)}*)
  29.  
  30. pde = y''[x] + Piecewise[{{-1/2, x == 0}, {y'[x]/x, x > 0}}] + y[x] == 0
  31.  
  32. sol = NDSolve[{pde, y[0] == 1, y'[0] == 0}, y[x], {x, 0, 10}] // Flatten;
  33.  
  34. Plot[{BesselJ[0, x], y[x] /. sol}, {x, 0, 10}]
Add Comment
Please, Sign In to add comment