Sharedphase_speed.ipynbOpen in CoCalc
Author: Sergey Anfinogentov
Views : 16
Description: Jupyter notebook phase_speed.ipynb
In [1]:
from sympy import * init_printing()

Задаем переменные

In [ ]:
In [2]:
gamma = symbols('gamma') c = symbols('c_s') g0 = symbols('g_0') a = symbols('alpha') v = symbols('v_p') w = symbols('omega')

Выражение для ω0\omega_0

In [3]:
w0 = (gamma * g0 * cos(a))/(2*c) w0
g0γ2cscos(α)\frac{g_{0} \gamma}{2 c_{s}} \cos{\left (\alpha \right )}

Правая часть выражения для фазовой скорости

In [4]:
rhs = c/sqrt(1 -(w0/w)**2) rhs
cs1g02γ2cos2(α)4cs2ω2\frac{c_{s}}{\sqrt{1 - \frac{g_{0}^{2} \gamma^{2} \cos^{2}{\left (\alpha \right )}}{4 c_{s}^{2} \omega^{2}}}}

Решаем уравнение на csc_s в общем виде

In [5]:
solve(rhs-v,c)
[22vp2vpωg02γ2cos2(α)+ω2vp2,22vp2vpωg02γ2cos2(α)+ω2vp2,22vp2+vpωg02γ2cos2(α)+ω2vp2,22vp2+vpωg02γ2cos2(α)+ω2vp2]\left [ - \frac{\sqrt{2}}{2} \sqrt{v_{p}^{2} - \frac{v_{p}}{\omega} \sqrt{- g_{0}^{2} \gamma^{2} \cos^{2}{\left (\alpha \right )} + \omega^{2} v_{p}^{2}}}, \quad \frac{\sqrt{2}}{2} \sqrt{v_{p}^{2} - \frac{v_{p}}{\omega} \sqrt{- g_{0}^{2} \gamma^{2} \cos^{2}{\left (\alpha \right )} + \omega^{2} v_{p}^{2}}}, \quad - \frac{\sqrt{2}}{2} \sqrt{v_{p}^{2} + \frac{v_{p}}{\omega} \sqrt{- g_{0}^{2} \gamma^{2} \cos^{2}{\left (\alpha \right )} + \omega^{2} v_{p}^{2}}}, \quad \frac{\sqrt{2}}{2} \sqrt{v_{p}^{2} + \frac{v_{p}}{\omega} \sqrt{- g_{0}^{2} \gamma^{2} \cos^{2}{\left (\alpha \right )} + \omega^{2} v_{p}^{2}}}\right ]

Подставляем значения и получаем численные решения

In [6]:
rhs_n = rhs.subs([(g0,0.274), (gamma,5./3), (w,2*pi/180.),(a, pi*0.0)]) v_n = v.subs(v, 30) solve(rhs_n-v_n,c)
[6.71136607686232,29.2396574087718]\left [ 6.71136607686232, \quad 29.2396574087718\right ]

Строим графики правой и левой части уравнения и смотрим, где они пересекаются

In [1]:
p1 = plot(rhs_n,v_n, (c,-40,40),show = False, ylim = [-50,50]) p1[0].line_color = 'red' p1[1].line_color = 'green' p1.show()
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-57f06f1cac9a> in <module>() ----> 1 p1 = plot(rhs_n,v_n, (c,-40,40),show = False, ylim = [-50,50]) 2 p1[0].line_color = 'red' 3 p1[1].line_color = 'green' 4 p1.show() NameError: name 'plot' is not defined
In [ ]: