Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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 Answer 1

up vote 4 down vote accepted

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"}
 ]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.