如何绘制自定义贝塞尔函数?

如何绘制自定义贝塞尔函数?

该函数是一个复合函数,以贝塞尔函数为一部分的复函数。

在此处输入图片描述

J_0贝塞尔函数在哪里

答案1

更新:看来 OP 想要这个:

在此处输入图片描述

// http://asymptote.ualberta.ca/
usepackage("amsmath"); 
import graph;  
size(12cm,8cm,IgnoreAspect); 
real xmin=1,xmax=2, ymin=-.03,ymax=.03; 
pair f(real x){return (x,Jn(0,170x)*cos(100x)/(x^2+1));} 
guide gf=graph(f,xmin,xmax,n=1000);
draw((1,0)--(2,0),gray);
draw(gf,blue+.8pt); 
label("$F(x)=\dfrac{\cos(100x)}{x^2+1}J_0(170x)$",(2,.02),4W); xaxis("$\mathbf{x}$",BottomTop,LeftTicks); yaxis("$\mathbf{F(x)}$",LeftRight,RightTicks);

shipout(bbox(5mm,invisible));

老的:渐近线图(https://www.overleaf.com/read/mvryqvrtgqrp

在此处输入图片描述

// http://asymptote.ualberta.ca/
import graph; 
size(12cm,8cm,IgnoreAspect);
real xmin=1,xmax=2, ymin=-.03,ymax=.03;
pair f(real x){return (x,Jn(0,170x)*cos(100x)/(x^2+1));}
guide gf=graph(f,xmin,xmax,n=1000);
draw(gf,red);
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$F(x)$",LeftRight,RightTicks(trailingzero));
label("Levin function $F(x)=\frac{\cos(100x)}{x^2+1}J_0(170x)$",point(N),2N);

答案2

开源计算机代数系统 SAGE 知道贝塞尔函数鼠尾草包允许您访问 LaTeX 文档。这可确保计算正确;对于像您这样的复杂函数,的准确性pgfplots往往会受到影响。通过使用sagetex包,您可以使用绘制坐标(由 SAGE 创建)pgfplots

以下是示例代码:

\documentclass[border=3pt]{standalone}
\usepackage{sagetex,pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{sagesilent}
f=cos(100*x)/(x^2+1)*bessel_J(0,170*x)
step = .001
x_coords = [x for x in srange(1,2+step,step)]
y_coords = [f(x=x).n(digits=4) for x in x_coords]
output = r"\begin{tikzpicture}"
output += r"\begin{axis}[xmin=1,xmax=2,ymin=-.03,ymax=.03]"
output += r"\addplot[thin, blue, smooth] coordinates {"
for i in range(0,len(x_coords)-1):
    output += r"(%f , %f) "%(x_coords[i],y_coords[i])
output += r"};"
output += r"\end{axis}"
output += r"\end{tikzpicture}"
\end{sagesilent}
\sagestr{output}
\end{document}

Cocalc 中的输出如下所示:

在此处输入图片描述

SAGE 不包含在您的 LaTeX 发行版中。最简单的尝试方法是创建一个免费的可钙帐户——不到 5 分钟即可完成。您也可以将 SAGE 下载到您的计算机并使其与您的 LaTeX 发行版进行通信,但这将花费更多时间并且可能更加困难。

相关内容