I am trying to get the solutions of an inequality which has several variables. These variables move within intervals I have defined with assume
. When I call solve
the assumptions seem to be ignored. Below is my code:
variables = var('n_s','alpha','n_p','m','omega_p')
for variable in variables:
assume(variable, 'real')
for refractive_index in {n_s, n_p}:
assume(refractive_index > 1)
assume(0 < alpha, alpha < 1)
assume(omega_p > 0)
assume(m > 0)
assume(m < omega_p)
Xi = ((1-alpha)**2-(m/omega_p)**2)**(1/2)
expression = (n_s**2*alpha**2 + n_p**2 - Xi)/(2*n_p*n_s*alpha)
solve([1>expression],[n_p])
and this produces the following output
[[0 < n_p,
0 < n_s,
0 < alpha,
-alpha^2*n_s^2 + 2*alpha*n_p*n_s - n_p^2 + sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[n_p < 0,
0 < n_s,
alpha < 0,
-alpha^2*n_s^2 + 2*alpha*n_p*n_s - n_p^2 + sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[0 < n_p,
n_s < 0,
alpha < 0,
-alpha^2*n_s^2 + 2*alpha*n_p*n_s - n_p^2 + sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[n_p < 0,
n_s < 0,
0 < alpha,
-alpha^2*n_s^2 + 2*alpha*n_p*n_s - n_p^2 + sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[0 < n_p,
0 < n_s,
alpha < 0,
alpha^2*n_s^2 - 2*alpha*n_p*n_s + n_p^2 - sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[n_p < 0,
0 < n_s,
0 < alpha,
alpha^2*n_s^2 - 2*alpha*n_p*n_s + n_p^2 - sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[0 < n_p,
n_s < 0,
0 < alpha,
alpha^2*n_s^2 - 2*alpha*n_p*n_s + n_p^2 - sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0],
[n_p < 0,
n_s < 0,
alpha < 0,
alpha^2*n_s^2 - 2*alpha*n_p*n_s + n_p^2 - sqrt((alpha^2 - 2*alpha + 1)*omega_p^2 - m^2)/omega_p > 0]]
This is clearly ignoring the assumptions, for example the second solution has alpha < 0
. Is it possible to somehow check for my assumptions automatically?