Premium problem44. Cartesian to Polar

Medium Locked

Z is an (n, 2) array of cartesian (x, y) coordinates. Return an (n, 2) array of polar coordinates (R, T):

  • R = sqrt(x²+y²)
  • T = arctan2(y, x)

Input

[[1. 0.]
 [0. 1.]
 [1. 1.]]

Output

[[1.         0.        ]
 [1.         1.57079633]
 [1.41421356 0.78539816]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)