np.legcompanion()
El método se utiliza para devolver la array complementaria de la serie legendre .
Sintaxis:
np.legcompanion(c)
Parámetros:
c: [array_like] Arreglos 1-D de coeficientes de series legendre ordenados de menor a mayor.Retorno: [ndarray] Array complementaria de dimensiones (grados, grados).
Código #1:
# Python program explaining # numpy.legcompanion() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # Input legendre series coefficients s = (2, 4, 8) # using np.legcompanion() method res = geek.legcompanion(s) # Resulting Companion matrix print (res)
Producción:
[[ 0. 0.28867513] [ 0.57735027 -0.33333333]]
Código #2:
# Python program explaining # numpy.legcompanion() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # legendre series coefficients s = (1, 2, 3, 4, 5) # using np.legcompanion() method res = geek.legcompanion(s) # Resulting Companion matrix print (res)
Producción:
[[ 0. 0.57735027 0. -0.30237158] [ 0.57735027 0. 0.51639778 -0.34914862] [ 0. 0.51639778 0. 0.10141851] [ 0. 0. 0.50709255 -0.45714286]]
Publicación traducida automáticamente
Artículo escrito por jana_sayantan y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA