#NEWLINE# def test_integrate_1d( self ) : #NEWLINE# #INDENT# np . random . seed ( 1234 ) #NEWLINE# c = np . random . rand ( 4 , 5 , 6 , 16 , 17 , 18 ) #NEWLINE# x = ( np . linspace ( 0 , 1 , ( 16 + 1 ) ) ** 1 ) #NEWLINE# y = ( np . linspace ( 0 , 1 , ( 17 + 1 ) ) ** 2 ) #NEWLINE# z = ( np . linspace ( 0 , 1 , ( 18 + 1 ) ) ** 3 ) #NEWLINE# p = NdPPoly ( pz , ( x , y , z ) ) #NEWLINE# u = np . random . rand ( 200 ) #NEWLINE# v = np . random . rand ( 200 ) #NEWLINE# ( a , b ) = ( 0.2 , 0.7 ) #NEWLINE# px = p . integrate_1d ( a , b , axis = 0 ) #NEWLINE# pax = p . antiderivative ( ( 1 , 0 , 0 ) ) #NEWLINE# assert_allclose ( px ( ( u , v ) ) , ( pax ( ( b , u , v ) ) - pax ( ( a , u , v ) ) ) ) #NEWLINE# py = p . integrate_1d ( a , b , axis = 1 ) #NEWLINE# pay = p . antiderivative ( ( 0 , 1 , 0 ) ) #NEWLINE# assert_allclose ( py ( ( u , v ) ) , ( pay ( ( u , b , v ) ) - pay ( ( u , a , v ) ) ) ) #NEWLINE# pz = p . integrate_1d ( a , b , axis = 2 ) #NEWLINE# paz = p . antiderivative ( ( 0 , 0 , 1 ) ) #NEWLINE# assert_allclose ( pz ( ( u , v ) ) , ( paz ( ( u , v , b ) ) - paz ( ( u , v , a ) ) ) )