Suppose to a point z in the unit circle in the xy-plane we apply the transformation $$f(z)=z^50-2z+1 $$ so that for a unit (x,y) in the xy-plane we get a point (u,v) in the uv plane.Iwant to take some points ,say 100 points ,in the circle and want it mapped to (u,v) in the uv plane.Both the planes should show themselves in the same screen and a dotted arrow should point form (x,y) to (u,v).Any help would be highly appreciated
Asked
Active
Viewed 70 times
-1

AgnostMystic
- 101
- 3
1 Answers
1
Here is a sample scene which goes in the direction of what you have asked: it does not use arrows, but instead shows parts of an arc whenever a point is transformed. Feel free to customize further!
from manim import *
def f(z):
return z**50 - 2*z + 1
class ComplexTransformation(Scene):
def construct(self):
xy_plane = ComplexPlane(
x_range=[-2, 2],
y_range=[-2, 2],
axis_config={"include_tip": True}
)
uv_plane = ComplexPlane(
x_range=[-4, 4],
y_range=[-4, 4],
axis_config={"include_tip": True}
).scale(0.5)
VGroup(xy_plane, uv_plane).scale(1.25).arrange(RIGHT, buff=1)
self.add(xy_plane, uv_plane)
xy_unit_circle = Circle(
radius=np.linalg.norm(
xy_plane.c2p(0,0) - xy_plane.c2p(1,0)
)
).move_to(xy_plane.get_origin())
self.add(xy_unit_circle)
points = []
xy_dots = VGroup()
uv_dots = VGroup()
while len(points) < 100:
coords = np.random.rand(2) * 2 - 1
if np.linalg.norm(coords) < 1:
points.append(coords)
z = coords[0] + coords[1] * 1j
xy_dots.add(Dot(xy_plane.n2p(z), radius=DEFAULT_DOT_RADIUS/2))
uv_dots.add(Dot(uv_plane.n2p(f(z)), radius=DEFAULT_DOT_RADIUS/2))
arcs = VGroup()
for z, w in zip(xy_dots, uv_dots):
arcs.add(
ArcBetweenPoints(
z.get_center(),
w.get_center(),
stroke_width=DEFAULT_STROKE_WIDTH/2,
),
)
animations = []
for z, arc, w in zip(xy_dots, arcs, uv_dots):
anim = AnimationGroup(
FadeIn(z, run_time=0.25),
ShowPassingFlash(arc, time_width=0.25),
FadeIn(w, run_time=0.25),
lag_ratio=0.5
)
animations.append(anim)
self.play(AnimationGroup(*animations, lag_ratio=0.5, run_time=10))

Benjamin Hackl
- 1,011
- 2
- 8
-
Sir who else is always so eager to help! Feel infinitely grateful to you and for your wonderful tutorials on manim on YouTube.You along with Grant are heros for us.God bless you sir – AgnostMystic Jul 25 '22 at 18:29