[英]Graphical solution to equation with Bessel functions in Python
我想繪制以下解決方案:
J1(X)/(X * J0(X))+ K1(Y)/(Y * K0(Y))= 0
使用Python
如果plot_implicit
從sympy
以這種方式與貝塞爾函數的工作:
plot_implicit(Eq(besselj(1,x)/(x*besselj(0,x))+besselk(1,y)/(y*besselk(0,y))))
這樣的事情就是我想要的。 但它並沒有為我工作-可能plot_implicit
不能接受besselj
和besselk
從mpmath
(至少不是以這種方式微不足道)。
如何正確執行?
編輯如果以上情況令人困惑。 調用besselj
和besselk
不起作用,因為我使用了它們的mpmath
版本,存在它們可以使用的sympy
版本。 在上述版本中,我還缺少tel指出的, 0
。
實際上,您可以使用Sympy和plot_implicit
獲得所需的內容。 您只需要使用Sympy本身提供的Bessel函數的版本。 但是, plot_implicit
似乎確實在與這個特定的eq斗爭:
import sympy as sym
x,y = sym.symbols('x y')
sym.plot_implicit(sym.Eq(sym.besselj(1,x)/(x*sym.besselj(0,x))+sym.besselk(1,y)/(y*sym.besselk(0,y)), 0), adaptive=False, points=100)
輸出:
我也收到警告:
/Users/tel/git/sympy/sympy/plotting/experimental_lambdify.py:165: UserWarning: The evaluation of the expression is problematic. We are trying a failback method that may still work. Please report this as a bug.
warnings.warn('The evaluation of the expression is'
您可以通過增加對implicit_plot
的調用中的points
arg的值來提高結果的准確性。 請注意,如果將其增加很多,可能要花費很長時間(例如直到太陽燃燒掉)才能進行計算。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.