OK, write my comment as answer. If I understood OP's intention correctly, he wants to solve for y[x]
and plot y'[x]
. The equation contains a parameter L
, so we need to use ParametricNDSolve
:
a = 2.7*10^-3; θ = Pi/6; g = 9.8; ρ = 1000; σ = 70*10^-3;
δp[L_] := 2*σ/L - g*(ρ*L)/2;
sol = ParametricNDSolve[{1 + y'[x]/Sqrt[(1 + y'[x]^2)] ==
x^2/(2*a^2) + (δp[L]*x)/σ + (1 + Cos[θ]),
y[0] == 0}, y, {x, 0, 1}, {L}]
Now the solution can be plotted for some value of L
(I used here initial value from the question):
Plot[y'[0.004][x] /. sol, {x, Sequence @@ First[(y[0.004] /. sol)["Domain"]]},
AxesLabel -> {x, y'[x]}]

To vary L
one can use Manipulate
:
Manipulate[
Plot[y'[L][x] /. sol, {x,
Sequence @@ First[(y[L] /. sol)["Domain"]]},
AxesLabel -> {x, y'[x]},
PlotLabel -> Row[{Style["L", Italic], "\[ThinSpace]=\[ThinSpace]", L}]],
{{L, 0.004}, 0.002, 0.02, 0.002}]
Another possibility is using table-like representation:
Grid@Partition[
Plot[y'[#][x] /. sol, {x,
Sequence @@ First[(y[#] /. sol)["Domain"]]},
AxesLabel -> {x, y'[x]},
PlotLabel -> Row[{L, "\[ThinSpace]=\[ThinSpace]", #}]] & /@
Range[0.002, 0.02, 0.002], 2]
EDIT
To answer edited question. First we can plot y[L][x]
as function of x
, then one approach is to take points from this plot and interchange coordinates, as a result we can plot x
as a function of y[L][x]
. This can be done in the following way:
With[{L = 0.004}, With[{plot = Plot[Evaluate[y[L][x] /. sol],
{x, Sequence @@ First[(y[L] /. sol)["Domain"]]}, PlotRange -> All]},
ListLinePlot[First[Cases[plot, Line[x_] :> x, Infinity]] /. {x_, y_} :> {y, x},
PlotRange -> All, Frame -> True, FrameLabel -> {HoldForm[y[x]], HoldForm[x]},
GridLines -> {None, {L}}, GridLinesStyle -> Directive[Thick, Gray],
PlotRangePadding -> {Automatic, {Automatic, Scaled[0.1]}},
Epilog -> Text["L level", {y[L][L/10] /. sol, L}, {0, 1.1}]]]]

One can also use Manipulate
:
Manipulate[With[{plot = Plot[Evaluate[y[L][x] /. sol],
{x, Sequence @@ First[(y[L] /. sol)["Domain"]]}, PlotRange -> All]},
ListLinePlot[First[Cases[plot, Line[x_] :> x, Infinity]] /. {x_, y_} :> {y, x},
PlotRange -> All, Frame -> True, FrameLabel -> {HoldForm[y[x]], HoldForm[x]},
GridLines -> {None, {L}}, GridLinesStyle -> Directive[Thick, Gray],
PlotRangePadding -> {Automatic, {Automatic, Scaled[0.1]}},
Epilog -> Text["L level", {y[L][L/10] /. sol, L}, {0, 1.1}]]],
{{L, 0.004}, 0.002, 0.02, 0.002, Appearance -> "Labeled"}]
With parameters given this (both Manipulate
and ListLinePlot
) only works up to L = 0.006
, then the shape of the plot is changed, and one has to comment out Epilog
part to plot for greater values of L
.
y[x]
with parameterL
and some initial condition, this can be done like:δp[L_]:=2*σ/L - g*(ρ*L)/2; sol = ParametricNDSolve[{1 + y'[x]/Sqrt[(1 + y'[x]^2)] == x^2/(2*a^2) + (δp[L]*x)/σ + (1 + Cos[θ]), y[0] == 0}, y, {x, 0, 1}, {L}]
. Then he can ploty'
:Plot[y'[0.004][x] /. sol, {x, Sequence @@ First[(y[0.004] /. sol)["Domain"]]}]
, I substituted in here value ofL
given in question. $\endgroup$y'[x], or do you want to solve for and plot the function
y[x]`? $\endgroup$==
, not=
which is an assignment. So you likely want1 + y'[x]/Sqrt[(1 + y'[x]^2)] == x^2/(2*a^2) + (δp*x)/σ + (1 + Cos[θ])
$\endgroup$