1
$\begingroup$

I want to draw this nonlinear differantial equation' graphic with other solving equation (in same graphic).

ϵ y''[x] + y'[x] + y[x]^2 == 0, y[0] == 0, y[1] == 1/2

y^c = 1/(x + 
   1) - (1 + 2 x) E^(-(
    x/ϵ)) + ϵ {2/(x + 1)^2 Log[2/(
       x + 1)] + (1/2 - 2 Log[2]) E^(-(x/ϵ)) - 
     1/2 E^(-((2 x)/ϵ))}

I got nonlinear differantial equation' numerical solution with this form.

ϵ = 0.1;
functions = NDSolveValue[{ϵ y''[x] + y'[x] + y[x]^2 == 0, y[0] == 0, 
                          y[1] == 1/2}, {y, x}, {x, 0, 1}];

Plot[Evaluate@Through@functions@x, {x, 0, 1}]

enter image description here

$\endgroup$
2
0
$\begingroup$
ϵ = 0.1;

func = NDSolveValue[{ϵ y''[x] + y'[x] + y[x]^2 == 0, y[0] == 0, y[1] == 1/2}, 
        y, {x, 0, 1}]

y2[x_] := 1/(x + 1) - (1 + 2 x) E^(-(x/ϵ)) + ϵ (2/(x + 1)^2 Log[2/(x + 1)] 
          + (1/2 - 2 Log[2]) E^(-(x/ϵ)) - 1/2 E^(-((2 x)/ϵ)))

You can display both functions inside one plot using

Plot[{func[x], y2[x]}, {x, 0, 1}]

enter image description here

or

p1 = Plot[func[x], {x, 0, 1}];
p2 = Plot[y2[x], {x, 0, 1}];
Show[p1, p2]

enter image description here

$\endgroup$
2
  • $\begingroup$ @GenceDeveci What version of Mathematica are you using? $\endgroup$ – Karsten 7. Mar 28 '15 at 11:57
  • $\begingroup$ I'm using the Mathematica 9.0 ( "c" is not number it is only constant as a character) $\endgroup$ – Gence Deveci Mar 28 '15 at 12:06

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