4
$\begingroup$

How can I find $f(x)$ in the interval $(x_1,x_2)$? I know the values of the coefficients as $c=0.5$, $b=1.1$ and $(x_1,x_2)=(-10,10)$.

f[x] == c Cos[2 f[x]] + b x

I want to find $f(x)$ and plot $\sin(f(x))$ in the interval $(x_1,x_2)$.

$\endgroup$

3 Answers 3

4
$\begingroup$
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}]

enter image description here

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

enter image description here

$\endgroup$
1
  • $\begingroup$ +1, nice and smooth. $\endgroup$
    – flinty
    Commented Jun 25, 2020 at 20:36
3
$\begingroup$

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.

fixed point fx

fixed point sin fx

$\endgroup$
1
$\begingroup$

In case you need to handle the symbolic dependence on $c$ and $b$

Clear[f, x, b, c]
f[x, 0] = x;
f[x_, k_] := f[x, k] = c Cos[2 f[x, k - 1]] + b x
f[x, 3]

n = 500;
c = 1/2;
b = 1.1;
fn = f[x, n];
Plot[fn, {x, -10, 10}]
Plot[Sin[fn], {x, -10, 10}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.