# DSolve is not able to find a solution in some points

When I use the below script to solve an equation and plot the solution, the plot shows some discontinuous lines. For example at point $$x\approx0.25$$ the solver cannot find the answer and the plot is discontinuous. How can I fix this problem?

Clear["Global*"]

c = -0.8;
L = 1;
b = Pi/L;

{x1, x2} = {0, L};

eqn = f[x] == c Sin[2 f[x]] + b x + Pi/2;

f[x_] = f[x] /.
DSolve[{D[eqn, x],
f == (f0 /.
Solve[(eqn /. x -> 0 /. f -> f0), f0, Reals][])},
f[x], {x, x1, x2}][] // FullSimplify

(*InverseFunction[-(1/2) Cos[2 #1]+#1&][(11 x)/10]*)

Plot[f[x], {x, x1, x2}]

• Plot does not plot complex numbers. With your code f[0.1]=1.09728 -0.320829 I. You can choose to plot the real part with Re[f[x]] – Bill Watts Jun 27 at 20:38

$Version (* "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)" *) Clear["Global*"] c = -4/5; L = 1; b = Pi/L; {x1, x2} = {0, L}; eqn = f[x] == c Sin[2 f[x]] + b x + Pi/2;  The equation does not identify a unique initial condition ic = f0 /. Solve[(eqn /. x -> 0 /. f -> f0), f0, Reals] Only one of the possible initial conditions leads to a solution sol = Table[ DSolve[{D[eqn, x], f == ic[[n]]}, f[x], {x, x1, x2}] // FullSimplify, {n, 1, 3}] // Quiet f[x_] = f[x] /. sol[[2, 1]];  Not all values of x produce real results f[0.115] (* 1.0972751444995646 - 0.3208287706939249 I *)  Plotting, Plot[f[x], {x, x1, x2}, PlotRange -> {0, 5.8}, WorkingPrecision -> 15, Exclusions -> All, PlotPoints -> 50, MaxRecursion -> 2] ` • I had tried to find coefficients$c_1$and$c_2$myself so that$\sin(2f(x=0))=\sin(2f(x=L))$and also$\cos(2f(x=0))=\cos(2f(x=L))\$ – Alex Stark Jun 28 at 3:25