Series Expansion
Answering the question we show how to construct the series expansion of f[x]
about x=0
.
From the basic equation we find
f'[x]==2(Log[a x + b]-Log[Cosh[f[x]]])
the derivative of f[x]
in terms of the function f[x]
itself and some other terms.
Hence in the Taylor expansion of the function
f[x] = f[0] + x f'[0] + x^2/2! f''[0] + x^3/3! f'''[x] + ...
we can replace f'[x]
by
g[x_] = 2 (Log[a x + b] - Log[Cosh[f[x]]]);
f''[x]
is then replaced by g'[x]
which in turn is expressed by f[x]
via
g'[x]
(* Out[62]= a/(b + a x) - Tanh[f[x]] Derivative[1][f][x] *)
where f'[x]
on the right hand side must be replaced by g[x]
and so on.
This means that all coefficients of the Tayor expansion are expressed in terms of f[0]
, a
, and b
.
In order to formalize this procedure in Mathematica we define recursively the auxiliary functions
g[k_, x_] := D[g[k - 1, x], x] /. f'[x] -> g[x]
g[1, x_] = g[x];
The first few functions are
Table[g[k, x], {k, 1, 3}] // Column
$\begin{array}{l}
\{\text{Log}[b+a x]-\text{Log}[\text{Cosh}[f[x]]]\} \\
\left\{\frac{a}{b+a x}-(\text{Log}[b+a x]-\text{Log}[\text{Cosh}[f[x]]]) \text{Tanh}[f[x]]\right\} \\
\left\{-\frac{a^2}{(b+a x)^2}-(\text{Log}[b+a x]-\text{Log}[\text{Cosh}[f[x]]])^2 \text{Sech}[f[x]]^2-\text{Tanh}[f[x]] \left(\frac{a}{b+a x}-(\text{Log}[b+a x]-\text{Log}[\text{Cosh}[f[x]]]) \text{Tanh}[f[x]]\right)\right\} \\
\end{array}$
Hence the requested series expansion to order n is given by
fs[x_, n_] := f[0] + Sum[x^k/k! (g[k, x] /. x -> 0), {k, 1, n}]
Example n=3
fs[x, 3]
$\text{f0}+x (\text{Log}[b]-\text{Log}[\text{Cosh}[\text{f0}]])+\frac{1}{2} x^2 \left(\frac{a}{b}-(\text{Log}[b]-\text{Log}[\text{Cosh}[\text{f0}]]) \text{Tanh}[\text{f0}]\right)+\frac{1}{6} x^3 \left(-\frac{a^2}{b^2}-(\text{Log}[b]-\text{Log}[\text{Cosh}[\text{f0}]])^2 \text{Sech}[\text{f0}]^2-\text{Tanh}[\text{f0}] \left(\frac{a}{b}-(\text{Log}[b]-\text{Log}[\text{Cosh}[\text{f0}]]) \text{Tanh}[\text{f0}]\right)\right)$
Numerical calculation of f(x) via an ODE
This was my original text, which, however, is not an answer to the problem.
Solving for f' you can write your equation as an ODE
eq = f'[x]/2 == Log[a x + b] - Log[Cosh[f[x]]];
Then solve it numerically after having defined the values of the parameters a and b.
For example
a = 1; b = 1;
ff[x_] = f[x] /.
NDSolve[f'[x]/2 == Log[a x + b] - Log[Cosh[f[x]]] && f[0] == 1, f[x], {x, -2, 10}][[1]]
Plot the function
Plot[ff[x], {x, -2, 10}, PlotRange -> {0, 10}]
(* 141107_NDSolve.jpg *)

You can play with the values of the parameters and the initial condition to adapt the problem to the situation you want.
Regards,
Wolfgang
DSolve[]
before asking $\endgroup$Exp[-1/2*D[f[x],x]]*...
. (2) Possibly what you want is to subtract rhs from lhs, takeser = Series[..., {x,0,4}]
for example, and thenSolveAlways[ser,x]
. (I'd test it but you didn't include that input...) $\endgroup$