SciPy:scipy.special.fresnel(x [,out1,out2])中的参数是什么? [英] SciPy: What are the arguments in `scipy.special.fresnel(x[, out1, out2])`?
问题描述
我正在尝试使用SciPy绘制回旋函数. 此处是菲涅耳积分的语法,但我无法理解scipy.special.fresnel(x[, out1, out2])
中的参数x
,out1
,out2
是什么?说明中的公式是关于t
和z
的,它们不在函数中.
I am trying to plot a clothoid function using SciPy. Here is the syntax for the Fresnel integrals but I cannot understand what are the arguments x
, out1
, out2
in scipy.special.fresnel(x[, out1, out2])
? Formulas in the description are about t
and z
, which are not in the function.
推荐答案
参数out1
和out2
是可选的.您可以使用
The arguments out1
and out2
are optional. You can use
s, c = fresnel(x)
文档字符串中显示的参数z
是x
参数.不幸的是,差异-文档字符串应与函数签名一致.
The argument z
shown in the docstring is the x
argument. That is an unfortunate discrepancy--the docstring should be consistent with the function signature.
如果已经有要在其中放置函数调用结果的数组,则可以使用参数out1
和out2
.这使您可以通过重用现有阵列来节省内存.
The arguments out1
and out2
can be used if you already have arrays in which you want to put the results of the function call. This allows you to save memory by reusing existing arrays.
请注意,函数的scipy实现将pi/2缩放参数.请参阅维基百科文章中有关此内容的注释: http://en.wikipedia.org/wiki/Fresnel_integral
Note that the scipy implementation of the function scales the argument by pi/2. See the notes about this in the wikipedia article: http://en.wikipedia.org/wiki/Fresnel_integral
此脚本将生成维基百科文章中显示的第一张图:
This script will generate the first plot shown in the wikipedia article:
import numpy as np
from scipy.special import fresnel
import matplotlib.pyplot as plt
t = np.linspace(0, 5.0, 201)
ss, cc = fresnel(t / np.sqrt(np.pi / 2))
scaled_ss = np.sqrt(np.pi / 2) * ss
scaled_cc = np.sqrt(np.pi / 2) * cc
plt.plot(t, scaled_cc, 'g--', t, scaled_ss, 'r-', linewidth=2)
plt.grid(True)
plt.show()
这篇关于SciPy:scipy.special.fresnel(x [,out1,out2])中的参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!