Assuming I have the following four equations:
- cos(x)/x = a
- cos(y)/y = b
- a + b = 1
- c sinc(x) = d sinc(y)
for unknown variables x, y, a
and b
. Note that cos(x)/x=a
has multiple solutions. Similar goes for variable y
. I am only interested in x
and y
values, which are first positive roots (if that matters).
You can safely assume a, b, c
and d
are known real constants, all positive.
In Mathematica the code to solve this would look something like:
FindRoot[{Cos[x]/x == 0.2 a + 0.1,
Cos[y]/y == 0.2 b + 0.1,
a + b == 1.0,
1.03*Sinc[x] == Sinc[y]*1.02},
{{x, .1}, {y, .1}, {a, .3}, {b, .1}}]
which as a result returns
{x -> 1.31636, y -> 1.29664, a -> 0.456034, b -> 0.543966}
While this was quite easy, I have no idea how to do anything like that in python. So if somebody could kinda guide me (or simply show me how) to solve this, I would highly appreciate it.