I am trying to solve the differential equation with boundary conditions using the shooting method. Also assuming y(0) and y(1) are nonzero and equal. I am having trouble setting this up, and here is a first try.
system[\[CapitalOmega]_] := {y1'[x] == y2[x], y2'[x] == y1[x]^2 + 2*Pi^2*Cos[2*Pi*x] - Sin[Pi*x]^4, y1[0] == \[CapitalOmega], y2[0] == \[CapitalOmega]}
myODEsoln[\[CapitalOmega]_] := NDSolve[system[\[CapitalOmega]], {y1[x], y2[x]}, {x, 0, 1}]
yend[\[CapitalOmega]_?NumericQ] := First[y1[x] /. myODEsoln[\[CapitalOmega]] /. x -> 1]
bc = FindRoot[yend[\[CapitalOmega]] == 0, {\[CapitalOmega], -5, 5}]
Plot[Evaluate[y1[x] /. myODEsoln[\[CapitalOmega] /. bc]], {x, -1, 1}, PlotStyle -> Thick, Frame -> True, FrameLabel -> {Style["x", 12], Style["y1(x)", 12]}]
myODEsoln[Ω_] := NDSolve[system[Ω], {y1[x], y2[x]}, {x, -1, 1}]
instead of what you have the code runs without any errors. Right? $\endgroup$Plot[Evaluate[y1[x] /. myODEsoln[Ω /. bc]], {x, 0, 1}, PlotStyle -> Thick, Frame -> True, FrameLabel -> {Style["x", 12], Style["y1(x)", 12]}]
Again no errors $\endgroup$ysol = y /. First[NDSolve[{Derivative[2][y][x] == 2*Pi^2*Cos[2*Pi*x] - Sin[Pi*x]^4 + y[x]^2, Derivative[1][y][0] == 0, Derivative[1][y][1] == 0}, y, {x, 0, 1}]]; Plot[ysol[x], {x, 0, 1}]
$\endgroup$