def test_function_derivative( polynomial_ord: int, point: ndarray, centroid: ndarray, diameter: float, direction: int, coefficients: ndarray, ) -> float: basis = Monomial(polynomial_ord, euclidean_dimension) value = 0.0 for _i, _exponent in enumerate(basis.exponents): prod = 1.0 for _x_dir in range(basis.exponents.shape[1]): if _x_dir == direction: _pt0 = point[_x_dir] - centroid[_x_dir] _pt1 = _pt0 / diameter if _exponent[_x_dir] == 0: _exp = _exponent[_x_dir] else: _exp = _exponent[_x_dir] - 1 _pt2 = _pt1 ** _exp # prod *= (_exponent[_x_dir] / diameter) * ( # ((point[_x_dir] - centroid[_x_dir]) / diameter) ** (_exponent[_x_dir] - 1) # ) prod *= (_exponent[_x_dir] / diameter) * _pt2 else: prod *= ((point[_x_dir] - centroid[_x_dir]) / diameter) ** _exponent[_x_dir] prod *= coefficients[_i] value += prod return value
def test_function( polynomial_ord: int, point: ndarray, centroid: ndarray, diameter: float, coefficients: ndarray ) -> float: basis = Monomial(polynomial_ord, euclidean_dimension) value = 0.0 for _i, _exponent in enumerate(basis.exponents): prod = 1.0 for _x_dir in range(basis.exponents.shape[1]): prod *= ((point[_x_dir] - centroid[_x_dir]) / diameter) ** _exponent[_x_dir] prod *= coefficients[_i] value += prod return value