Package: ortho
A python package to generate a set of orthogonal functions.DocumentationAPI ReferenceGithubDescriptionThis package generates a set of orthonormal functions, called, based on the set of non-orthonormal functionsdefined by the inverse-monomialsThe orthonormalized functionsare the linear combination of the functionsbyThe functionsare orthonormal in the intervalwith respect to the weight function. That is,whereis the Kronecker delta function. The orthogonal functions are generated byGram-Schmidt orthogonalization process. This script produces the symbolic functions usingSympy, a Python computer algebraic package. An application of these orthogonal functions can be found in[1].Build and Test StatusPlatformArchPython VersionContinuous
Integration3.93.103.113.12LinuxX86-64✔✔✔✔AARCH-64✔✔✔✔macOSX86-64✔✔✔✔ARM-64✔✔✔✔WindowsX86-64✔✔✔✔ARM-64✔✔✔✔InstallInstall using either of the following three methods.1. Install from PyPiInstall using the package available onPyPibypip install ortho2. Install from Anaconda CloudInstall usingAnaconda cloudbyconda install -c s-ameli ortho3. Install from Source CodeInstall directly from the source code bygit clone https://github.com/ameli/ortho.git
cd ortho
pip install .TestingTo test the package, download the source code and use one of the following methods in the directory of the source code:Method 1: test locally by:python setup.py testMethod 2: test in a virtual environment usingtox:pip install tox
toxUsageThe package can be used in two ways:1. Import as a Module>>>fromorthoimportOrthogonalFunctions>>># Generate object of orthogonal functions>>>OF=OrthogonalFunctions(...start_index=1,...num_func=9,...end_interval=1,...verbose=True)>>># Get numeric coefficients alpha[i] and a[i][j]>>>alpha=OF.alpha>>>a=OF.coeffs>>># Get symbolic coefficients alpha[i] and a[i][j]>>>sym_alpha=OF.sym_alpha>>>sym_a=OF.sym_coeffs>>># Get symbolic functions phi[i]>>>sym_phi=OF.sym_phi>>># Print Functions>>>OF.print()>>># Check mutual orthogonality of Functions>>>status=OF.check(verbose=True)>>># Plot Functions>>>OF.plot()The parameters are:start_index: the index of the starting function,. Default is1.num_func: number of orthogonal functions to generate,. Default is9.end_interval: the right interval of orthogonality,. Default is1.2. Use As Standalone ApplicationThe standalone application can be executed in the terminal in two ways:If you have installed the package, callorthoexecutable in terminal:ortho [options]The optional argument[options]will be explained in the next section. When the packageorthois installed, the executableorthois located in the/bindirectory of the python.Without installing the package, the main script of the package can be executed directly from the source code by# Download the package
git clone https://github.com/ameli/ortho.git

# Go to the package source directory
cd ortho

# Execute the main script of the package
python -m ortho [options]Optional argumentsWhen thestandalone application(the second method in the above) is called, the executable accepts some optional arguments as follows.OptionDescription-h,--helpPrints a help message.-v,--versionPrints version.-l,--licensePrints author info, citation and license.-n,--num-func[=int]Number of orthogonal functions to generate. Positive integer. Default is 9.-s,--start-func[=int]Starting function index. Non-negative integer. Default is 1.-e,--end-interval[=float]End of the interval of functions domains. A real number greater than zero. Default is 1.-c,--checkChecks orthogonality of generated functions.-p,--plotPlots generated functions, also saves the plot as pdf file in the current directory.ParametersThe variables,, andcan be set in the script by the following arguments,VariableVariable in scriptOptionstart_index-s, or--start-funcnum_func-n, or--num-funcend_interval-e, or--end-intervalExamplesGenerate nine orthogonal functions from index 1 to 9 (defaults)orthoGenerate eight orthogonal functions from index 1 to 8ortho -n 8Generate nine orthogonal functions from index 0 to 8ortho -s 0Generate nine orthogonal functions that are orthonormal in the interval [0,10]ortho -e 10Check orthogonality of each two functions, plot the orthonormal functions and save the plot to pdfortho -c -pA complete example:ortho -n 9 -s 1 -e 1 -c -pOutputDisplays the orthogonal functions as computer algebraic symbolic functions. An example a set of generated functions is shown below.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))/5Displays readable coefficients,andof the functions. For instance,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]Displays the matrix of the mutual inner product of functions to check orthogonality (using option-c). An example of the generated matrix of the mutual inner product of functions is shown below.[[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]]Plots the set of functions (using option-p) and saves the plot in the current directory. An example of a generated plot is shown below.Citation[1]Ameli, S., and Shadden. S. C. (2022). Interpolating Log-Determinant and Trace of the Powers of MatrixA+ tB.Statistics and Computing32, 108.[2]Ameli, S. (2022). ameli/ortho: (v0.2.0). Zenodo.