1

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

1 Answers1

0
ϵ = 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

Karsten7
  • 27,448
  • 5
  • 73
  • 134