Search code examples
manim

How to Transform Any graph using Complex Function (like we did for Linear Transformation)?


How can I tranform a graph or the whole Number plane using Complex Function?, Like suppose I have f(z)=z^2 =(x^2-y^2)+i(2xy), Now we have U=x^2-y^2 and V=2xy , I am saying that I want to show the transformation X to U and Y to V, I know the Linear Transformation but how to apply the complex Transformation when we have 2 different Functions? And it would be helpful if you can also show how to plot in complex plane? Thank you in Advance


Solution

  • The answer is in the example_scenes.py, in WarpSquare scene.

    class ComplexTransformation(LinearTransformationScene):
        def construct(self):
            square = Square().scale(2)
            function = lambda point: complex_to_R3(R3_to_complex(point)**2)
    
            self.add_transformable_mobject(square)
    
            self.apply_nonlinear_transformation(function)
    
            self.wait()