diff options
Diffstat (limited to 'FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)')
17 files changed, 998 insertions, 0 deletions
diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/README.md b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/README.md new file mode 100644 index 0000000..2a46424 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/README.md @@ -0,0 +1,30 @@ +# Contributer: Archit Sangal +My Github Account : <a href="https://github.com/architsangal">architsangal</a> (https://github.com/architsangal) +<br/></br> + +## Sub-Topics Covered: ++ Linear Transformations (Linear Maps) + +#### Video 1: Visually understanding linear transformation(using grid) +![GIF1](file12.gif) + +#### Video 2: Linear Transformation when form 1 is given +![GIF2](file11.gif) + +#### Video 3: Matrix Representation Of Linear Transformation +![GIF3](file9.gif) + +#### Video 4: Understand Linear Transformations visually +![GIF4](file13.gif) + +#### Video 5: Uniform Scaling +![GIF5](file14.gif) + +#### Fig.1 Horizontal Shear +![GIF6](file6_Horizontal_Shear_gif.gif) + +#### Fig.2 Vertical Shear +![GIF7](file7_Vertical_Shear_gif.gif) + +#### Video 6: Rotation by an angle of in anticlockwise direction +![GIF8](file10.gif)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file10.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file10.gif Binary files differnew file mode 100644 index 0000000..d996130 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file10.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file11.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file11.gif Binary files differnew file mode 100644 index 0000000..d8c64b7 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file11.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file12.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file12.gif Binary files differnew file mode 100644 index 0000000..92bdff6 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file12.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file13.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file13.gif Binary files differnew file mode 100644 index 0000000..ba6c156 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file13.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file14.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file14.gif Binary files differnew file mode 100644 index 0000000..fd9bc7b --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file14.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py new file mode 100644 index 0000000..0182bd9 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py @@ -0,0 +1,73 @@ +from manimlib.imports import * + +class text(Scene): + def construct(self): + text1 = TextMobject("For a grid, undergoing a linear transformation, all its straight lines") + text1.scale(0.9) + text2 = TextMobject("must either remain straight lines or sends to a point in the grid formed") + text2.scale(0.9) + text3 = TextMobject("Origin must remain where it was before transformation.") + text3.scale(0.9) + text1.move_to(ORIGIN+UP) + text2.move_to(ORIGIN) + text3.move_to(ORIGIN+DOWN) + self.play(Write(text1)) + self.play(Write(text2)) + self.play(Write(text3)) + self.wait() + self.play(FadeOut(text1),FadeOut(text2),FadeOut(text3)) + +class LinearTransformation(LinearTransformationScene): + CONFIG = { + "basis_vector_stroke_width": 3, + "leave_ghost_vectors": True, + } + + def construct(self): + self.setup() + matrix = [[0.866,-0.5],[0.5,0.866]] + self.apply_matrix(matrix) + text = TextMobject("This is a Linear","Trasformation") + text[0].move_to(DOWN+4*LEFT) + text[1].move_to(1.5*DOWN+4*LEFT) + text.add_background_rectangle() + self.play(Write(text)) + self.wait() + +class NonLinearTransformation(Scene): + def construct(self): + grid = NumberPlane() + self.play(ShowCreation(grid),run_time =2) + # I have taken reference from purusharth's code + NonLinearTrans = lambda coordinates : coordinates + np.array([np.sin(coordinates[1]),np.sin(coordinates[0]),0,]) + grid.prepare_for_nonlinear_transform() + self.play(grid.apply_function,NonLinearTrans) + text = TextMobject("While, this is not a","Linear Trasformation") + text[0].move_to(DOWN+4*LEFT) + text[1].move_to(1.5*DOWN+4*LEFT) + text.add_background_rectangle() + self.play(Write(text)) + self.wait() + +class MoveOrigin(LinearTransformationScene): + + CONFIG = { + "show_basis_vectors": False, + } + def construct(self): + self.wait() + + dot = Dot(ORIGIN, color = YELLOW) + self.add_transformable_mobject(dot) + self.apply_nonlinear_transformation(self.func) + text = TextMobject("This is also not a linear transformation as the origin moves from its original position") + text.move_to(2*DOWN) + text.scale(0.5) + text.set_color(YELLOW) + text.add_background_rectangle() + self.play(Write(text)) + self.wait() + + def func(self, point): + matrix_transform = self.get_matrix_transformation([[1, -1], [1, 1]]) + return matrix_transform(point) + UP+ RIGHT diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file2_before_matrix.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file2_before_matrix.py new file mode 100755 index 0000000..1f6badd --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file2_before_matrix.py @@ -0,0 +1,233 @@ +from manimlib.imports import * + +class Linear(GraphScene): + + CONFIG = { + "x_min": -5, + "x_max": 5, + "y_min": -5, + "y_max": 5, + "graph_origin": ORIGIN, + "x_labeled_nums": list(range(-5, 6)), + "y_labeled_nums": list(range(-5, 6)), + "x_axis_width": 7, + "y_axis_height": 7, + } + + def construct(self): + + XTD = self.x_axis_width/(self.x_max- self.x_min) + YTD = self.y_axis_height/(self.y_max- self.y_min) + + self.setup_axes(animate = True) + heading = TextMobject(r"$T(x,y) = T(x+2y,x-y)$") + heading.move_to(UP*3+LEFT*4) + heading.scale(0.7) + self.play(Write(heading)) + self.wait() + + before = TextMobject("Before Linear Transformation") + before.set_color(ORANGE) + before.move_to(3*UP+4*RIGHT) + before.scale(0.75) + dot1 = Dot().shift(self.graph_origin+1*XTD*RIGHT+1*YTD*UP) + dot2 = Dot().shift(self.graph_origin+2*XTD*RIGHT+1*YTD*UP) + dot1.set_color(ORANGE) + dot2.set_color(ORANGE) + p1 = TextMobject(r"$P_1$") + p1.scale(0.75) + p1.set_color(ORANGE) + p1.move_to(self.graph_origin+1*XTD*RIGHT+1.5*YTD*UP) + p2 = TextMobject(r"$P_2$") + p2.set_color(ORANGE) + p2.scale(0.75) + p2.move_to(self.graph_origin+2*XTD*RIGHT+1.5*YTD*UP) + + after = TextMobject("After applying Linear Transformation") + after.set_color(YELLOW) + after.move_to(3*UP+4.5*RIGHT) + after.scale(0.5) + dot3 = Dot().shift(self.graph_origin+3*XTD*RIGHT+0*YTD*UP) + dot4 = Dot().shift(self.graph_origin+4*XTD*RIGHT+1*YTD*UP) + dot3.set_color(YELLOW) + dot4.set_color(YELLOW) + p3 = TextMobject(r"$T(P_1)$") + p3.scale(0.7) + p3.set_color(YELLOW) + p3.move_to(self.graph_origin+3*XTD*RIGHT-1.1*YTD*UP) + p4 = TextMobject(r"$T(P_2)$") + p4.scale(0.7) + p4.set_color(YELLOW) + p4.move_to(self.graph_origin+4*XTD*RIGHT+1.5*YTD*UP) + + self.play(Write(before), ShowCreation(dot1), ShowCreation(dot2),Write(p1), Write(p2)) + self.wait(3) + self.play(Transform(before,after), Transform(dot1,dot3), Transform(dot2,dot4), Transform(p2,p4), Transform(p1,p3)) + self.wait(3) + + +class withgrid(LinearTransformationScene): + def construct(self): + + heading = TextMobject(r"Now, imagine this happening for all the points") + heading.scale(0.5) + heading.move_to(UP*2.5+LEFT*4) + self.play(Write(heading)) + self.wait() + + before = TextMobject("Before Linear Transformation") + before.set_color(ORANGE) + before.move_to(3.5*UP+4*RIGHT) + before.scale(0.75) + dot1 = Dot().shift(1*RIGHT+1*UP) + dot2 = Dot().shift(2*RIGHT+1*UP) + dot1.set_color(ORANGE) + dot2.set_color(ORANGE) + + dot1_c = Dot(radius = 0.05).shift(1*RIGHT+1*UP) + dot2_c = Dot(radius = 0.05).shift(2*RIGHT+1*UP) + dot1_c.set_color(YELLOW) + dot2_c.set_color(YELLOW) + self.add_transformable_mobject(dot1_c) + self.add_transformable_mobject(dot2_c) + + p1 = TextMobject(r"$P_1$") + p1.scale(0.75) + p1.set_color(ORANGE) + p1.move_to(1*RIGHT+1.5*UP) + p2 = TextMobject(r"$P_2$") + p2.scale(0.75) + p2.set_color(ORANGE) + p2.move_to(2*RIGHT+1.5*UP) + + after = TextMobject("After applying Linear Transformation") + after.set_color(YELLOW) + after.move_to(3.5*UP+3.5*RIGHT) + after.scale(0.75) + dot3 = Dot().shift(3*RIGHT+0*UP) + dot4 = Dot().shift(4*RIGHT+1*UP) + dot3.set_color(YELLOW) + dot4.set_color(YELLOW) + p3 = TextMobject(r"$T(P_1)$") + p3.scale(0.75) + p3.set_color(YELLOW) + p3.move_to(3*RIGHT-0.6*UP) + p4 = TextMobject(r"$T(P_2)$") + p4.scale(0.75) + p4.set_color(YELLOW) + p4.move_to(4*RIGHT+1.5*UP) + + self.play(Write(before), ShowCreation(dot1), ShowCreation(dot2),Write(p1), Write(p2)) + self.wait(3) + matrix = [[1,2],[1,-1]] + dot1.set_color(GREY) + dot2.set_color(GREY) + self.play(FadeIn(dot1),FadeIn(dot2)) + self.apply_matrix(matrix) + self.play(Transform(before,after), Transform(p2,p4), Transform(p1,p3)) + self.play(Transform(before,after)) + self.wait(3) + + ending = TextMobject(r"$T(\left[\begin{array}{c}x \\ y\end{array}\right]) = \left[\begin{array}{c} x+2y \\ x-y\end{array}\right]$") + ending.move_to(UP*2+LEFT*4) + self.play(Transform(heading,ending)) + self.wait() + +from manimlib.imports import * +class ThreeDExplanation(ThreeDScene): + + def construct(self): + + text = TextMobject(r"$T(x,y) = (x+y,x-y,x+2y)$") + text.scale(0.75) + text.move_to(UP*2.5+LEFT*4) + text.move_to(-UP*3+LEFT*4) + self.add_fixed_in_frame_mobjects(text) + self.play(Write(text)) + self.wait() + + before = TextMobject("Before Linear Transformation") + self.add_fixed_in_frame_mobjects(before) + before.set_color(ORANGE) + before.move_to(3.5*UP+4*RIGHT) + before.scale(0.75) + + p1 = TextMobject(r"$P_1$") + p2 = TextMobject(r"$P_2$") + p3 = TextMobject(r"$P_3$") + p1.scale(0.75) + p2.scale(0.75) + p3.scale(0.75) + dot1 = Dot().shift(1*RIGHT+1*UP) + dot2 = Dot().shift(2*RIGHT+1*UP) + dot3 = Dot().shift(1*RIGHT+1*DOWN) + dot1.set_color(ORANGE) + dot2.set_color(ORANGE) + dot3.set_color(ORANGE) + self.play(ShowCreation(before)) + + p1.move_to(1*RIGHT+1*UP+[0,0,0.5]) + p2.move_to(2*RIGHT+1*UP+[0,0,0.5]) + p3.move_to(1*RIGHT-1*UP+[0,0,0.5]) + + dot1_c = Dot(radius = 0.05).shift(1*RIGHT+1*UP) + dot2_c = Dot(radius = 0.05).shift(0*RIGHT+2*UP) + dot3_c = Dot(radius = 0.05).shift(1*RIGHT-1*UP) + dot1_c.set_color(YELLOW) + dot2_c.set_color(YELLOW) + dot3_c.set_color(YELLOW) + + axes = ThreeDAxes(x_min = -7,x_max=7,y_min=-4,y_max=4,z_min=-4,z_max=4) + self.play(ShowCreation(axes)) + self.move_camera(distance = 100, phi=30*DEGREES,theta=45*DEGREES,run_time=3) + + self.begin_ambient_camera_rotation(rate=0.3) + self.wait(1) + self.stop_ambient_camera_rotation() + + plane = NumberPlane() + self.add_fixed_orientation_mobjects(p1) + self.add_fixed_orientation_mobjects(p2) + self.add_fixed_orientation_mobjects(p3) + self.play(ShowCreation(dot1),ShowCreation(dot3),ShowCreation(dot2),ShowCreation(plane)) + + self.play(FadeOut(before)) + after = TextMobject("After applying Linear Transformation") + self.add_fixed_in_frame_mobjects(after) + after.set_color(YELLOW) + after.move_to(3.5*UP+3.5*RIGHT) + after.scale(0.75) + + self.play(FadeOut(p1),FadeOut(p2),FadeOut(p3)) + matrix = [[1,1],[1,-1],[2,1]] + self.play(FadeOut(dot1),FadeOut(dot2),FadeOut(dot3),ApplyMethod(plane.apply_matrix,matrix),ApplyMethod(dot1_c.apply_matrix,matrix),ApplyMethod(dot3_c.apply_matrix,matrix),ApplyMethod(dot2_c.apply_matrix,matrix)) + + p4 = TextMobject(r"$T(P_1)$") + p5 = TextMobject(r"$T(P_2)$") + p6 = TextMobject(r"$T(P_3)$") + p4.scale(0.75) + p5.scale(0.75) + p6.scale(0.75) + p4.move_to(2*RIGHT+0*UP+[0,0,3.5]) + p5.move_to(2*RIGHT-2*UP+[0,0,2.5]) + p6.move_to(0*RIGHT+2*UP+[0,0,1.5]) + self.add_fixed_orientation_mobjects(p5) + self.add_fixed_orientation_mobjects(p4) + self.add_fixed_orientation_mobjects(p6) + + self.begin_ambient_camera_rotation(rate=0.3) + self.wait(3) + self.stop_ambient_camera_rotation() + + ending = TextMobject(r"$T(\left[\begin{array}{c}x \\ y\end{array}\right])$ = ",r"$\left[\begin{array}{c} x+y \\ x-y\\ x+2y \end{array}\right]$") #\begin{array}{c} x+y \\ x-y -- \\ x+2y -- \end{array}\right]$") + ending.scale(0.75) + ending.move_to(-UP*3+LEFT*4) + self.add_fixed_in_frame_mobjects(ending) + self.play(FadeOut(text),Write(ending)) + + self.play(FadeOut(plane)) + self.wait(2) + + self.begin_ambient_camera_rotation(rate=0.3) + self.wait(8) + self.stop_ambient_camera_rotation() diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file3_square.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file3_square.py new file mode 100644 index 0000000..e828de4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file3_square.py @@ -0,0 +1,246 @@ +from manimlib.imports import * + +class Linear(GraphScene): + CONFIG = { + "x_min": -5, + "x_max": 5, + "y_min": -5, + "y_max": 5, + "graph_origin": ORIGIN, + "x_labeled_nums": list(range(-5, 6)), + "y_labeled_nums": list(range(-5, 6)), + "x_axis_width": 7, + "y_axis_height": 7, + } + def construct(self): + + text = TextMobject("T(x,y) = T(x+y,y)") + text.scale(0.75) + text.set_color(PURPLE) + text.move_to(3*UP+5*LEFT) + self.play(Write(text)) + + XTD = self.x_axis_width/(self.x_max- self.x_min) + YTD = self.y_axis_height/(self.y_max- self.y_min) + + self.setup_axes(animate = True) + + text1 = TextMobject("Before Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3+3*RIGHT) + + a = TextMobject("(1,1)") + b = TextMobject("(3,1)") + c = TextMobject("(3,2)") + d = TextMobject("(1,2)") + a.scale(0.5) + b.scale(0.5) + c.scale(0.5) + d.scale(0.5) + a.move_to(self.graph_origin+0.6*UP+0.6*RIGHT) + b.move_to(self.graph_origin+0.6*UP+3.4*RIGHT) + c.move_to(self.graph_origin+2.4*UP+3.4*RIGHT) + d.move_to(self.graph_origin+2.6*UP+0.6*RIGHT) + + square = Polygon(self.graph_origin+UP+RIGHT,self.graph_origin+UP+3*RIGHT,self.graph_origin+2*UP+3*RIGHT,self.graph_origin+2*UP+RIGHT) + + self.play(Write(text1), Write(a), Write(b), Write(c), Write(d), ShowCreation(square)) + self.wait(2) + self.play(FadeOut(text1), FadeOut(a), FadeOut(b), FadeOut(c), FadeOut(d), ApplyMethod(square.apply_matrix,[[1,1],[0,1]])) + + a = TextMobject("(2,1)") + b = TextMobject("(4,1)") + c = TextMobject("(3,2)") + d = TextMobject("(5,2)") + a.scale(0.5) + b.scale(0.5) + c.scale(0.5) + d.scale(0.5) + a.move_to(self.graph_origin+0.6*UP+1.6*RIGHT) + b.move_to(self.graph_origin+0.6*UP+4.4*RIGHT) + d.move_to(self.graph_origin+2.4*UP+5.4*RIGHT) + c.move_to(self.graph_origin+2.4*UP+2.6*RIGHT) + + text1 = TextMobject("After Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3+3*RIGHT) + + self.play(Write(text1), Write(a), Write(b), Write(c), Write(d)) + + self.wait(2) + +class grid(LinearTransformationScene): + def construct(self): + + text = TextMobject("Now, consider all the vectors.") + text.scale(0.75) + text.set_color(PURPLE) + text.move_to(2.5*UP+3*LEFT) + self.play(Write(text)) + + text1 = TextMobject("Before Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3.5+3.5*RIGHT) + + square = Polygon(UP+RIGHT,UP+3*RIGHT,2*UP+3*RIGHT,2*UP+RIGHT) + square.set_color(YELLOW) + + self.play(Write(text1), ShowCreation(square)) + self.wait(2) + self.play(FadeOut(text1)) + self.add_transformable_mobject(square) + + text1 = TextMobject("After Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3.5+3.5*RIGHT) + + matrix = [[1,1],[0,1]] + + self.apply_matrix(matrix) + self.play(Write(text1)) + + self.wait() + +class grid2(LinearTransformationScene): + CONFIG = { + "include_background_plane": True, + "include_foreground_plane": False, + "show_coordinates": True, + "show_basis_vectors": True, + "basis_vector_stroke_width": 3, + "i_hat_color": X_COLOR, + "j_hat_color": Y_COLOR, + "leave_ghost_vectors": True, + } + + def construct(self): + + text = TextMobject("Now, let us focus only on the standard basis") + text.scale(0.7) + text.set_color(PURPLE) + text.move_to(2.5*UP+3.5*LEFT) + self.play(Write(text)) + + text1 = TextMobject("Before Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3.5+3.5*RIGHT) + + square = Polygon(UP+RIGHT,UP+3*RIGHT,2*UP+3*RIGHT,2*UP+RIGHT) + square.set_color(YELLOW) + + self.play(Write(text1), ShowCreation(square)) + self.wait(2) + self.play(FadeOut(text1)) + self.add_transformable_mobject(square) + + text1 = TextMobject("After Linear Transformation") + text1.scale(0.6) + text1.move_to(UP*3.5+3.5*RIGHT) + + matrix = [[1,1],[0,1]] + + self.apply_matrix(matrix) + self.play(Write(text1)) + + self.play(FadeOut(square), FadeOut(text1)) + + cor_x = TextMobject("(1,0)") + cor_y = TextMobject("(1,1)") + cor_x.scale(0.65) + cor_y.scale(0.65) + cor_y.move_to(1.25*RIGHT+1.5*UP) + cor_x.move_to(0.75*RIGHT-0.5*UP) + cor_x.set_color(GREEN) + cor_y.set_color(RED) + + x_cor = TextMobject(r"$\left[\begin{array}{c} 1\\0\end{array}\right]$") + x_cor.set_color(GREEN) + x_cor.scale(0.5) + y_cor = TextMobject(r"$\left[\begin{array}{c} 1\\1\end{array}\right]$") + x_cor.move_to(0.75*RIGHT-0.5*UP) + y_cor.move_to(1.25*RIGHT+1.5*UP) + y_cor.set_color(RED) + y_cor.scale(0.5) + + text1 = TextMobject(r"$T(\left[\begin{array}{c} x\\y \end{array}\right]) = $",r"$\left[\begin{array}{c} x+y\\y \end{array}\right]$") + text1.scale(0.7) + text1.set_color(PURPLE) + text1.move_to(1.5*UP+3*LEFT) + + text = TextMobject(r"$T(x,y) = (x+y,y)$") + text.scale(0.6) + text.set_color(PURPLE) + text.move_to(1.5*UP+3*LEFT) + + self.play(FadeIn(text),FadeIn(cor_x), FadeIn(cor_y)) + self.wait() + + self.play(Transform(text,text1), Transform(cor_x,x_cor), Transform(cor_y,y_cor)) + + text3 = TextMobject(r"$\left[\begin{array}{c} x+y\\y \end{array}\right]$") + text3.scale(0.7) + text3.set_color(PURPLE) + text3.move_to(1.5*DOWN+5*LEFT) + + equal = TextMobject("=") + equal.move_to(1.5*DOWN+3.5*LEFT) + + text3 = TextMobject("[") + text4 = TextMobject(r"$\begin{array}{c} (1)x\\(0)x \end{array}$") + text5 = TextMobject(r"$\begin{array}{c} + \\ + \end{array}$") + text6 = TextMobject(r"$\begin{array}{c} (1)y\\(1)y \end{array}$") + text7 = TextMobject("]") + text3.scale(2) + text4.scale(0.7) + text5.scale(0.7) + text6.scale(0.7) + text7.scale(2) + text4.set_color(GREEN) + text5.set_color(PURPLE) + text6.set_color(RED) + text3.move_to(1.5*DOWN+3*LEFT) + text4.move_to(1.5*DOWN+2.5*LEFT) + text5.move_to(1.5*DOWN+2*LEFT) + text6.move_to(1.5*DOWN+1.5*LEFT) + text7.move_to(1.5*DOWN+1*LEFT) + + text1[1].scale(1.2) + self.play(FadeOut(text1[0]), ApplyMethod(text1[1].move_to,1.5*DOWN+5*LEFT), FadeIn(text3), FadeIn(equal), FadeIn(text4), FadeIn(text5), FadeIn(text6), FadeIn(text7)) + + self.wait() + self.play(FadeOut(text1[1])) + + self.play(ApplyMethod(text3.move_to,1.5*DOWN+6*LEFT), + ApplyMethod(text4.move_to,1.5*DOWN+5.5*LEFT), + ApplyMethod(text5.move_to,1.5*DOWN+5*LEFT), + ApplyMethod(text6.move_to,1.5*DOWN+4.5*LEFT), + ApplyMethod(text7.move_to,1.5*DOWN+4*LEFT)) + + text10 = TextMobject("[") + text11 = TextMobject(r"$\begin{array}{c} 1\\0 \end{array}$") + text13 = TextMobject(r"$\begin{array}{c} 1\\1 \end{array}$") + text14 = TextMobject("]") + text10.scale(2) + text11.scale(0.7) + text13.scale(0.7) + text14.scale(2) + text11.set_color(GREEN) + text13.set_color(RED) + text10.move_to(1.5*DOWN+3*LEFT) + text11.move_to(1.5*DOWN+2.75*LEFT) + text13.move_to(1.5*DOWN+2.25*LEFT) + text14.move_to(1.5*DOWN+2*LEFT) + + self.play(FadeIn(text10), Transform(x_cor,text11), Transform(y_cor,text13), FadeIn(text14)) + + text15 = TextMobject(r"$\left[\begin{array}{c} x\\y \end{array}\right]$") + text15.scale(0.7) + text15.set_color(PURPLE) + text15.move_to(1.5*DOWN+1.5*LEFT) + + self.play(FadeIn(text15)) + self.play(FadeOut(text3), FadeOut(text4), FadeOut(text5), FadeOut(text7), FadeOut(text6)) + + text1[0].scale(1.2) + self.play(ApplyMethod(text1[0].move_to,1.5*DOWN+4.5*LEFT), FadeOut(equal)) + self.wait(2)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_Understand_Linear_Transformations_visually.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_Understand_Linear_Transformations_visually.py new file mode 100644 index 0000000..577032d --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_Understand_Linear_Transformations_visually.py @@ -0,0 +1,193 @@ +from manimlib.imports import * + +class Rotation(GraphScene): + CONFIG = { + "x_min" : -5, + "x_max" : 5, + "y_min" : -5, + "y_max" : 5, + "graph_origin" : ORIGIN+3.5*LEFT, + "x_axis_width" : 7, + "y_axis_height" : 7 + #"x_labeled_nums" : list(range(-5,6)), + #"y_labeled_nums" : list(range(-5,6)), + } + + def construct(self): + XTD = self.x_axis_width/(self.x_max-self.x_min) + YTD = self.y_axis_height/(self.y_max-self.y_min) + + introText = TextMobject("Understanding Linear Transformations") + self.play(Write(introText)) + self.wait(1) + + introText1 = TextMobject("Visually ... ") + introText1.move_to(DOWN) + self.play(Write(introText1)) + self.wait(1) + self.play(FadeOut(introText), FadeOut(introText1)) + + Text1 = TextMobject("Let $\overrightarrow{v}$ be $2\hat{i}+3\hat{j}$") + Text2 = TextMobject("$\overrightarrow{v} = 2\hat{i}+3\hat{j}$") + + Text1.move_to(4*RIGHT+2*UP) + Text2.move_to(4*RIGHT+1*UP) + self.play(Write(Text1)) + self.wait() + self.play(Transform(Text1,Text2)) + + self.setup_axes(animate=True) + arrow_v = Arrow(stroke_width = 3, start = self.graph_origin + 0.15*LEFT + 0.25*DOWN, end = self.graph_origin+2*XTD*RIGHT+3*YTD*UP+ 0.15*RIGHT + 0.25*UP) + self.play(ShowCreation(arrow_v)) + + Text_i = TextMobject("$\hat{i}$") + Text_i.move_to(self.graph_origin+0.5*XTD*RIGHT+0.5*YTD*DOWN) + Text_i.scale(0.75) + Text_j = TextMobject("$\hat{j}$") + Text_j.move_to(self.graph_origin+0.5*XTD*LEFT+0.5*YTD*UP) + Text_j.scale(0.75) + + arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+1*YTD*UP+0.25*UP) + self.play(ShowCreation(arrow_i), ShowCreation(arrow_j), Write(Text_i), Write(Text_j)) + + Text_2i = TextMobject("$2\hat{i}$") + Text_2i.move_to(self.graph_origin+1*XTD*RIGHT+1*YTD*DOWN) + Text_3j = TextMobject("$3\hat{j}$") + Text_3j.move_to(self.graph_origin+1*XTD*LEFT+1.5*YTD*UP) + + arrow_2i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+2*XTD*RIGHT+ 0.25*RIGHT) + arrow_2i.set_color(YELLOW) + arrow_3j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+3*YTD*UP+0.25*UP) + arrow_3j.set_color(RED) + self.wait(0.5) + self.play(Transform(arrow_i,arrow_2i), Transform(arrow_j,arrow_3j), Transform(Text_i,Text_2i), Transform(Text_j,Text_3j)) + self.play(ApplyMethod(arrow_j.move_to,self.graph_origin+2*XTD*RIGHT+1.5*YTD*UP) , ApplyMethod(Text_j.move_to,self.graph_origin+2.5*XTD*RIGHT+1.5*YTD*UP+ 0.15*RIGHT + 0.25*UP)) + + new_Text_v = TextMobject("$\overrightarrow{v}$") + new_Text_v.move_to(self.graph_origin+0.5*XTD*RIGHT+1.5*YTD*UP) + self.play(Write(new_Text_v)) + + new_arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + new_arrow_i.set_color(YELLOW) + new_arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+1*YTD*UP+0.25*UP) + new_arrow_j.set_color(RED) + + new_Text_i = TextMobject("$\hat{i}$") + new_Text_i.move_to(self.graph_origin+0.5*XTD*RIGHT+0.5*YTD*DOWN) + new_Text_i.scale(0.75) + new_Text_j = TextMobject("$\hat{j}$") + new_Text_j.move_to(self.graph_origin+0.5*XTD*LEFT+0.5*YTD*UP) + new_Text_j.scale(0.75) + + self.wait(1) + + self.play(FadeOut(Text_i), + FadeOut(Text_j), + FadeOut(arrow_i), + FadeOut(arrow_j), + ShowCreation(new_arrow_i), + ShowCreation(new_arrow_j), + Write(new_Text_i), + Write(new_Text_j)) + + self.play(ApplyMethod(Text1.move_to,4*RIGHT)) + Text3 = TextMobject("Let the be a linear transformation function") + Text3.scale(0.5) + Text4 = TextMobject("$T$ which rotates the vectors by angle of $90^{\circ}$") + Text4.scale(0.5) + Text3.move_to(4*RIGHT+3*UP) + Text4.move_to(4*RIGHT+2.5*UP) + self.play(Write(Text3), Write(Text4)) + self.wait(2) + + Text6 = TextMobject(r"$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$") + Text6.scale(0.75) + Text6.set_color(YELLOW) + Text6.move_to(self.graph_origin+1*XTD*RIGHT+1*YTD*DOWN) + Text7 = TextMobject(r"$\begin{pmatrix} 0 \\ 1 \end{pmatrix}$") + Text7.scale(0.75) + Text7.set_color(RED) + Text7.move_to(self.graph_origin+1*XTD*LEFT+1*YTD*UP) + + self.play(Transform(new_Text_i,Text6)) + self.play(Transform(new_Text_j,Text7)) + + Text5 = TextMobject(r"$\overrightarrow{v} = 2 $", r"$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$", r"+3", r"$\begin{pmatrix} 0 \\ 1 \end{pmatrix}$") + Text5[1].set_color(YELLOW) + Text5[3].set_color(RED) + Text5.move_to(4*RIGHT) + + self.play(Transform(Text1, Text5)) + self.wait() + + arrow_modified_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*UP, end = self.graph_origin-(1*YTD*UP+0.25*UP)) + arrow_modified_i.set_color(YELLOW) + arrow_modified_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + arrow_modified_j.set_color(RED) + + yellow_i = TextMobject(r"$\begin{pmatrix} 0 \\ -1 \end{pmatrix}$") + yellow_i.set_color(YELLOW).scale(0.75) + yellow_i.move_to(self.graph_origin + 1*XTD*DOWN + 1*YTD*LEFT) + + red_j = TextMobject(r"$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$") + red_j.set_color(RED).scale(0.75) + red_j.move_to(self.graph_origin + 1*XTD*UP + 1*YTD*RIGHT) + + Text8 = TextMobject(r"$\overrightarrow{v}_{transformed} = 2 $", r"$\begin{pmatrix} 0 \\ -1 \end{pmatrix}$", r"+3", r"$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$") + Text8[1].set_color(YELLOW) + Text8[3].set_color(RED) + Text8.move_to(4*RIGHT+1.5*DOWN) + Text8.scale(0.75) + + new_Text__v = TextMobject("$\overrightarrow{v}_{transformed}$") + new_Text__v.scale(0.75) + arrow_modified_v = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT + 0.15*UP, end = self.graph_origin+2*XTD*DOWN+3*YTD*RIGHT+ 0.15*DOWN + 0.25*RIGHT) + self.play(Transform(arrow_v, arrow_modified_v), + Transform(new_arrow_i, arrow_modified_i), + Transform(new_arrow_j, arrow_modified_j), + Transform(new_Text_i,yellow_i), + Transform(new_Text_j,red_j), + FadeOut(new_Text_v), + ApplyMethod(new_Text__v.move_to,self.graph_origin+3*XTD*RIGHT+0.5*YTD*DOWN), + Write(Text8)) + + self.play(FadeOut(Text1), FadeOut(Text3), FadeOut(Text4), ApplyMethod(Text8.move_to,4*RIGHT+3*UP)) + + Text9 = TextMobject(r"$\overrightarrow{v}_{transformed} = 2 $", r"$\hat{i}_{transformed}$", r"+3", r"$\hat{j}_{transformed}$") + Text9[1].set_color(YELLOW) + Text9[3].set_color(RED) + Text9.move_to(4*RIGHT+2*UP) + Text9.scale(0.5) + + self.play(Write(Text9)) + + v_transformed = TextMobject(r"$\overrightarrow{v}_{transformed} \equiv T(\overrightarrow{v})$") + v_transformed.scale(0.75).move_to(4*RIGHT+UP) + i_transformed = TextMobject(r"$\hat{i}_{transformed} \equiv T(\hat{i})$") + i_transformed.set_color(YELLOW).scale(0.75).move_to(4*RIGHT) + j_transformed = TextMobject(r"$\hat{v}_{transformed} \equiv T(\hat{j})$") + j_transformed.set_color(RED).scale(0.75).move_to(4*RIGHT+DOWN) + + self.play(Write(v_transformed), Write(i_transformed), Write(j_transformed)) + self.wait(3) + + Text10 = TextMobject(r"$T(\overrightarrow{v}) = $", r"$\begin{pmatrix} 3 \\ -2 \end{pmatrix}$") + Text10[1].set_color(BLUE_E) + Text10.move_to(4*RIGHT+1*UP) + Text10.scale(0.75) + + self.play(Write(Text10), ApplyMethod(v_transformed.move_to,4*RIGHT+2*UP), FadeOut(i_transformed), FadeOut(j_transformed), FadeOut(Text9)) + self.wait(1) + + self.play(FadeOut(self.axes), + FadeOut(arrow_v), + FadeOut(new_arrow_i), + FadeOut(new_arrow_j), + FadeOut(new_Text_i), + FadeOut(new_Text_i), + FadeOut(new_Text_j), + FadeOut(new_Text__v), + FadeOut(Text10), + FadeOut(v_transformed), + FadeOut(Text8)) diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_Uniform_Scaling.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_Uniform_Scaling.py new file mode 100644 index 0000000..a7856a5 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_Uniform_Scaling.py @@ -0,0 +1,91 @@ +from manimlib.imports import * + +class Scaling(GraphScene): + CONFIG = { + "x_min" : -5, + "x_max" : 5, + "y_min" : -5, + "y_max" : 5, + "graph_origin" : ORIGIN+3.5*LEFT, + "x_axis_width" : 7, + "y_axis_height" : 7 + #"x_labeled_nums" : list(range(-5,6)), + #"y_labeled_nums" : list(range(-5,6)), + } + + def construct(self): + XTD = self.x_axis_width/(self.x_max-self.x_min) + YTD = self.y_axis_height/(self.y_max-self.y_min) + + introText = TextMobject("Scaling") + self.play(Write(introText)) + self.wait(1) + self.play(FadeOut(introText)) + + introText = TextMobject("Uniform Scaling") + self.play(Write(introText)) + self.wait(1) + self.play(FadeOut(introText)) + + Text1 = TextMobject("Let $\overrightarrow{v}$ be $3\hat{i}+3\hat{j}$") + Text2 = TextMobject("$\overrightarrow{v} = 3\hat{i}+3\hat{j}$") + + Text1.move_to(4*RIGHT+2*UP) + Text2.move_to(4*RIGHT+1*UP) + self.play(Write(Text1)) + self.wait() + self.play(Transform(Text1,Text2)) + + self.setup_axes(animate=True) + arrow_v = Arrow(stroke_width = 4, start = self.graph_origin + 0.15*LEFT + 0.15*DOWN, end = self.graph_origin+3*XTD*RIGHT+3*YTD*UP+ 0.15*RIGHT + 0.15*UP) + vector_v = TextMobject(r"$\vec{v}$") + vector_v.move_to(self.graph_origin + 1*XTD*RIGHT + 2*YTD*UP ) + self.play(ShowCreation(arrow_v),Write(vector_v)) + scaling_factor = TextMobject(r"Scaling Factor = $\frac{4}{3}$") + scaling_factor.scale(0.75) + scaled_vector = TextMobject(r"$T(\vec{v}) = \frac{4}{3} \left[ \begin{array} {c} 3 \\ 3 \end{array} \right] = \left[ \begin{array} {c} 4 \\ 4 \end{array} \right]$") + scaled_vector.set_color(DARK_BLUE) + scaled_vector.scale(0.75) + scaling_factor.move_to(4*RIGHT) + scaled_vector.move_to(4*RIGHT+DOWN) + self.play(Write(scaling_factor)) + self.wait() + self.play(Write(scaled_vector)) + + transformed_arrow_v = Arrow(stroke_width = 2, start = self.graph_origin + 0.15*LEFT + 0.15*DOWN, end = self.graph_origin+4*XTD*RIGHT+4*YTD*UP+ 0.15*RIGHT + 0.15*UP) + transformed_arrow_v.set_color(DARK_BLUE) + transformed_vector_v = TextMobject(r"$T(\vec{v})$") + transformed_vector_v.move_to(self.graph_origin + 4.5*XTD*RIGHT + 4.5*YTD*UP ) + transformed_vector_v.set_color(DARK_BLUE) + self.play(ShowCreation(transformed_arrow_v), Write(transformed_vector_v)) + + self.wait() + + represent_text1 = TextMobject("Representation of scaling") + represent_text2 = TextMobject("of vectors in point form") + represent_text1.move_to(4*RIGHT+3*UP) + represent_text2.move_to(4*RIGHT+2*UP) + self.play(Write(represent_text1), Write(represent_text2)) + + dot_init = Dot(self.graph_origin+3*XTD*RIGHT+3*YTD*UP) + dot_trans = Dot(self.graph_origin+4*XTD*RIGHT+4*YTD*UP) + + self.play(ApplyMethod(vector_v.move_to,self.graph_origin+2.5*XTD*RIGHT+2.5*YTD*UP), + ApplyMethod(transformed_vector_v.move_to,self.graph_origin+4.5*XTD*RIGHT+4.5*YTD*UP), + ShowCreation(dot_init), + Transform(arrow_v,dot_init), + Transform(transformed_arrow_v,dot_trans)) + + self.wait(2) + + self.play(FadeOut(dot_init), + FadeOut(arrow_v), + FadeOut(transformed_arrow_v), + FadeOut(represent_text1), + FadeOut(represent_text2), + FadeOut(self.axes), + FadeOut(scaling_factor), + FadeOut(scaled_vector), + FadeOut(transformed_vector_v), + FadeOut(vector_v), + FadeOut(Text1))
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear.py new file mode 100644 index 0000000..91f098e --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear.py @@ -0,0 +1,53 @@ +from manimlib.imports import * + +class Hori_Shear(GraphScene): + CONFIG = { + "x_min" : -5, + "x_max" : 5, + "y_min" : -5, + "y_max" : 5, + "graph_origin" : ORIGIN+3.5*LEFT, + "x_axis_width" : 7, + "y_axis_height" : 7 + #"x_labeled_nums" : list(range(-5,6)), + #"y_labeled_nums" : list(range(-5,6)), + } + + def construct(self): + XTD = self.x_axis_width/(self.x_max-self.x_min) + YTD = self.y_axis_height/(self.y_max-self.y_min) + + Text1 = TextMobject("Before"," Horizontal") + Text1[0].set_color(YELLOW) + Text2 = TextMobject("Shear Transformation") + + Text1.move_to(4*RIGHT+2*UP) + Text2.move_to(4*RIGHT+1*UP) + + self.setup_axes(animate=False) + arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+1*XTD*UP+0.25*UP) + arrow_i.set_color(YELLOW) + arrow_j.set_color(YELLOW) + + square = Polygon(self.graph_origin,self.graph_origin+2*XTD*RIGHT, self.graph_origin+2*XTD*RIGHT+2*YTD*UP, self.graph_origin+2*YTD*UP) + square.set_color(DARK_BLUE) + self.play(ShowCreation(square), Write(Text1), Write(Text2), ShowCreation(arrow_i), ShowCreation(arrow_j)) + self.wait(1) + + Text3 = TextMobject("After"," Horizontal") + Text3[0].set_color(RED) + Text4 = TextMobject("Shear Transformation") + + Text3.move_to(4*RIGHT+2*UP) + Text4.move_to(4*RIGHT+1*UP) + + trans_arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + trans_arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.15*DOWN + 0.15*LEFT, end = self.graph_origin+1*XTD*UP+1*YTD*RIGHT+0.25*UP+0.25*RIGHT) + trans_arrow_i.set_color(RED) + trans_arrow_j.set_color(RED) + + rhombus = Polygon(self.graph_origin,self.graph_origin+2*XTD*RIGHT, self.graph_origin+4*XTD*RIGHT+2*YTD*UP, self.graph_origin+2*XTD*RIGHT+2*YTD*UP) + square.set_color(DARK_BLUE) + self.play(Transform(arrow_i,trans_arrow_i), Transform(arrow_j,trans_arrow_j), Transform(square,rhombus), Transform(Text1,Text3), Transform(Text2,Text4)) + self.wait(1)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear_gif.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear_gif.gif Binary files differnew file mode 100644 index 0000000..9bef1b6 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_Horizontal_Shear_gif.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear.py new file mode 100644 index 0000000..718e4e0 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear.py @@ -0,0 +1,52 @@ +from manimlib.imports import * + +class Ver_Shear(GraphScene): + CONFIG = { + "x_min" : -5, + "x_max" : 5, + "y_min" : -5, + "y_max" : 5, + "graph_origin" : ORIGIN+3.5*LEFT, + "x_axis_width" : 7, + "y_axis_height" : 7 + #"x_labeled_nums" : list(range(-5,6)), + #"y_labeled_nums" : list(range(-5,6)), + } + + def construct(self): + XTD = self.x_axis_width/(self.x_max-self.x_min) + YTD = self.y_axis_height/(self.y_max-self.y_min) + + Text1 = TextMobject("Before"," Vertical") + Text1[0].set_color(YELLOW) + Text2 = TextMobject("Shear Transformation") + + Text1.move_to(4*RIGHT+2*UP) + Text2.move_to(4*RIGHT+1*UP) + + self.setup_axes(animate=False) + arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*LEFT, end = self.graph_origin+1*XTD*RIGHT+ 0.25*RIGHT) + arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+1*XTD*UP+0.25*UP) + arrow_i.set_color(YELLOW) + arrow_j.set_color(YELLOW) + + square = Polygon(self.graph_origin,self.graph_origin+2*XTD*RIGHT, self.graph_origin+2*XTD*RIGHT+2*YTD*UP, self.graph_origin+2*YTD*UP) + square.set_color(DARK_BLUE) + self.play(ShowCreation(square), Write(Text1), Write(Text2), ShowCreation(arrow_i), ShowCreation(arrow_j)) + self.wait(1) + + Text3 = TextMobject("After"," Vertical") + Text3[0].set_color(RED) + Text4 = TextMobject("Shear Transformation") + + Text3.move_to(4*RIGHT+2*UP) + Text4.move_to(4*RIGHT+1*UP) + + trans_arrow_i = Arrow(stroke_width = 3, start = self.graph_origin + 0.15*DOWN + 0.15*LEFT, end = self.graph_origin+1*XTD*UP+1*YTD*RIGHT+0.25*UP+0.25*RIGHT) + trans_arrow_j = Arrow(stroke_width = 3, start = self.graph_origin + 0.25*DOWN, end = self.graph_origin+1*XTD*UP+ 0.25*UP) + trans_arrow_i.set_color(RED) + trans_arrow_j.set_color(RED) + + rhombus = Polygon(self.graph_origin,self.graph_origin+2*XTD*UP, self.graph_origin+2*XTD*RIGHT+4*YTD*UP, self.graph_origin+2*XTD*RIGHT+2*YTD*UP) + self.play(Transform(arrow_i,trans_arrow_i), Transform(arrow_j,trans_arrow_j), FadeOut(square), ShowCreation(rhombus), Transform(Text1,Text3), Transform(Text2,Text4)) + self.wait(1)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear_gif.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear_gif.gif Binary files differnew file mode 100644 index 0000000..7ca323f --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file7_Vertical_Shear_gif.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file8_linear_transformation.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file8_linear_transformation.py new file mode 100755 index 0000000..01a0cef --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file8_linear_transformation.py @@ -0,0 +1,27 @@ +from manimlib.imports import *
+class LinearTrans(LinearTransformationScene,MovingCameraScene):
+ CONFIG = {
+ "basis_vector_stroke_width": 1,
+ "leave_ghost_vectors": True,
+ }
+
+ def setup(self):
+ LinearTransformationScene.setup(self)
+ MovingCameraScene.setup(self)
+
+ def construct(self):
+ self.setup()
+ self.camera_frame.save_state()
+ self.play(self.camera_frame.set_width, 7)
+ matrix = [[0.866,-0.5],[0.5,0.866]]
+ self.apply_matrix(matrix)
+ arc1 = Arc(radius = 0.25,angle=TAU/12)
+ arc2 = Arc(radius = 0.25,angle=TAU/12,start_angle=TAU/4)
+ text1 = TextMobject(r"$\theta$")
+ text1.scale(0.5)
+ text1.move_to(0.5*UP+0.125*LEFT)
+ text2 = TextMobject(r"$\theta$")
+ text2.scale(0.5)
+ text2.move_to(0.5*RIGHT+0.125*UP)
+ self.play(ShowCreation(arc1),ShowCreation(arc2),Write(text1),Write(text2),run_time=1)
+ self.wait()
diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file9.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file9.gif Binary files differnew file mode 100644 index 0000000..017e0c7 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file9.gif |