Exercise 10.5.7

The following nonlinear BVP was proposed by Carrier:

ϵu

In order to balance the different components of the residual, it’s best to implement the boundary condition numerically as u/\epsilon = 0.

  1. Use bvp to solve the problem with \epsilon = 0.003, n=200, and an initial estimate of all zeros. Plot the result; you should get a solution with 9 local maxima.

  2. Starting with result of (a) continue the parameter sequence of \epsilon using most recent solution as initialization for the next value. Plot end result for \epsilon = 0.3.

domain = [-1,1];
epsilon = 0.003;
phi = (x,u,du) -> (1 - u^2 - 2*(1-x^2)*u)/epsilon
g1(u,du) = 0;
g2(u,du) = 0;
init = zeros(201);
x,u1 = FNC.bvp(phi,domain,g1,g2,init);

plot(x,u1,xaxis=(L"x"),yaxis=(L"u(x)"),
     title="Solution of Carrier problem")
## (b)
u_ee = init; #trick to access u_ee globally

for ee in -3:0.2:-1
  epsilon = 3*10^ee
  x,u_ee = FNC.bvp(phi,domain,g1,g2,u1)
end

plot(x,u_ee,xaxis=(L"x"),yaxis=(L"u(x)"),
   title="Solution of Carrier problem with eps = 0.3") 
## (c) now do b in reverse
init = zeros(201);

for ee in -1.0:-0.2:-3
  epsilon = 3*10^ee
  x,u_x = FNC.bvp(phi,domain,g1,g2,init)
  init = u_x
end

plot(x,u_x,xaxis=(L"x"),yaxis=(L"u(x)"),
   title="Solution of Carrier problem with eps = 0.003")