1

I'm new to mathematica and am interested in solving the following BVP:

$\epsilon \,y'' + 2 y' + y^3 = 0$, for $0 < x < 1$ and $y(0) = 0, y(1) = 1/2$.

I have no experience with coding, so although I have read through the Mathematica documentation, I'm still a bit confused as to how to do this. I think I understand DSolve, but what does that actually give me, and how do i plot it?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
covertbob
  • 617
  • 1
  • 7
  • 6
  • Well, in what sense do you think you understand DSolve? If you elaborate on that, I (or someone else) can give you an answer that helps you understand how to use it. – David Z Dec 19 '12 at 21:17
  • I understand that I can use it to solve a differential equation. I'm just unsure of what it actually gives me back. For instance, in Nasser Abbasi's code below he writes sol = First@NDSolve. What is sol? How do I use it? – covertbob Dec 19 '12 at 21:22

1 Answers1

5

Nice to have something to solve while waiting for coeffee.

Mathematica graphics

 Manipulate[
 eq = \[Epsilon]\[Epsilon] y''[x] + 2 y'[x] + y[x]^3 == 0;
 ic = {y[0] == ic0, y[1] == ic1};

 sol = First@NDSolve[Flatten[{eq, ic}], y[x], {x, 0, to}];

 Plot[y[x] /. sol, {x, 0, to}, 
  Frame -> True, 
  PlotRange -> All, 
  ImagePadding -> 50, 
  FrameLabel -> {
       {y[x], None}, 
       {x,
        Style[Row[{"solution to ", \[Epsilon] y''[x] + 2 y'[x] +y[x]^3 == 0}], 12]
       }
      }, 
  GridLines -> Automatic, 
  GridLinesStyle -> Directive[LightGray, Thickness[.001]]
  ],

 {{\[Epsilon]\[Epsilon], 1, \[Epsilon]}, 0, 1, .01, ImageSize -> Tiny,
   Appearance -> "Labeled"},

 {{to, 2, "to?"}, 2, 10, .01, ImageSize -> Tiny, 
  Appearance -> "Labeled"},

 {{ic0, 0, "y(0)"}, 0, 1, .01, ImageSize -> Tiny, 
  Appearance -> "Labeled"},

 {{ic1, 0.5, "y(1)"}, 0, 1, .01, ImageSize -> Tiny, 
  Appearance -> "Labeled"}
 ]
Nasser
  • 143,286
  • 11
  • 154
  • 359
  • Nice method. Please, see my question in [https://mathematica.stackexchange.com/questions/167132/solving-a-simple-bvp-with-an-error] – Patrick El Pollo Mar 04 '18 at 20:13