arraySqrt function Null safety

Array arraySqrt(
  1. Array a
)

Compute the square root for each element of the array

Examples

var n = Array([4, 4, 4]);

print(arraySqrt(n));

/* output:
Array([2, 2, 2])
*/

Implementation

Array arraySqrt(Array a) {
  var c = Array.fixed(a.length);
  for (var i = 0; i < a.length; i++) {
    c[i] = math.sqrt(a[i]);
  }
  return c;
}