% Plot the slope field (direction field) of the differential equation y^{\prime } =2\sqrt{|y|}:

[X, Y] = meshgrid(0:0.1:4, -1:0.2:8);
F = 2*sqrt(abs(Y));
quiver(X, Y, ones(size(F)), F)
axis tight, xlabel('x'), ylabel('y')
title('Slope field for $y'' = 2\sqrt{|y|}$','Interpreter','latex')

% The initial value problemy^{\prime } =2\sqrt{|y|}, y\left(0\right)=0 has infinitely many solutions, including y\left(x\right)={\max \left(x-c,0\right)}^2 where c\ge 0 is any constant. Now show several solutions on the slope field:

hold on
clist = [0 0.5 1];
for k = 1:3
    xx = 0:0.1:4;
    yy = max(0,xx - clist(k)).^2;
    plot(xx,yy,LineWidth=1.5), axis([0 4 0 8])
end

% Now let's try to solve the initial value problem y^{\prime } =2\sqrt{|y|}, y\left(0\right)=0 using Chebfun toolbox.

L = chebop(0,3);
L.op = @(x,y) diff(y) - 2*sqrt(abs(y));
L.lbc = 0;
y = L\0;

% You will see Chebfun only gives you the simplest solution, which is the constant 0.

hold off
plot(y,[-2,3])

%