I have to solve the following transcendental equation
cos(x)/x=c
for given constant c.
For example I did a short code in Mathematica, where I generated a list of random values for 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}*)
Than I defined the function
f[x_, i_] := Cos[x]/x - const[[i]]
and started looking for the 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 love to programme something similar in python (probably using numpy?) but I can't really find any good existing answer to a problem like that. Could somebody help?