Source code for pystran.gauss

"""
Define numerical integration rules.
"""

from numpy import array


[docs] def rule(numpts): """ Set up Gauss quadrature points and weights for a given number of points. Parameters ---------- numpts The number of points can be varied between 1 and 7. Returns ------- tuple of two arrays Array of locations and array of weights. """ if numpts == 1: return array([0.0]), array([2.0]) if numpts == 2: return array([-0.577350269189626, 0.577350269189626]), array([1.0, 1.0]) if numpts == 3: return array([-0.774596669241483, 0.0, 0.774596669241483]), array( [0.5555555555555556, 0.8888888888888889, 0.5555555555555556] ) if numpts == 4: return array( [-0.86113631159405, -0.33998104358486, 0.33998104358486, 0.86113631159405] ), array( [0.34785484513745, 0.65214515486255, 0.65214515486255, 0.34785484513745] ) if numpts == 5: return array( [ -0.906179845938664, -0.538469310105683, 0.0, 0.538469310105683, 0.906179845938664, ] ), array( [ 0.236926885056189, 0.478628670499367, 0.568888888888889, 0.478628670499367, 0.236926885056189, ] ) if numpts == 6: return array( [ -0.932469514203152, -0.661209386466264, -0.238619186083197, 0.238619186083197, 0.661209386466264, 0.932469514203152, ], ), array( [ 0.171324492379171, 0.360761573048139, 0.467913934572691, 0.467913934572692, 0.360761573048139, 0.171324492379170, ], ) if numpts == 7: return array( [ -0.949107912342758, -0.741531185599394, -0.405845151377397, 0.0, 0.405845151377397, 0.741531185599395, 0.949107912342758, ], ), array( [ 0.129484966168870, 0.279705391489277, 0.381830050505119, 0.417959183673469, 0.381830050505119, 0.279705391489276, 0.129484966168870, ], ) return None, None