public static double [ ] pow ( double [ ] x , double n ) { double [ ] array = new double [ x . length ] ; for ( int i = 0 ; i < x . length ; i ++ ) { array [ i ] = Math . pow ( x [ i ] , n ) ; } return array ; }
Raise each element of an array to a scalar power .