diff options
4 files changed, 543 insertions, 32 deletions
diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py index e0476a3..96e456d 100755 --- a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py @@ -27,37 +27,37 @@ class Linear(GraphScene): self.wait() before = TextMobject("Before Linear Transformation") - before.set_color(DARK_BLUE) + 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(DARK_BLUE) - dot2.set_color(DARK_BLUE) + dot1.set_color(ORANGE) + dot2.set_color(ORANGE) p1 = TextMobject(r"$P_1$") p1.scale(0.75) - p1.set_color(DARK_BLUE) + 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(DARK_BLUE) + 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(RED) + 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(RED) - dot4.set_color(RED) + dot3.set_color(YELLOW) + dot4.set_color(YELLOW) p3 = TextMobject(r"$T(P_1)$") p3.scale(0.7) - p3.set_color(RED) + 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(RED) + 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)) @@ -76,52 +76,54 @@ class withgrid(LinearTransformationScene): self.wait() before = TextMobject("Before Linear Transformation") - before.set_color(DARK_BLUE) + 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(DARK_BLUE) - dot2.set_color(DARK_BLUE) + 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(RED) - dot2_c.set_color(RED) + 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(DARK_BLUE) + p1.set_color(ORANGE) p1.move_to(1*RIGHT+1.5*UP) p2 = TextMobject(r"$P_2$") p2.scale(0.75) - p2.set_color(DARK_BLUE) + p2.set_color(ORANGE) p2.move_to(2*RIGHT+1.5*UP) after = TextMobject("After applying Linear Transformation") - after.set_color(RED) + 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(RED) - dot4.set_color(RED) + dot3.set_color(YELLOW) + dot4.set_color(YELLOW) p3 = TextMobject(r"$T(P_1)$") p3.scale(0.75) - p3.set_color(RED) + 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(RED) + 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(FadeOut(dot1),FadeOut(dot2)) self.play(Transform(before,after), Transform(p2,p4), Transform(p1,p3)) self.play(Transform(before,after)) self.wait(3) @@ -145,7 +147,7 @@ class ThreeDExplanation(ThreeDScene): before = TextMobject("Before Linear Transformation") self.add_fixed_in_frame_mobjects(before) - before.set_color(YELLOW) + before.set_color(ORANGE) before.move_to(3.5*UP+4*RIGHT) before.scale(0.75) @@ -158,9 +160,9 @@ class ThreeDExplanation(ThreeDScene): dot1 = Dot().shift(1*RIGHT+1*UP) dot2 = Dot().shift(2*RIGHT+1*UP) dot3 = Dot().shift(1*RIGHT+1*DOWN) - dot1.set_color(YELLOW) - dot2.set_color(YELLOW) - dot3.set_color(YELLOW) + 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]) @@ -170,9 +172,9 @@ class ThreeDExplanation(ThreeDScene): 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(RED) - dot2_c.set_color(RED) - dot3_c.set_color(RED) + 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)) @@ -191,7 +193,7 @@ class ThreeDExplanation(ThreeDScene): self.play(FadeOut(before)) after = TextMobject("After applying Linear Transformation") self.add_fixed_in_frame_mobjects(after) - after.set_color(RED) + after.set_color(YELLOW) after.move_to(3.5*UP+3.5*RIGHT) after.scale(0.75) @@ -223,4 +225,8 @@ class ThreeDExplanation(ThreeDScene): self.add_fixed_in_frame_mobjects(ending) self.play(FadeOut(plane)) - self.wait(9) + self.wait(3) + + self.begin_ambient_camera_rotation(rate=0.5) + self.wait(5) + self.stop_ambient_camera_rotation() diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/square.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/square.py new file mode 100644 index 0000000..e828de4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/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/The-Four-Fundamental-Subspaces/CSasImage.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/CSasImage.py new file mode 100644 index 0000000..fbb3291 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/CSasImage.py @@ -0,0 +1,168 @@ +from manimlib.imports import * + +class Column_Space(Scene): + def construct(self): + + A = TextMobject(r"$A = $",r"$\left( \begin{array}{c c c} 1 & 2 & 1 \\ 1 & 3 & 1 \\ 2 & 1 & 4 \\ 3 & 2 & 3 \end{array} \right)$") + A.move_to(2*UP) + A[1].set_color(color = DARK_BLUE) + A.scale(0.75) + + self.play(Write(A),run_time = 1) + + CS_A = TextMobject(r"Column Space of $A = x_{1}$",r"$\left( \begin{array}{c} 1 \\ 1 \\ 2 \\ 3 \end{array} \right)$",r"$+x_{2}$",r"$ \left( \begin{array}{c} 2 \\ 3 \\ 1 \\ 2 \end{array} \right)$",r"$ + x_{3}$",r"$\left( \begin{array}{c} 1 \\ 1 \\ 4 \\ 3 \end{array} \right)$") + CS_A.move_to(1.5*LEFT+1*DOWN) + CS_A[1].set_color(color = DARK_BLUE) + CS_A[3].set_color(color = DARK_BLUE) + CS_A[5].set_color(color = DARK_BLUE) + CS_A.scale(0.75) + + self.play(Write(CS_A),run_time = 2) + + arrow1 = Arrow(start = 1.25*UP,end = 0.25*DOWN+1.75*LEFT) + arrow2 = Arrow(start = 1.35*UP+0.5*RIGHT,end = 0.25*DOWN+0.5*RIGHT) + arrow3 = Arrow(start = 1.25*UP+0.75*RIGHT,end = 0.25*DOWN+2.9*RIGHT) + + Defn = TextMobject("Linear Combination of Columns of Matrix") + Defn.move_to(3*DOWN) + + self.play(Write(Defn), ShowCreation(arrow1), ShowCreation(arrow2), ShowCreation(arrow3),run_time = 1) + self.wait(1) + +class solution(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + o = TextMobject(r"Consider the vector space $R^2$") + o.move_to(2*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + A = TextMobject(r"Let $A$(= ",r"$\left[\begin{array}{c c} 1 & -1 \\ 1 & -1 \end{array}\right]$",r")denote the matrix the of this linear transformation.") + A.move_to(2*DOWN) + A.scale(0.75) + A.add_background_rectangle() + self.play(Write(A)) + matrix = [[1,-1],[1,-1]] + self.apply_matrix(matrix) + self.wait() + self.play(FadeOut(A)) + + o = TextMobject(r"This is the transformed vector space") + o.move_to(2*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + texti = TextMobject(r"$\left[\begin{array}{c}1\\1\end{array}\right]$") + textj = TextMobject(r"$\left[\begin{array}{c}-1\\-1\end{array}\right]$") + texti.set_color(GREEN) + textj.set_color(RED) + texti.scale(0.7) + textj.scale(0.7) + texti.move_to(1.35*RIGHT+0.5*UP) + textj.move_to(-(1.5*RIGHT+0.5*UP)) + + text1 = TextMobject("[") + text2 = TextMobject(r"$\begin{array}{c} 1 \\ 1 \end{array}$") + text3 = TextMobject(r"$\begin{array}{c} -1 \\ -1 \end{array}$") + text4 = TextMobject("]") + + text2.set_color(GREEN) + text3.set_color(RED) + + text1.scale(2) + text4.scale(2) + text2.scale(0.7) + text3.scale(0.7) + + text1.move_to(2.5*UP+6*LEFT) + text2.move_to(2.5*UP+5.75*LEFT) + text3.move_to(2.5*UP+5.25*LEFT) + text4.move_to(2.5*UP+5*LEFT) + + self.play(Write(texti), Write(textj)) + self.wait() + self.play(FadeIn(text1), Transform(texti,text2), Transform(textj,text3), FadeIn(text4)) + self.wait() + + o = TextMobject(r"Now, you can observe the Image of Linear Transformation") + o1 = TextMobject(r"and Column Space(i.e. span of columns of matrix $A$) are same") + o.move_to(2.5*DOWN) + o1.move_to(3*DOWN) + o.scale(0.75) + o1.scale(0.75) + o.add_background_rectangle() + o1.add_background_rectangle() + self.play(Write(o)) + self.play(Write(o1)) + self.wait() + self.play(FadeOut(o),FadeOut(o1)) + +class solution2nd(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + arrow1 = Arrow(start = ORIGIN,end = 2*DOWN+RIGHT) + arrow2 = Arrow(start = ORIGIN,end = UP+LEFT) + arrow3 = Arrow(start = ORIGIN,end = 3*UP+4*RIGHT) + arrow1.set_color(YELLOW) + arrow2.set_color(YELLOW) + arrow3.set_color(YELLOW) + arrow1.scale(1.3) + arrow2.scale(1.5) + arrow3.scale(1.1) + + self.play(ShowCreation(arrow1), ShowCreation(arrow2), ShowCreation(arrow3)) + + self.add_transformable_mobject(arrow1) + self.add_transformable_mobject(arrow2) + self.add_transformable_mobject(arrow3) + o = TextMobject(r"Consider any vector in the original vector space $R^2$") + o.move_to(2.5*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + A = TextMobject(r"Matrix the of this linear transformation is $A$(= ",r"$\left[\begin{array}{c c} 1 & -1 \\ 1 & -1 \end{array}\right]$",r") again.") + A.move_to(2*DOWN) + A.scale(0.75) + A.add_background_rectangle() + self.play(Write(A)) + matrix = [[1,-1],[1,-1]] + self.apply_matrix(matrix) + self.wait() + self.play(FadeOut(A)) + + o = TextMobject(r"This is the transformed vector space") + o.move_to(2*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + o = TextMobject(r"Each and every vector of original vector space $R^2$ will transform") + o1 = TextMobject(r"to this new vector space which is spanned by $\mathbf{CS}(A)$") + o.move_to(2.5*DOWN) + o1.move_to(3*DOWN) + o.scale(0.75) + o1.scale(0.75) + o.add_background_rectangle() + o1.add_background_rectangle() + self.play(Write(o)) + self.play(Write(o1)) + self.wait() + self.play(FadeOut(o)) + self.play(FadeOut(o1))
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/null_space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/null_space.py new file mode 100644 index 0000000..dfc3cb4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/null_space.py @@ -0,0 +1,91 @@ +from manimlib.imports import * +class null_space(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + o = TextMobject(r"This is the original $2D$ vector space(before Linear Transformation)") + o.move_to(DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + o1 = TextMobject("Consider a set of vectors which are linear") + o2 = TextMobject(r"span of a particular vector $\left(\begin{array}{c} 1 \\ 1 \end{array}\right)$") + o1.move_to(2*DOWN+3*RIGHT) + o2.move_to(2.75*DOWN+3*RIGHT) + o1.scale(0.7) + o2.scale(0.7) + o1.add_background_rectangle() + o2.add_background_rectangle() + self.play(Write(o1)) + self.play(Write(o2)) + + arrow = Arrow(start = ORIGIN, end = UP+RIGHT) + arrow1 = Arrow(start = ORIGIN, end = 2*(UP+RIGHT)) + arrow2 = Arrow(start = ORIGIN, end = 3*(UP+RIGHT)) + arrow3 = Arrow(start = ORIGIN, end = 4*(UP+RIGHT)) + arrow4 = Arrow(start = ORIGIN, end = DOWN+LEFT) + arrow5 = Arrow(start = ORIGIN, end = 2*(DOWN+LEFT)) + arrow6 = Arrow(start = ORIGIN, end = 3*(DOWN+LEFT)) + arrow7 = Arrow(start = ORIGIN, end = 4*(DOWN+LEFT)) + + arrow.scale(1.5) + arrow1.scale(1.2) + arrow2.scale(1.15) + arrow3.scale(1.1) + arrow4.scale(1.5) + arrow5.scale(1.2) + arrow6.scale(1.15) + arrow7.scale(1.1) + + self.play(ShowCreation(arrow), + ShowCreation(arrow1), + ShowCreation(arrow2), + ShowCreation(arrow3), + ShowCreation(arrow4), + ShowCreation(arrow5), + ShowCreation(arrow6), + ShowCreation(arrow7), + ) + + self.wait(2) + self.play(FadeOut(o1), FadeOut(o2)) + + self.add_transformable_mobject(arrow) + self.add_transformable_mobject(arrow1) + self.add_transformable_mobject(arrow2) + self.add_transformable_mobject(arrow3) + self.add_transformable_mobject(arrow4) + self.add_transformable_mobject(arrow5) + self.add_transformable_mobject(arrow6) + self.add_transformable_mobject(arrow7) + + o1 = TextMobject("Notice, entire set of vectors which belong to the vector") + o2 = TextMobject(r"subspace(Linear Span of $\left(\begin{array}{c} 1 \\ 1 \end{array}\right)$) transforms to zero") + o1.move_to(2*DOWN+2.5*RIGHT) + o2.move_to(2.75*DOWN+2.5*RIGHT) + o1.scale(0.7) + o2.scale(0.7) + o1.add_background_rectangle() + o2.add_background_rectangle() + self.play(Write(o1)) + self.play(Write(o2)) + self.wait() + + matrix = [[1,-1],[1,-1]] + self.apply_matrix(matrix) + self.wait() + + self.play(FadeOut(o1), FadeOut(o2)) + + o = TextMobject(r"Hence, the vector space formed by linear span of $\left(\begin{array}{c} 1 \\ 1 \end{array}\right)$ is the null space of $A$") + o.move_to(DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait(2) + self.play(FadeOut(o), FadeOut(arrow), FadeOut(arrow1), FadeOut(arrow2), FadeOut(arrow3), FadeOut(arrow4), FadeOut(arrow5), FadeOut(arrow6), FadeOut(arrow7)) |