# This file was *autogenerated* from the file ./legendre.sage from sage.all_cmdline import * # import sage library _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_0 = Integer(0); _sage_const_20 = Integer(20); _sage_const_1En14 = RealNumber('1E-14')#!/usr/bin/sage # Schmidt Quasi-Normalized Legendre Functions for Spherical Harmonics x = var('x'); def polypart(n,m): pol = (x**_sage_const_2 -_sage_const_1 )**n for I in range(_sage_const_1 ,n+_sage_const_1 ): pol = diff(pol,x) for I in range(_sage_const_1 ,m+_sage_const_1 ): pol = diff(pol,x) return pol def normpart(n,m): if(m==_sage_const_0 ): nrm = _sage_const_1 /_sage_const_2 **n/factorial(n) else: nrm = (_sage_const_1 /_sage_const_2 **n/factorial(n)) * sqrt(_sage_const_2 *factorial(n-m)/factorial(n+m)) return nrm NN = _sage_const_20 lns = [] coefs = [] nmaxcoefs = _sage_const_0 for I in range(_sage_const_0 ,NN+_sage_const_1 ): for J in range(_sage_const_0 ,I+_sage_const_1 ): pol = polypart(I,J) nrm = normpart(I,J) pol2 = expand(pol) p2c = pol2.coefficients(sparse=False) pol3 = nrm*pol2 p3c = pol3.coefficients(sparse=False) for K in range(_sage_const_0 ,len(p3c)): p3c[K] = p3c[K].n() coefs.append(p3c) if(nmaxcoefs