1
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Commented Dec 19, 2012 at 21:17
  • $\begingroup$ 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? $\endgroup$ Commented Dec 19, 2012 at 21:22

1 Answer 1

5
$\begingroup$

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"} ] 
$\endgroup$
1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.