I have to solve the following transcendental equation
cos (x) / x = s
for a given constant c.
For example, I made a short code in Mathematica, where I created a list of random values ββfor the constant c
const = Table[RandomReal[{0, 5}], {i, 1, 10}]
(*{1.67826, 0.616656, 0.290878, 1.10592, 0.0645222, 0.333932, 3.59584, \
2.70337, 3.91535, 2.78268}*)
How did I define the function
f[x_, i_] := Cos[x]/x - const[[i]]
and started looking for roots:
Table[FindRoot[f[x, i] == 0, {x, 0.1}][[1, 2]], {i, 1, Length[const]}]
(*{0.517757, 0.947103, 1.21086, 0.694679, 1.47545, 1.16956, 0.26816, \
0.347764, 0.247615, 0.338922}*)
Now I would like to program something like this in python (perhaps using numpy?), But I cannot find a good answer to a similar problem. Can anyone help?