diff options
author | Vaishnavi | 2020-06-24 04:34:04 +0530 |
---|---|---|
committer | GitHub | 2020-06-24 04:34:04 +0530 |
commit | 1e9bdf332754d334c03d5486635d74cd613ce7bc (patch) | |
tree | 62baa0d776b4d7f480db5c4cf7508a7d173f80bc /FSF-2020/linear-algebra/linear-transformations | |
parent | 581ad7f906e4b9a13d5fe963229d458f0abff7f2 (diff) | |
parent | ed86b5f6d84efe35cea6b63b4f7d6afce8cde4b7 (diff) | |
download | FSF-mathematics-python-code-archive-1e9bdf332754d334c03d5486635d74cd613ce7bc.tar.gz FSF-mathematics-python-code-archive-1e9bdf332754d334c03d5486635d74cd613ce7bc.tar.bz2 FSF-mathematics-python-code-archive-1e9bdf332754d334c03d5486635d74cd613ce7bc.zip |
Merge pull request #1 from FOSSEE/master
update fork. DONE
Diffstat (limited to 'FSF-2020/linear-algebra/linear-transformations')
17 files changed, 864 insertions, 0 deletions
diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file.txt b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file.txt new file mode 100644 index 0000000..cae98ce --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file.txt @@ -0,0 +1,3 @@ +file 'text.mp4' +file 'LinearTransformation.mp4' +file 'NonLinearTransformation.mp4' 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..677f890 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py @@ -0,0 +1,45 @@ +from manimlib.imports import * + +class text(Scene): + def construct(self): + text1 = TextMobject("For a grid, undergoing a linear transformation, all it's 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) + text1.move_to(ORIGIN+UP) + text2.move_to(ORIGIN) + self.play(Write(text1)) + self.play(Write(text2)) + self.wait() + self.play(FadeOut(text1),FadeOut(text2)) + +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) + 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()
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file2_Understand_Linear_Transformations_visually.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file2_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)/file2_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)/file3_Uniform_Scaling.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file3_Uniform_Scaling.py new file mode 100644 index 0000000..a7856a5 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file3_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)/file4_Horizontal_Shear.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_Horizontal_Shear.py new file mode 100644 index 0000000..91f098e --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_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)/file4_Horizontal_Shear_gif.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_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)/file4_Horizontal_Shear_gif.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_Vertical_Shear.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_Vertical_Shear.py new file mode 100644 index 0000000..718e4e0 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_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)/file5_Vertical_Shear_gif.gif b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file5_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)/file5_Vertical_Shear_gif.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_linear_transformation.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_linear_transformation.py new file mode 100755 index 0000000..01a0cef --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file6_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/Orthonormal Basis/file1_orthogonal.py b/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file1_orthogonal.py new file mode 100755 index 0000000..b400f93 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file1_orthogonal.py @@ -0,0 +1,34 @@ +from manimlib.imports import *
+
+class Orthogonal(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ self.play(ShowCreation(axes))
+ self.move_camera(phi=30*DEGREES,theta=-45*DEGREES,run_time=3)
+ line1 = Line(start = ORIGIN,end = -3*LEFT)
+ line1.set_color(DARK_BLUE)
+ tip1 = Polygon(-LEFT,-0.8*LEFT-0.2*DOWN,-0.8*LEFT-0.2*UP)
+ tip1.move_to(-3*LEFT)
+ tip1.set_opacity(1)
+ tip1.set_fill(DARK_BLUE)
+ tip1.set_color(DARK_BLUE)
+
+ arrow2 = Line(start = ORIGIN,end = -3*UP)
+ arrow2.set_color(DARK_BLUE)
+ tip2 = Polygon(DOWN,0.8*DOWN-0.2*RIGHT,0.8*DOWN-0.2*LEFT)
+ tip2.move_to(3*DOWN)
+ tip2.set_opacity(1)
+ tip2.set_fill(DARK_BLUE)
+ tip2.set_color(DARK_BLUE)
+ arrow2.set_color(DARK_BLUE)
+
+ arrow3 = Line(start = ORIGIN,end = [0,0,3])
+ arrow3.set_color(DARK_BLUE)
+ tip3 = Polygon([0,0,3],[0,0,2.8]-0.2*RIGHT,[0,0,2.8]-0.2*LEFT)
+ tip3.set_opacity(1)
+ tip3.set_fill(DARK_BLUE)
+ tip3.set_color(DARK_BLUE)
+
+ self.play(ShowCreation(line1), ShowCreation(tip1), ShowCreation(arrow2), ShowCreation(tip2), ShowCreation(arrow3), ShowCreation(tip3))
+
+ self.wait()
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file2_OrthonormalBasis.py b/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file2_OrthonormalBasis.py new file mode 100644 index 0000000..0a28f22 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file2_OrthonormalBasis.py @@ -0,0 +1,82 @@ +from manimlib.imports import * +class OrthonormalBasis(GraphScene): + CONFIG = { + "x_min" : -6, + "x_max" : 6, + "y_min" : -4, + "y_max" : 4, + "graph_origin" : ORIGIN , +} + + def construct(self): + self.setup_axes(animate=True) + + XTD = self.x_axis_width/(self.x_max-self.x_min) + YTD = self.y_axis_height/(self.y_max-self.y_min) + + arrow1 = Arrow(start = ORIGIN,end = 0.707*YTD*UP+0.707*XTD*RIGHT) + arrow1.scale(2.25) + arrow1.set_color(DARK_BLUE) + + arrow2 = Arrow(start = ORIGIN,end = 0.707*YTD*UP+0.707*XTD*LEFT) + arrow2.scale(2.25) + arrow2.set_color(DARK_BLUE) + + square = Polygon(UP*0.4*YTD,0.2*(YTD*UP+XTD*RIGHT),ORIGIN,0.2*(YTD*UP+XTD*LEFT)) + square.set_color(DARK_BLUE) + self.play(ShowCreation(arrow2), ShowCreation(arrow1), ShowCreation(square)) + + ortho = TextMobject("Orthonormal Vectors") + ortho.scale(0.75) + ortho.move_to(DOWN+3*RIGHT) + self.play(Write(ortho)) + self.wait() + self.play(FadeOut(ortho)) + + arrow3 = Arrow(start = ORIGIN,end = YTD*3*UP+XTD*LEFT) + arrow3.scale(1.25) + arrow3.set_color(GOLD_E) + self.play(ShowCreation(arrow3)) + + arrow4 = Arrow(start = ORIGIN,end = YTD*UP+XTD*RIGHT) + arrow4.scale(1.8) + arrow4.set_color(GOLD_A) + + arrow5 = Arrow(start = ORIGIN,end = 2*YTD*UP-2*XTD*RIGHT) + arrow5.scale(1.3) + arrow5.set_color(GOLD_A) + + self.play(ShowCreation(arrow5), ShowCreation(arrow4)) + + self.wait() + + self.play(FadeOut(arrow1), FadeOut(arrow2), FadeOut(square)) + + self.wait() + + text1 = TextMobject(r"$<v,v_1> v_1$") + text1.move_to(UP+2*RIGHT) + text1.scale(0.75) + text2 = TextMobject(r"$<v,v_2> v_2$") + text2.move_to(UP+3*LEFT) + text2.scale(0.75) + + text3 = TextMobject("v") + text3.move_to(YTD*3.5*UP+XTD*1.5*LEFT) + + self.play(Write(text1), Write(text2), Write(text3)) + self.wait() + + line1 = DashedLine(start = YTD*UP+XTD*RIGHT, end = YTD*3*UP+XTD*1*LEFT) + line2 = DashedLine(start = YTD*2*UP+XTD*2*LEFT, end = YTD*3*UP+XTD*1*LEFT) + self.play(ShowCreation(line1),ShowCreation(line2)) + + self.wait() + + text = TextMobject(r"$v$ is the sum of projections","on the orthonormal vectors") + text[0].move_to(DOWN+3.2*RIGHT) + text[1].move_to(1.5*DOWN+3.2*RIGHT) + self.play(Write(text)) + self.wait(2) + self.play(FadeOut(arrow3), FadeOut(arrow4), FadeOut(arrow5), FadeOut(text1), FadeOut(text2), FadeOut(text3), FadeOut(self.axes), FadeOut(line1), FadeOut(line2)) + self.play(FadeOut(text)) diff --git a/FSF-2020/linear-algebra/linear-transformations/README.md b/FSF-2020/linear-algebra/linear-transformations/README.md new file mode 100644 index 0000000..692201e --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/README.md @@ -0,0 +1,9 @@ +# Contributer: Archit Sangal
+My Github Account : <a href="https://github.com/architsangal">architsangal</a>
+<br/></br>
+## Sub-Topics Covered:
++ Vector Space Homomorphisms (Linear Maps)
++ The Four Fundamental Subspaces
++ Rank-Nullity Theorem
++ Orthonormal basis
++ Gramm-Schmidt Orthogonalization Process
diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.gif Binary files differnew file mode 100644 index 0000000..7d8d2e1 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.py new file mode 100644 index 0000000..afe4f9a --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.py @@ -0,0 +1,30 @@ +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)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_Row_Space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_Row_Space.py new file mode 100644 index 0000000..b16a32a --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_Row_Space.py @@ -0,0 +1,145 @@ +from manimlib.imports import * + +class Row_Space(Scene): + def construct(self): + + Heading = TextMobject("Row Space") + defn1 = TextMobject("Definition 1: Row Space of a matrix is the linear combination of the rows of that matrix.") + defn2 = TextMobject("Definition 2: It is a vector space generated by a linear combination of the columns of $A^{T}$.") + equivalent = TextMobject(r"Definition 1 $\equiv$ Definition 2") + + Heading.move_to(2*UP) + Heading.set_color(color = DARK_BLUE) + + defn1.move_to(UP) + defn1.scale(0.75) + + defn2.scale(0.75) + + equivalent.move_to(DOWN) + + self.play(Write(Heading)) + self.play(Write(defn1)) + self.play(Write(defn2)) + self.play(Write(equivalent)) + + self.wait(2) + self.play(FadeOut(Heading),FadeOut(defn1),FadeOut(defn2),ApplyMethod(equivalent.move_to,2*UP)) + + how = TextMobject("Let us see, How?") + how.move_to(UP) + self.play(Write(how)) + self.play(FadeOut(equivalent),FadeOut(how)) + + 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+3*LEFT) + A[1].set_color(color = DARK_BLUE) + A.scale(0.80) + + self.play(Write(A)) + + rows = TextMobject(r"Rows of A $\rightarrow$", + r"$\left( \begin{array}{c c c} 1 & 2 & 1 \end{array} \right)$,", + r"$ \left( \begin{array}{c c c} 1 & 3 & 1 \end{array} \right)$,", + r"$\left( \begin{array}{c c c} 2 & 1 & 4 \end{array} \right)$,", + r"$ \left( \begin{array}{c c c} 3 & 2 & 3 \end{array} \right)$") + rows.scale(0.75) + rows[1:5].set_color(DARK_BLUE) + self.play(Write(rows)) + + ac_defn1 = TextMobject("According to Definition 1 : ") + ac_defn1.move_to(DOWN) + + RS_A = TextMobject(r"Row Space of $A = x_{1}$", + r"$\left( \begin{array}{c c c} 1 & 2 & 1 \end{array} \right)$", + r"$+x_{2}$", + r"$ \left( \begin{array}{c c c} 1 & 3 & 1 \end{array} \right)$", + r"$ + x_{3}$", + r"$\left( \begin{array}{c c c} 2 & 1 & 4 \end{array} \right)$", + r"$+x_{4}$", + r"$ \left( \begin{array}{c c c} 3 & 2 & 3 \end{array} \right)$") + RS_A.move_to(DOWN+DOWN) + RS_A[6].move_to(2*DOWN+DOWN) + RS_A[7].move_to(2*DOWN+2*RIGHT+DOWN) + RS_A[1].set_color(color = DARK_BLUE) + RS_A[3].set_color(color = DARK_BLUE) + RS_A[5].set_color(color = DARK_BLUE) + RS_A[7].set_color(color = DARK_BLUE) + RS_A.scale(0.75) + + self.play(FadeOut(rows[0]),Transform(rows[1],RS_A[1]),Transform(rows[2],RS_A[3]),Transform(rows[3],RS_A[5]),Transform(rows[4],RS_A[7])) + self.play(FadeIn(ac_defn1), Write(RS_A)) + self.wait(1) + + self.play(FadeOut(rows[1]), FadeOut(rows[2]), FadeOut(rows[3]), FadeOut(rows[4]), FadeOut(RS_A), FadeOut(ac_defn1)) + + A_T = TextMobject(r"$A^{T} = $",r"$\left( \begin{array}{c c c c} 1 & 1 & 2 & 3 \\ 2 & 3 & 1 & 2 \\ 1 & 1 & 4 & 3 \end{array} \right)$") + A_T.move_to(2*UP+3*RIGHT) + A_T[1].set_color(color = DARK_BLUE) + A_T.scale(0.80) + + self.play(Write(A_T)) + + change1 = TextMobject(r"Rows of $A\equiv$ Columns of $A^{T}$") + change2 = TextMobject(r"Columns of $A\equiv$ Rows of $A^{T}$") + change2.move_to(DOWN) + + change3 = TextMobject(r"Row Space of $A$ = Linear Combination of",r"Rows","of",r"A") + change3.move_to(2*DOWN) + change3[1].set_color(DARK_BLUE) + change3[3].set_color(DARK_BLUE) + + self.play(Write(change1)) + self.play(Write(change2)) + self.play(Write(change3)) + + columns = TextMobject("Columns") + columns.scale(0.6) + columns.set_color(DARK_BLUE) + columns.move_to(2*DOWN+4.1*RIGHT) + + a = TextMobject(r"$A^{T}$") + a.set_color(DARK_BLUE) + a.move_to(1.95*DOWN+5.6*RIGHT) + + self.wait(0.5) + + self.play(Transform(change3[1],columns), Transform(change3[3],a)) + + equal = TextMobject(r"= Column Space($A^{T}$)") + equal.move_to(3*DOWN+0.5*RIGHT) + + self.play(Write(equal)) + + self.play(FadeOut(A_T), FadeOut(change1), FadeOut(change2), FadeOut(change3), FadeOut(A), FadeOut(equal)) + + ac_defn1.move_to(3*UP) + RS_A.move_to(1.5*UP) + RS_A[6].move_to(UP) + RS_A[7].move_to(UP+1.5*RIGHT) + + self.play(Write(RS_A),FadeIn(ac_defn1)) + + CS_AT = TextMobject(r"Row Space of $A = x_{1}$", + r"$\left( \begin{array}{c} 1 \\ 2 \\ 1 \end{array} \right)$", + r"$+x_{2}$", + r"$ \left( \begin{array}{c} 1 \\ 3 \\ 1 \end{array} \right)$", + r"$ + x_{3}$", + r"$\left( \begin{array}{c} 2 \\ 1 \\ 4 \end{array} \right)$", + r"$+x_{4}$", + r"$ \left( \begin{array}{c} 3 \\ 2 \\ 3 \end{array} \right)$") + CS_AT.move_to(1.5*DOWN) + CS_AT[1].set_color(color = DARK_BLUE) + CS_AT[3].set_color(color = DARK_BLUE) + CS_AT[5].set_color(color = DARK_BLUE) + CS_AT[7].set_color(color = DARK_BLUE) + CS_AT.scale(0.75) + + ac_defn2 = TextMobject("According to Definition 2 : ") + equivalent = TextMobject(r"Hence, Definition 1 $\equiv$ Definition 2") + equivalent.move_to(3*DOWN) + + self.play(Write(CS_AT),FadeIn(ac_defn2)) + self.play(Write(equivalent)) + + self.wait() diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file.txt b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file.txt new file mode 100644 index 0000000..5c48a13 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file.txt @@ -0,0 +1,3 @@ +file 'RN_Line.mp4' +file 'RN_Point.mp4' +file 'RN_SameDim.mp4' diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file1_RN_Theorem.py b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file1_RN_Theorem.py new file mode 100755 index 0000000..e54276c --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file1_RN_Theorem.py @@ -0,0 +1,97 @@ +from manimlib.imports import *
+class RN_Line(LinearTransformationScene):
+ def construct(self):
+
+ self.setup()
+ self.wait()
+
+ predim = TextMobject("Dimension of this vector space is 2")
+ predim.move_to(DOWN+4*LEFT)
+ predim.scale(0.75)
+ predim.add_background_rectangle()
+ self.play(Write(predim))
+ self.wait()
+ self.play(FadeOut(predim))
+
+ afterlt = TextMobject("After Linear transformation")
+ afterlt.move_to(DOWN+4*LEFT)
+ afterlt.scale(0.75)
+ afterlt.add_background_rectangle()
+
+ afterlt2 = TextMobject("Dimension of the vector space","changes to 1")
+ afterlt2[0].move_to(1.5*DOWN+4*LEFT)
+ afterlt2[1].move_to(2*DOWN+4*LEFT)
+ afterlt2.scale(0.75)
+ afterlt2.add_background_rectangle()
+ matrix = [[1,1],[1,1]]
+ self.apply_matrix(matrix)
+ self.play(Write(afterlt))
+ self.play(Write(afterlt2))
+ self.wait()
+ nullity = TextMobject("Hence, nullity = 1")
+ nullity.move_to(DOWN+4*LEFT)
+ self.play(FadeOut(afterlt),FadeOut(afterlt2),Write(nullity))
+ self.wait(1)
+ self.play(FadeOut(nullity))
+
+class RN_Point(LinearTransformationScene):
+ def construct(self):
+ self.setup()
+ self.wait()
+ predim = TextMobject("Another One")
+ predim.move_to(DOWN+4*LEFT)
+ predim.scale(0.75)
+ predim.add_background_rectangle()
+ self.play(Write(predim))
+ self.wait()
+ self.play(FadeOut(predim))
+ afterlt = TextMobject("After Linear transformation")
+ afterlt.move_to(DOWN+4*LEFT)
+ afterlt.scale(0.75)
+ afterlt.add_background_rectangle()
+ afterlt2 = TextMobject("Dimension of the vector space","changes to 0")
+ afterlt2[0].move_to(1.5*DOWN+4*LEFT)
+ afterlt2[1].move_to(2*DOWN+4*LEFT)
+ afterlt2.scale(0.75)
+ afterlt2.add_background_rectangle()
+ matrix = [[0,0],[0,0]]
+ self.apply_matrix(matrix)
+ self.play(Write(afterlt))
+ self.play(Write(afterlt2))
+ self.wait()
+ nullity = TextMobject("Hence, nullity = 2")
+ nullity.move_to(DOWN+4*LEFT)
+ self.play(FadeOut(afterlt),FadeOut(afterlt2),Write(nullity))
+ self.wait(1)
+ self.play(FadeOut(nullity))
+
+class RN_SameDim(LinearTransformationScene):
+ def construct(self):
+ self.setup()
+ self.wait()
+ predim = TextMobject("Let us look at another example")
+ predim.add_background_rectangle()
+ predim.move_to(DOWN+4*LEFT)
+ predim.scale(0.75)
+ self.play(Write(predim))
+ self.wait()
+ self.play(FadeOut(predim))
+ afterlt = TextMobject("After Linear transformation")
+ afterlt.move_to(DOWN+4*LEFT)
+ afterlt.scale(0.75)
+ afterlt.add_background_rectangle()
+ afterlt2 = TextMobject("Dimension of the vector space","remains to be 2")
+ afterlt2[0].move_to(1.5*DOWN+4*LEFT)
+ afterlt2[1].move_to(2*DOWN+4*LEFT)
+ afterlt2.scale(0.75)
+ afterlt2.add_background_rectangle()
+ matrix = [[1,1],[0,1]]
+ self.apply_matrix(matrix)
+ self.play(Write(afterlt))
+ self.play(Write(afterlt2))
+ self.wait()
+ nullity = TextMobject("Hence, nullity = 0")
+ nullity.move_to(DOWN+4*LEFT)
+ self.play(FadeOut(afterlt),FadeOut(afterlt2),Write(nullity))
+ self.wait(1)
+ self.play(FadeOut(nullity))
\ No newline at end of file |