x = Subdivide[-0.003, 0.003, 501];
ToPolarCoordinates@Flatten[Outer[List, x, x], 1]
想要加速到更快的境界吗,骚年:
cf2 = Compile[{{x, _Real, 1}, {y, _Real}}, #, RuntimeAttributes -> Listable] &@
ToPolarCoordinates[{x, y}](*{Sqrt[x^2+y^2],ArcTan[x,y]}*);
xl = Array[# &, 1000, {-0.003, 0.003}];
Flatten[cf2[xl, xl], {{1, 3}}]; // AbsoluteTiming