生成正交函数集
OrthogonalFunctions的Python项目详细描述
正交函数
生成一组正交函数的python包。在
说明
此脚本基于由定义的一组非正交函数,生成一组称为
的正交函数
正交规范化函数是
的线性组合
函数在区间
中相对于权重函数
是正交的。也就是说
其中是Kronecker delta函数。正交函数由Gram-Schmidt orthogonalization process生成。{a1python生成一个符号函数,使用这个符号包。在
安装
方法1:使用PyPi上提供的包进行安装
python -m pip install OrthogonalFunctions
在方法2:直接从源代码安装
^{pr2}$ 在
用法
该软件包有两种使用方法:
1。作为模块导入
fromOrthogonalFunctionsimportOrthogonalFunctions# Create an objectOF=OrthogonalFunctions()# Generate FunctionsOF.Process()# Print FunctionsOF.Print()# Check mutual orthogonality of FunctionsOF.Check()# Plot FunctionsOF.Plot()
OrthogonalFunctions还接受一些参数:
# Specify any or all of the three parameters belowOF=OrthogonalFunctions(StartFunctionIndex=1,NumFunctions=9,EndInterval=1)# The rest is the same as before.
参数包括:
- StartFunctionIndex:起始函数的索引
。默认值为1。在
- NumFunctions:要生成的正交函数的数目,
。默认值为9。在
- EndInterval:正交性的右区间
。默认值为1。在
2。独立应用程序
独立的应用程序可以通过两种方式在终端中执行:
如果已安装包,请在终端中调用gen-orthoexecutable:
gen-ortho [options]
{tt9}将在下一个^ 9节中解释可选参数。安装包OrthogonalFunctions时,可执行文件gen-ortho位于python的/bin目录中。在
在在不安装包的情况下,可以直接从源代码执行包的主脚本,方法是
# Download the package git clone https://github.com/ameli/Orthogonal-Functions.git # Go to the package source directory cd OrthogonalFunctions # Execute the main script of the package python -m OrthogonalFunctions [options]
在
可选参数
当调用独立应用程序(上面的第二个方法)时,可执行文件接受一些可选参数,如下所示。在
Option | Description |
---|---|
^{tt12}$, ^{tt13}$ | Prints a help message. |
^{tt14}$, ^{tt15}$ | Prints version. |
^{tt16}$, ^{tt17}$ | Prints author info, citation and license. |
^{tt18}$, ^{tt19}$ | Number of orthogonal functions to generate. Positive integer. Default is 9. |
^{tt20}$, ^{tt21}$ | Starting function index. Non-negative integer. Default is 1. |
^{tt22}$, ^{tt23}$ | End of the interval of functions domains. A real number greater than zero. Default is 1. |
^{tt24}$,^{tt25}$ | Checks orthogonality of generated functions. |
^{tt26}$, ^{tt27}$ | Plots generated functions, also saves the plot as pdf file in the current directory. |
参数
变量、
和
可以通过以下参数在脚本中设置
示例
从索引1到9生成九个正交函数(默认)
gen-ortho
在从索引1到8生成八个正交函数
gen-ortho -n 8
在生成从索引0到8的九个正交函数
gen-ortho -s 0
在在区间[0,10]中生成九个正交函数
gen-ortho -e 10
在检查每两个函数的正交性,绘制正交函数并将绘图保存到pdf
gen-ortho -c -p
在一个完整的例子:
gen-ortho -n 9 -s 1 -e 1 -c -p
在
输出
- 将正交函数显示为计算机代数符号函数。下面是一组生成函数的示例。在
phi_1(t) = sqrt(x) phi_2(t) = sqrt(6)*(5*x**(1/3) - 6*sqrt(x))/3 phi_3(t) = sqrt(2)*(21*x**(1/4) - 40*x**(1/3) + 20*sqrt(x))/2 phi_4(t) = sqrt(10)*(84*x**(1/5) - 210*x**(1/4) + 175*x**(1/3) - 50*sqrt(x))/5 phi_5(t) = sqrt(3)*(330*x**(1/6) - 1008*x**(1/5) + 1134*x**(1/4) - 560*x**(1/3) + 105*sqrt(x))/3 phi_6(t) = sqrt(14)*(1287*x**(1/7) - 4620*x**(1/6) + 6468*x**(1/5) - 4410*x**(1/4) + 1470*x**(1/3) - 196*sqrt(x))/7 phi_7(t) = 5005*x**(1/8)/2 - 10296*x**(1/7) + 17160*x**(1/6) - 14784*x**(1/5) + 6930*x**(1/4) - 1680*x**(1/3) + 168*sqrt(x) phi_8(t) = sqrt(2)*(19448*x**(1/9) - 90090*x**(1/8) + 173745*x**(1/7) - 180180*x**(1/6) + 108108*x**(1/5) - 37422*x**(1/4) + 6930*x**(1/3) - 540*sqrt(x))/3 phi_9(t) = sqrt(5)*(75582*x**(1/10) - 388960*x**(1/9) + 850850*x**(1/8) - 1029600*x**(1/7) + 750750*x**(1/6) - 336336*x**(1/5) + 90090*x**(1/4) - 13200*x**(1/3) + 825*sqrt(x))/5
- 显示函数的可读系数
和
。例如
i alpha_i a_[ij] ------ ---------- ----------------------------------------------------------------------- i = 1: +sqrt(2/2) [1 ] i = 2: -sqrt(2/3) [6, -5 ] i = 3: +sqrt(2/4) [20, -40, 21 ] i = 4: -sqrt(2/5) [50, -175, 210, -84 ] i = 5: +sqrt(2/6) [105, -560, 1134, -1008, 330 ] i = 6: -sqrt(2/7) [196, -1470, 4410, -6468, 4620, -1287 ] i = 7: +sqrt(2/8) [336, -3360, 13860, -29568, 34320, -20592, 5005 ] i = 8: -sqrt(2/9) [540, -6930, 37422, -108108, 180180, -173745, 90090, -19448 ] i = 9: +sqrt(2/10) [825, -13200, 90090, -336336, 750750, -1029600, 850850, -388960, 75582]
- 显示要检查正交性的函数的相互内积的矩阵(使用选项-c)。函数互内积生成矩阵的一个例子如下所示。在
[[1 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0] [0 0 0 0 1 0 0 0 0] [0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 1]]
- 绘制函数集(使用选项-p)并将绘图保存在当前目录中。考试生成图的le如下所示。在
引文
Ameli,S.和Shadden。S、 C.(2020年)。插值矩阵A+t^{str1}$B的逆迹。arXiv:2009.07385[数学.NA]在
@misc{AMELI-2020, title={Interpolating the Trace of the Inverse of Matrix $\mathbf{A} + t \mathbf{B}$}, author={Siavash Ameli and Shawn C. Shadden}, year={2020}, month = sep, eid = {arXiv:2009.07385}, eprint={2009.07385}, archivePrefix={arXiv}, primaryClass={math.NA}, howpublished={\emph{arXiv}: 2009.07385 [math.NA]}, }
- 项目
标签: