生成正交函数集

OrthogonalFunctions的Python项目详细描述


travis-develcodecov-devellicenceformatpypiimplementationpyversions

正交函数

生成一组正交函数的python包。在

对于用户
面向开发者

说明

此脚本基于由定义的一组非正交函数image10,生成一组称为image09的正交函数

https://raw.githubusercontent.com/ameli/Orthogonal-Functions/master/docs/images/Equation_phi_i.svg

正交规范化函数image11image12的线性组合

https://raw.githubusercontent.com/ameli/Orthogonal-Functions/master/docs/images/Equation_phi_i_perp.svg

函数image13在区间image14中相对于权重函数image15是正交的。也就是说

https://raw.githubusercontent.com/ameli/Orthogonal-Functions/master/docs/images/Equation_orthogonality.svg

其中image16是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:起始函数的索引image23。默认值为1。在
  • NumFunctions:要生成的正交函数的数目,image24。默认值为9。在
  • EndInterval:正交性的右区间image25。默认值为1。在

2。独立应用程序

独立的应用程序可以通过两种方式在终端中执行:

  1. 如果已安装包,请在终端中调用gen-orthoexecutable:

    gen-ortho [options]
    

    {tt9}将在下一个^ 9节中解释可选参数。安装包OrthogonalFunctions时,可执行文件gen-ortho位于python的/bin目录中。在

  2. 在不安装包的情况下,可以直接从源代码执行包的主脚本,方法是

    # 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]
    

可选参数

当调用独立应用程序(上面的第二个方法)时,可执行文件接受一些可选参数,如下所示。在

OptionDescription
^{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.

参数

变量image17image18image19可以通过以下参数在脚本中设置

^{tb2}$

示例

  1. 从索引1到9生成九个正交函数(默认)

    gen-ortho
    
  2. 从索引1到8生成八个正交函数

    gen-ortho -n 8
    
  3. 生成从索引0到8的九个正交函数

    gen-ortho -s 0
    
  4. 在区间[0,10]中生成九个正交函数

    gen-ortho -e 10
    
  5. 检查每两个函数的正交性,绘制正交函数并将绘图保存到pdf

    gen-ortho -c -p
    
  6. 一个完整的例子:

    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
  • 显示函数的可读系数image26image27。例如
  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如下所示。在
https://raw.githubusercontent.com/ameli/Orthogonal-Functions/master/docs/images/OrthogonalFunctions.svg

引文

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]},
}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java从远程安卓应用程序打开/关闭嵌套   java在每个请求上获取memcache变量导致问题   如何在java中使用itext获取pdf文件的标题   java如何使用firebase令牌发送通知?   java不能在spring数据聚合中包含嵌套字段   用于调度作业的java Cron表达式   java当我使用TabActivity 安卓时,TabActivity类型已被弃用   加密Java Bouncy Castle加密使用AES加密   awt Java,将GUI与ActionListener类分离   如何在Java中创建一个根据输入返回枚举的方法?   java什么是Gxt 3.1.1实现对话框的方法。Gxt 3.0.0是否支持getHideButton()?   java如何解决构建错误?   java XWPF POI如何设置段落中的文本而不使用换行符