arrayComplexCos function Null safety

ArrayComplex arrayComplexCos(
  1. ArrayComplex a
)

Compute the cos for each element of the array

Examples

var c1 = Complex(real: 3.0, imaginary: 4.0);

print(arrayComplexCos(c1));

/* expected output:
Complex(real: -27.034945603074224, imaginary: -3.8511533348117775)
*/

Implementation

ArrayComplex arrayComplexCos(ArrayComplex a) {
  var c = ArrayComplex.fixed(a.length);
  for (var i = 0; i < a.length; i++) {
    c[i] = complexCos(a[i]);
  }
  return c;
}