Solving an equation for a space dependent variable
Clear["Global`*"]
c = 1/2;
b = 11/10;
{x1, x2} = {-10, 10};
eqn = f[x] == c Cos[2 f[x]] + b x;
f[x_] = f[x] /.
DSolve[{D[eqn, x], f[0] == (f0 /.
Solve[(eqn /. x -> 0 /. f[0] -> f0), f0,
Reals][[1]])}, f[x], {x, x1, x2}][[1]] //
FullSimplify
(* InverseFunction[-(1/2) Cos[2 #1] + #1 &][(11 x)/10] *)
Plot[f[x], {x, x1, x2}]
Plot[Sin[f[x]], {x, x1, x2}]
This kind of problem can be solved with FixedPoint
iteration. I've used 500 iterations max:
c = 1/2.;
b = 1.1;
g[x_, y_] := c Cos[2 y] + b*x
fp[x_] := FixedPoint[g[x, #] &, x, 500]
ListLinePlot[Table[{x, fp[x]}, {x, -10, 10, .25}],
AxesLabel -> {"x", "f[x]"}]
ListLinePlot[Table[{x, Sin@fp[x]}, {x, -10, 10, .25}],
AxesLabel -> {"x", "Sin[f[x]]"}]
You can verify that fp is good by checking the error at a given $x$ for example when $x=5$ we have the error g[5, fp[5]] - fp[5]
which is a very small number: 1.40502*10^-10
. Increase the iterations if you want it smaller.