在此视频中,Grant 执行非线性变换。从笛卡尔到极坐标的变换也是非线性的。我们发现雅可比矩阵的行列式是 1/r。我可以复制格兰特所做的变换,但是如何使用 manim 将这个笛卡尔动画设置为极坐标。换句话说,什么是 f1 和 f2。我试过(x^2 + y^2)^0.5 和 arctan(y/x)
def construct(self):
def arctan(x, y):
if x and y == 0:
return 0
else:
return np.arctan(y / x)
grid = NumberPlane()
grid.prepare_for_nonlinear_transform()
self.play(
grid.apply_function,
lambda p: p + np.array([
(p[0]**2 + p[1]**2)**0.5,
arctan(p[0], p[1]),
0,
]),
run_time=3,
)