You can get a symbolic formula approximating the solution via Chebyshev series, which can be computed as shown in About multi-root search in Mathematica for transcendental equations.
As @Carl Woll observed, your equation is a function of m == M/T
and S
. If we solve for m
as a function of S
, we can then get a formula for T = M/m
.
From a comment, we get the domain for S
needed to compute the Chebyshev series:
M can be between 1 and 200 and S can be between 0.01 to 0.07.
Below, we used FourierDCT
to compute the Chebyshev coefficients. We have to find the values of m
as S
ranges over the Chebyshev nodes. We use FindRoot
to do this with high precision, so that we can construct a near machine-precision approximation to m
, which is given by m = mFN[S]
.
eqn = M S + (T/0.755) - (T/0.755)*Cosh[M/(2 T/0.755)] // Rationalize;
eqn3 = eqn/T /. {M -> m T} // Simplify; (* m == M/T, or T == M/m *)
Block[{n = 32, S1, S2, S, snodes, (*coeffs,*) coeffs2, mvals, m},
{S1, S2} = Rationalize@{0.01, 0.07}; (* domain for S *)
snodes = Rescale[Sin[Pi/2 Range[n, -n, -2]/n], {-1, 1}, {S1, S2}];
mvals = m /. Rest@FoldList[
FindRoot[eqn3 /. S -> #2, {m, m /. #1, 1/10, 1000}, WorkingPrecision -> 40] &,
{m -> 10 Sqrt[S1]}, snodes];
coeffs2 = Sqrt[2/n] FourierDCT[mvals, 1];
coeffs2[[{1, -1}]] /= 2;
coeffs = Drop[coeffs2, (* drop coefficients smaller than machine precision *)
Module[{sum = 0}, -LengthWhile[
Reverse@coeffs2, (sum += Abs[#]) < Abs[First@coeffs2] $MachineEpsilon &]]];
With[{s1 = S1, s2 = S2, cc = coeffs, k = Length@coeffs - 1},
mFN = Function[{S}, (* solution for m *)
cc.Cos[Range[0, k] ArcCos[Rescale[S, {s1, s2}, {-1, 1}]]]
]]
];
tFN = Function[{M, S}, M/mFN[S]]; (* solution for t *)
Answer:
Here is the double-precision formula for t
that is an approximate solution to the OP's equation:
N[tFN[M, S]] (* formula for t *)
(*
M/(0.4221956380745171` +
0.31559498734947056` (-1.3333333333333333` + 33.333333333333336` S) -
0.0007452700193212066` Cos[2.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] -
0.00008989046047576488` Cos[3.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] +
9.349727403445521`*^-7 Cos[4.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] +
6.316071780569096`*^-8 Cos[5.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] -
1.2738992410763405`*^-9 Cos[6.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] -
5.477086714861503`*^-11 Cos[7.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] +
1.7873875250882988`*^-12 Cos[8.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] +
4.9699383243064014`*^-14 Cos[9.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]] -
2.529762133661728`*^-15 Cos[10.` ArcCos[-1.3333333333333333` + 33.333333333333336` S]])
Simple check of accuracy: is there a small residual?
eqn /. T -> tFN[M, S] /. {M -> RandomReal[{1, 200}, 1000],
S -> RandomReal[{0.01, 0.07}, 1000]} // Abs // Max
(* 4.54747*10^-13 *)
Somewhat more sophisticated look: We compare the residual error with the largest of the three terms in eqn
, divided by $MachineEpsilon
:
Total[#, {2}]/Max /@ Abs[#] &@Transpose[
List @@ eqn /.
T -> tFN[M, S] /. {M -> RandomReal[{1, 200}, 10000],
S -> RandomReal[{0.01, 0.07}, 10000]}
]/$MachineEpsilon //
Histogram[#, Automatic, "LogCount",
AxesLabel -> {"Error (ϵ)", "Count"},
PlotLabel -> "Error distibution relative to largest term of eqn ε_mach"] &
Almost half of the values, 4600
out of 10000
, have zero error. Most of the rest have a 1 ulp error.
Update: avoiding transcendental functions
I forgot to mention Clenshaw's recurrence for evaluating a Chebyshev series. The code used in mFN
is an efficient way to compute mFN[S]
in the Mathematica computational environment, even with the trigonometric functions. However, it is just a polynomial and can be computed without a math library. The best way is to use the Clenshaw recurrence (see chebeval
here for instance).
If desired, one can see the polynomial expression by changing the code for mFM
to the following:
mFN = Function[{S}, cc.ChebyshevT[Range[0, k], Rescale[S, {s1, s2}, {-1, 1}]]]
cosh
should beCosh
. Secondly, this is a transcendental equation that likely can't be solved analytically. You will probably need to useFindRoot
with numbers in place ofM
andS
. $\endgroup$