diff options
Diffstat (limited to 'FSF-2020/linear-algebra')
103 files changed, 3832 insertions, 344 deletions
diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/README.md b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/README.md new file mode 100644 index 0000000..832aa5d --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/README.md @@ -0,0 +1,18 @@ +# Contributer: Archit Sangal +My Github Account : <a href="https://github.com/architsangal">architsangal</a> (https://github.com/architsangal) +<br/></br> + +## Sub-Topics Covered: ++ Gramm-Schmidt Orthogonalization Process + +#### Video 1: Introduction to Gram-Schmidt Orthogonalization Process +![GIF1](file7.gif) + +#### Video 2: Obtaining orthogonal vectors using projections +![GIF2](file8.gif) + +#### Video 3: Visual Explanation of how Gram-Schmidt Orthogonalization Process give mutually orthonormal vectors +![GIF3](file5.gif) + +#### Video 4: Example of Orthonormal Vectors which are different from standard basis +![GIF4](file6.gif)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file1_introduction.py b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file1_introduction.py new file mode 100644 index 0000000..ccd23c9 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file1_introduction.py @@ -0,0 +1,33 @@ +from manimlib.imports import * + +class Orthonormal(Scene): + def construct(self): + Centre = DOWN + arrow_1 = Arrow(start = Centre+ORIGIN,end = Centre+1.414*(UP+RIGHT)) + arrow_2 = Arrow(start = Centre+ORIGIN,end = Centre+2*UP) + arrow_1.scale(1.35) + arrow_2.scale(1.35) + text = TextMobject("This is a set of linearly independent vectors") + text.scale(0.75) + text.move_to(3*UP+3*LEFT) + text.set_color(PURPLE_E) + arrow_1.set_color(PURPLE_E) + arrow_2.set_color(PURPLE_E) + self.play(Write(text)) + self.play(ShowCreation(arrow_1), ShowCreation(arrow_2)) + self.wait(2) + text1 = TextMobject("After we apply Gram-Schmidt Orthogonalization Process to set of linearly independent vectors") + text1.scale(0.6) + text1.move_to(3*UP+2*LEFT) + text1.set_color(GREEN) + arrow_a = Arrow(start = Centre+ORIGIN,end = Centre+0.707*(UP+RIGHT)) + arrow_a.set_color(GREEN) + arrow_a.scale(2) + self.play(Transform(text,text1)) + self.wait(2) + self.play(Transform(arrow_1,arrow_a)) + arrow_b = Arrow(start = Centre+ORIGIN,end = Centre+0.707*(UP+LEFT)) + arrow_b.set_color(GREEN) + arrow_b.scale(2) + self.play(Transform(arrow_2,arrow_b)) + self.wait(2)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py new file mode 100755 index 0000000..dd4b8d4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py @@ -0,0 +1,79 @@ +from manimlib.imports import * + +class Projections(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) + + arrow_a = Arrow(start = ORIGIN, end = 4*XTD*RIGHT) + arrow_a.scale(1.2) + arrow_a.set_color(DARK_BLUE) + arrow_b = Arrow(start = ORIGIN, end = 2*YTD*UP+2*XTD*RIGHT) + arrow_b.scale(1.3) + arrow_b.set_color(DARK_BLUE) + self.play(ShowCreation(arrow_a), ShowCreation(arrow_b)) + + text = TextMobject(r"Consider 2 linearly independent vectors $a$ and $b$") + text.set_color(DARK_BLUE) + text.scale(0.6) + text.move_to(3*YTD*UP+5*XTD*LEFT) + text_a = TextMobject("a") + text_a.move_to(0.4*YTD*DOWN+3*XTD*RIGHT) + text_a.set_color(DARK_BLUE) + text_b = TextMobject("b") + text_b.move_to(1.5*YTD*UP+RIGHT*XTD) + text_b.set_color(DARK_BLUE) + + self.play(Write(text),Write(text_a), Write(text_b)) + self.wait() + + arrow_b_copy = Arrow(start = ORIGIN, end = 2*YTD*UP+2*XTD*RIGHT) + arrow_b_copy.scale(1.25) + + arrow_p = Arrow(start = ORIGIN, end = 2*XTD*RIGHT) + arrow_p.scale(1.5) + arrow_p.set_color(GOLD_E) + + text_p = TextMobject("p") + text_p.move_to(0.25*DOWN+RIGHT) + text_p.set_color(GOLD_E) + + self.play(FadeOut(text), Transform(arrow_b_copy,arrow_p), FadeOut(text_a), FadeOut(text_b)) + text = TextMobject(r"$p$ is the projection of $b$ on $a$") + text.set_color(GOLD_E) + text.move_to(3*UP+4*LEFT) + text.scale(0.8) + self.play(Write(text),Write(text_p)) + self.wait() + + self.play(FadeIn(text_a), FadeIn(text_b)) + + arrow_o = Arrow(start = 2*XTD*RIGHT, end = 2*YTD*UP+2*XTD*RIGHT) + arrow_o.scale(1.5) + arrow_o.set_color(GREEN_E) + + text_o = TextMobject("b-p") + text_o.move_to(UP*YTD+2.7*XTD*RIGHT) + text_o.set_color(GREEN_E) + + self.play(ShowCreation(arrow_o)) + self.play(FadeOut(text),Write(text_o)) + + text = TextMobject(r"Observe, ($b-p$) is orthogonal to $a$") + text.set_color(GREEN_E) + text.move_to(2*DOWN+4*LEFT) + text.scale(0.8) + self.play(Write(text)) + self.wait(2) + + self.play(FadeOut(self.axes), FadeOut(arrow_a), FadeOut(arrow_b), FadeOut(arrow_b_copy), FadeOut(arrow_o), FadeOut(text_a), FadeOut(text_b), FadeOut(text_o), FadeOut(text_p), FadeOut(text))
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file3_orthonormal.py b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file3_orthonormal.py new file mode 100644 index 0000000..a74b641 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file3_orthonormal.py @@ -0,0 +1,335 @@ +from manimlib.imports import * + +class Algo(ThreeDScene): + def construct(self): + + axes = ThreeDAxes(x_min = -5,x_max=5,y_min=-3,y_max=3,z_min=-4,z_max=4) + self.play(ShowCreation(axes)) + + text = TextMobject(r"This is the vector $\beta_1 =\left[\begin{array}{c} 4\\0\\0 \end{array}\right]$") + text.set_color(GREEN) + text.scale(0.6) + text.move_to(3*UP+5*LEFT) + self.play(Write(text)) + + arrow_a = Arrow(start = ORIGIN, end = 4*RIGHT) + arrow_a.set_color(GREEN) + arrow_a.scale(1.15) + self.play(ShowCreation(arrow_a)) + + text_a = TextMobject(r"$\beta_1$") + text_a.move_to(0.4*DOWN+3*RIGHT) + text_a.set_color(GREEN) + text_a.scale(0.75) + self.play(Write(text_a)) + self.wait() + self.play(FadeOut(text)) + + text = TextMobject(r"Normalize $\beta_1$ to get $\alpha_1$") + text.set_color(DARK_BLUE) + text.scale(0.75) + text.move_to(3*UP+5*LEFT) + self.play(Write(text)) + + alpha_1 = Arrow(start = ORIGIN,end = RIGHT) + alpha_1.scale(1.9) + alpha_1.set_color(DARK_BLUE) + text_alpha_1 = TextMobject(r"$\alpha_1$") + text_alpha_1.move_to(0.4*DOWN+RIGHT) + text_alpha_1.set_color(DARK_BLUE) + text_alpha_1.scale(0.75) + self.play(Transform(text_a,text_alpha_1), Transform(arrow_a,alpha_1)) + self.wait() + self.play(FadeOut(text)) + + text = TextMobject(r"Consider another vector $\beta_2=\left[\begin{array}{c} 2\\2\\0 \end{array}\right]$") + text1 = TextMobject(r"which is linearly independent to $\beta_1$") + text.set_color(GREEN) + text1.set_color(GREEN) + text.scale(0.6) + text1.scale(0.6) + text.move_to(3*UP+4*LEFT) + text1.move_to(2*UP+4*LEFT) + self.play(Write(text)) + self.play(Write(text1)) + + arrow_b = Arrow(start = ORIGIN, end = 2*UP+2*RIGHT) + arrow_b.scale(1.2) + arrow_b.set_color(GREEN) + text_b = TextMobject(r"$\beta_2$") + text_b.move_to(1.5*UP+RIGHT) + text_b.set_color(GREEN) + text_b.scale(0.75) + + self.play(ShowCreation(arrow_b), Write(text_b)) + self.wait() + + arrow_b_copy = Arrow(start = ORIGIN, end = 2*UP+2*RIGHT) + arrow_b_copy.scale(1.2) + + arrow_p = Arrow(start = ORIGIN, end = 2*RIGHT) + arrow_p.scale(1.35) + arrow_p.set_color(GOLD_E) + + text_p = TextMobject("p") + text_p.move_to(0.25*DOWN+RIGHT) + text_p.set_color(GOLD_E) + + self.play(FadeOut(text), FadeOut(text1), Transform(arrow_b_copy,arrow_p), FadeOut(text_a), FadeOut(text_b)) + text = TextMobject(r"$p$ is the projection of $\beta_2$ on $\alpha_1$") + text.set_color(GOLD_E) + text.move_to(3*UP+4*LEFT) + text.scale(0.8) + self.play(Write(text),Write(text_p)) + self.wait() + + self.play(FadeIn(text_b)) + + arrow_o = Arrow(start = 2*RIGHT, end = 2*UP+2*RIGHT) + arrow_o.scale(1.35) + arrow_o.set_color(PURPLE_E) + + text_o = TextMobject(r"$\beta_2-p$") + text_o.move_to(UP+2.7*RIGHT) + text_o.scale(0.75) + text_o.set_color(PURPLE_E) + + self.play(ShowCreation(arrow_o)) + self.play(FadeOut(text),Write(text_o)) + + text = TextMobject(r"$\beta_2-p$ is orthogonal to p") + text1 = TextMobject(r"(and hence orthogonal to $\alpha_1$ also)") + text.set_color(PURPLE_E) + text1.set_color(PURPLE_E) + text.scale(0.7) + text1.scale(0.7) + text.move_to(3*UP+4*LEFT) + text1.move_to(2.5*UP+4*LEFT) + self.play(Write(text)) + self.play(Write(text1)) + self.wait(2) + + self.play(FadeOut(text_p), FadeIn(arrow_a), FadeOut(text), FadeOut(text1), FadeOut(arrow_b_copy), FadeOut(arrow_p), FadeOut(text_b), FadeOut(arrow_b)) + self.play(ApplyMethod(arrow_o.move_to,UP), ApplyMethod(text_o.move_to,RIGHT+UP)) + + text = TextMobject(r"Now, Normalize $\beta_2-p$") + text.set_color(DARK_BLUE) + text.scale(0.6) + text.move_to(3*UP+4*LEFT) + self.play(Write(text)) + + alpha_2 = Arrow(start = ORIGIN,end = UP) + alpha_2.scale(1.9) + alpha_2.set_color(DARK_BLUE) + text_alpha_2 = TextMobject(r"$\alpha_2$") + text_alpha_2.move_to(0.4*LEFT+UP) + text_alpha_2.set_color(DARK_BLUE) + text_alpha_2.scale(0.75) + self.play(Transform(text_o,text_alpha_2), Transform(arrow_o,alpha_2), FadeIn(text_a)) + self.wait() + self.play(FadeOut(text),FadeOut(text_a),FadeOut(text_o)) + + self.add(axes) + ############################################################################# + axis = TextMobject(r"$\alpha_1$",r"$\alpha_2$",r"$\alpha_3$",r"$\beta_3$",r"$\alpha_3$",r"$\alpha_3$",r"$\alpha_3$",r"$\alpha_3$") + axis.scale(0.5) + axis[0].move_to(0.5*RIGHT+[0,0,-0.5]) + axis[1].move_to(0.5*UP+[0,0,-0.5]) + axis[2].move_to(np.array([0,0,0.5])) + axis[3].move_to(np.array([1,1,1.5])) + self.add_fixed_orientation_mobjects(axis[0]) + self.add_fixed_orientation_mobjects(axis[1]) + ############################################################################# + + self.move_camera(phi=70*DEGREES,theta=30*DEGREES,run_time=3) + xy_plane = Polygon(5*RIGHT+3*UP,-5*RIGHT+3*UP,-5*RIGHT-3*UP,5*RIGHT-3*UP) + xy_plane.set_color("#333333") + xy_plane.set_fill("#333333") + xy_plane.set_opacity(1) + xy_plane.fade(0.7) + self.play(ShowCreation(xy_plane)) + + #self.begin_ambient_camera_rotation(rate=0.1) + + line1 = Line(start = ORIGIN,end = 1*RIGHT) + line1.set_color(DARK_BLUE) + tip1 = Polygon(RIGHT,0.8*RIGHT-0.2*DOWN,0.8*RIGHT-0.2*UP) + tip1.set_opacity(1) + tip1.set_fill(DARK_BLUE) + tip1.set_color(DARK_BLUE) + + arrow2 = Line(start = ORIGIN,end = 1*UP) + arrow2.set_color(DARK_BLUE) + tip2 = Polygon(UP,0.8*UP-0.2*RIGHT,0.8*UP-0.2*LEFT) + tip2.set_opacity(1) + tip2.set_fill(DARK_BLUE) + tip2.set_color(DARK_BLUE) + arrow2.set_color(DARK_BLUE) + + self.play(ShowCreation(line1), ShowCreation(tip1), ShowCreation(arrow2), ShowCreation(tip2), FadeOut(arrow_a), FadeOut(arrow_o)) + self.wait() + + a_line = Line(start = ORIGIN,end = 2*UP+2*RIGHT+[0,0,2]) + a_line.set_color(GOLD_E) + a_tip = Polygon(2*UP+2*RIGHT+[0,0,2],2*UP+1.6*RIGHT+[0,0,1.8],1.6*UP+2*RIGHT+[0,0,1.8]) + a_tip.set_opacity(1) + a_tip.set_fill(GOLD_E) + a_tip.set_color(GOLD_E) + + a_line_c1 = Line(start = ORIGIN,end = 2*UP+2*RIGHT+[0,0,2]) + a_line_c1.set_color(GOLD_E) + a_tip_c1 = Polygon(2*UP+2*RIGHT+[0,0,2],2*UP+1.6*RIGHT+[0,0,1.8],1.6*UP+2*RIGHT+[0,0,1.8]) + a_tip_c1.set_opacity(1) + a_tip_c1.set_fill(GOLD_E) + a_tip_c1.set_color(GOLD_E) + + self.play(ShowCreation(a_line), ShowCreation(a_tip), ShowCreation(a_line_c1), ShowCreation(a_tip_c1)) + + text = TextMobject(r"Now, we have a vector $\beta_3=\left[\begin{array}{c} 2\\2\\2 \end{array}\right]$") + text.set_color(GOLD_E) + text.scale(0.7) + self.add_fixed_in_frame_mobjects(text) + self.add_fixed_orientation_mobjects(axis[3]) + text.move_to(3*(DOWN+RIGHT)) + self.play(Write(text)) + self.wait() + self.play(FadeOut(text)) + + p_line1 = Line(start = ORIGIN,end = 2*RIGHT) + p_line1.set_color(GOLD_E) + p_tip1 = Polygon(2*RIGHT,1.8*RIGHT+0.2*DOWN,1.8*RIGHT+0.2*UP) + + p_tip1.set_opacity(1) + p_tip1.set_fill(GOLD_E) + p_tip1.set_color(GOLD_E) + + self.play(Transform(a_line_c1,p_line1),Transform(a_tip_c1,p_tip1)) + + text = TextMobject(r"Take projection of $\beta_3$ on $\alpha_1$") + text.scale(0.6) + text.set_color(GOLD_E) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*(DOWN+RIGHT)) + self.play(Write(text)) + self.begin_ambient_camera_rotation(rate=0.05) + self.wait() + self.play(FadeOut(text)) + + o_line1 = Line(start = 2*RIGHT,end = 2*UP+2*RIGHT+[0,0,2]) + o_line1.set_color(GREEN_E) + o_tip1 = Polygon(2*UP+2*RIGHT+[0,0,2],1.8*UP+2*RIGHT+[0,0,1.8]+0.2*RIGHT,1.8*UP+2*RIGHT+[0,0,1.8]-0.2*RIGHT) + o_tip1.set_opacity(1) + o_tip1.set_fill(GREEN_E) + o_tip1.set_color(GREEN_E) + + a_line1 = Line(start = ORIGIN,end = 2*UP+[0,0,2]) + a_line1.set_color(GREEN_E) + a_tip1 = Polygon(2*UP+[0,0,2],1.8*UP+[0,0,1.8]+0.2*RIGHT,1.8*UP+[0,0,1.8]-0.2*RIGHT) + a_tip1.set_opacity(1) + a_tip1.set_fill(GREEN_E) + a_tip1.set_color(GREEN_E) + + a_line1_c1 = Line(start = ORIGIN,end = 2*UP+[0,0,2]) + a_line1_c1.set_color(GREEN_E) + a_tip1_c1 = Polygon(2*UP+[0,0,2],1.8*UP+[0,0,1.8]+0.2*RIGHT,1.8*UP+[0,0,1.8]-0.2*RIGHT) + a_tip1_c1.set_opacity(1) + a_tip1_c1.set_fill(GREEN_E) + a_tip1_c1.set_color(GREEN_E) + + text = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$)") + text.set_color(GREEN_E) + text.scale(0.6) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*(DOWN+RIGHT)) + self.play(Write(text)) + + self.play(ShowCreation(o_line1), ShowCreation(o_tip1)) + self.wait(2) + self.play(FadeOut(a_line_c1), FadeOut(a_tip_c1), + FadeOut(a_line), FadeOut(a_tip), FadeOut(axis[3]), + Transform(o_line1,a_line1), Transform(o_tip1,a_tip1)) + + self.wait() + self.play(FadeOut(text)) + + p_arrow2 = Line(start = ORIGIN,end = 2*UP) + p_arrow2.set_color(GOLD_E) + p_tip2 = Polygon(2*UP,1.8*UP+0.2*RIGHT,1.8*UP+0.2*LEFT) + p_tip2.set_opacity(1) + p_tip2.set_fill(GOLD_E) + p_tip2.set_color(GOLD_E) + p_arrow2.set_color(GOLD_E) + + last_a = Line(start = 2*UP,end = [0,2,2]) + last_a.set_color(PURPLE_E) + last_a_tip = Polygon([0,0,2],[0,0,1.8]+0.2*RIGHT,[0,0,1.8]+0.2*LEFT) + last_a_tip.move_to([0,2,2]) + last_a_tip.set_opacity(1) + last_a_tip.set_fill(PURPLE_E) + last_a_tip.set_color(PURPLE_E) + + self.wait(5) + text = TextMobject(r"Take projection on $\alpha_2$") + text.scale(0.6) + text.set_color(GOLD_E) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*(DOWN+RIGHT)) + self.play(Write(text)) + self.play(Transform(a_line1_c1,p_arrow2),Transform(a_tip1_c1,p_tip2)) + self.wait() + self.play(FadeOut(text)) + + text = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$ + projection of $\beta_3$ on $\alpha_2$)") + text.set_color(PURPLE_E) + text.scale(0.6) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*DOWN+3.5*RIGHT) + self.play(Write(text)) + #self.play(ShowCreation(o_line1), ShowCreation(o_tip1)) + self.wait(2) + self.play(ShowCreation(last_a_tip), ShowCreation(last_a)) + self.wait() + self.play(FadeOut(text)) + + larrow3 = Line(start = ORIGIN,end = [0,0,2]) + larrow3.set_color(PURPLE_E) + ltip3 = Polygon([0,0,2],[0,0,1.8]+0.2*RIGHT,[0,0,1.8]+0.2*LEFT) + ltip3.set_opacity(1) + ltip3.set_fill(PURPLE_E) + ltip3.set_color(PURPLE_E) + self.wait() + self.play(FadeOut(o_line1), FadeOut(o_tip1), FadeOut(a_line1_c1), FadeOut(a_tip1_c1), Transform(last_a,larrow3), Transform(last_a_tip,ltip3)) + + text = TextMobject(r"Normalize, the vector") + text1 = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$ + projection of $\beta_3$ on $\alpha_2)$") + text.set_color(PURPLE_E) + text1.set_color(PURPLE_E) + text.scale(0.55) + text1.scale(0.55) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*DOWN+3*RIGHT) + text1.move_to(3.5*DOWN+3.25*RIGHT) + self.play(Write(text)) + self.add_fixed_in_frame_mobjects(text1) + self.play(Write(text1)) + + arrow3 = Line(start = ORIGIN,end = [0,0,1]) + arrow3.set_color(DARK_BLUE) + tip3 = Polygon([0,0,1],[0,0,0.8]-0.2*RIGHT,[0,0,0.8]-0.2*LEFT) + tip3.set_opacity(1) + tip3.set_fill(DARK_BLUE) + tip3.set_color(DARK_BLUE) + self.play(Transform(last_a,arrow3), Transform(last_a_tip,tip3)) + self.add_fixed_orientation_mobjects(axis[2]) + + self.wait() + self.play(FadeOut(text),FadeOut(text1)) + + text = TextMobject(r"These are the three orthonormal vectors $\alpha_1, \alpha_2, \alpha_3$") + text.set_color(DARK_BLUE) + self.add_fixed_in_frame_mobjects(text) + text.scale(0.6) + text.move_to(3*DOWN+3.5*RIGHT) + self.play(Write(text)) + + self.wait(8) diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file4_Non_Standard_Basis.py b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file4_Non_Standard_Basis.py new file mode 100644 index 0000000..1d23aa2 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file4_Non_Standard_Basis.py @@ -0,0 +1,69 @@ +from manimlib.imports import * + +class NSB(ThreeDScene): + def construct(self): + + line1 = Line(start = ORIGIN,end = 1*RIGHT) + line1.set_color(DARK_BLUE) + tip1 = Polygon(RIGHT,0.9*RIGHT-0.1*DOWN,0.9*RIGHT-0.1*UP) + tip1.set_opacity(1) + tip1.set_fill(DARK_BLUE) + tip1.set_color(DARK_BLUE) + + arrow2 = Line(start = ORIGIN,end = 1*UP) + arrow2.set_color(DARK_BLUE) + tip2 = Polygon(UP,0.9*UP-0.1*RIGHT,0.9*UP-0.1*LEFT) + 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,1]) + arrow3.set_color(DARK_BLUE) + tip3 = Polygon([0,0,1],[0,0,0.9]-0.1*RIGHT,[0,0,0.9]-0.1*LEFT) + tip3.set_opacity(1) + tip3.set_fill(DARK_BLUE) + tip3.set_color(DARK_BLUE) + + axes = ThreeDAxes(x_min = -3,x_max=3,y_min=-3,y_max=3,z_min=-3,z_max=3) + self.play(ShowCreation(axes)) + self.move_camera(phi=70*DEGREES,theta=0*DEGREES,run_time=3) + self.begin_ambient_camera_rotation(rate=0.2) + + #matrix = [[1,0,0],[0,1,0],[0,0,1]] + matrix = [[0.70710678118,-0.57735026919,-0.57735026919],[0.70710678118,0.57735026919,0.57735026919],[0,-0.57735026919,0.57735026919]] + matrix1 = [[0.70710678118,0,0],[0.70710678118,1,0],[0,0,1]] + + matrix1 = [[0.70710678118,-0.70710678118,0],[0.70710678118,0.70710678118,0],[0,0,1]] + matrix2 = [[1,0,0],[0,0.70710678118,0.70710678118],[0,-0.70710678118,0.70710678118]] + + + line1.apply_matrix(matrix1) + tip1.apply_matrix(matrix1) + arrow2.apply_matrix(matrix1) + tip2.apply_matrix(matrix1) + arrow3.apply_matrix(matrix1) + tip3.apply_matrix(matrix1) + + line1.apply_matrix(matrix2) + tip1.apply_matrix(matrix2) + arrow2.apply_matrix(matrix2) + tip2.apply_matrix(matrix2) + arrow3.apply_matrix(matrix2) + tip3.apply_matrix(matrix2) + + self.play(ShowCreation(line1), + ShowCreation(tip1), + ShowCreation(arrow2), + ShowCreation(tip2), + ShowCreation(arrow3), + ShowCreation(tip3)) + + text = TextMobject(r"This is also a set of Orthonormal Vectors") + text.set_color(DARK_BLUE) + self.add_fixed_in_frame_mobjects(text) + text.scale(0.6) + text.move_to(3*DOWN+3.5*RIGHT) + self.play(Write(text)) + + self.wait(22) diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file5.gif b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file5.gif Binary files differnew file mode 100644 index 0000000..cdc0f2d --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file5.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file6.gif b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file6.gif Binary files differnew file mode 100644 index 0000000..e03f265 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file6.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file7.gif b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file7.gif Binary files differnew file mode 100644 index 0000000..19a13dd --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file7.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file8.gif b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file8.gif Binary files differnew file mode 100644 index 0000000..0ef4551 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file8.gif 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)/file.txt b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file.txt deleted file mode 100644 index cae98ce..0000000 --- a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file.txt +++ /dev/null @@ -1,3 +0,0 @@ -file 'text.mp4' -file 'LinearTransformation.mp4' -file 'NonLinearTransformation.mp4' 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 index 677f890..0182bd9 100644 --- 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 @@ -2,16 +2,20 @@ 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 = 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)) + self.play(FadeOut(text1),FadeOut(text2),FadeOut(text3)) class LinearTransformation(LinearTransformationScene): CONFIG = { @@ -34,6 +38,7 @@ 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) @@ -42,4 +47,27 @@ class NonLinearTransformation(Scene): 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 + 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)/file2_Understand_Linear_Transformations_visually.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file4_Understand_Linear_Transformations_visually.py index 577032d..577032d 100644 --- 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)/file4_Understand_Linear_Transformations_visually.py 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)/file5_Uniform_Scaling.py index a7856a5..a7856a5 100644 --- 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)/file5_Uniform_Scaling.py 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)/file6_Horizontal_Shear.py index 91f098e..91f098e 100644 --- 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)/file6_Horizontal_Shear.py 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)/file6_Horizontal_Shear_gif.gif Binary files differindex 9bef1b6..9bef1b6 100644 --- 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)/file6_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)/file7_Vertical_Shear.py index 718e4e0..718e4e0 100644 --- 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)/file7_Vertical_Shear.py 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)/file7_Vertical_Shear_gif.gif Binary files differindex 7ca323f..7ca323f 100644 --- 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)/file7_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)/file8_linear_transformation.py index 01a0cef..01a0cef 100755 --- 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)/file8_linear_transformation.py 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 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 deleted file mode 100755 index b400f93..0000000 --- a/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file1_orthogonal.py +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index 0a28f22..0000000 --- a/FSF-2020/linear-algebra/linear-transformations/Orthonormal Basis/file2_OrthonormalBasis.py +++ /dev/null @@ -1,82 +0,0 @@ -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/Orthonormal-Basis/README.md b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/README.md new file mode 100644 index 0000000..e287fa1 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/README.md @@ -0,0 +1,15 @@ +# Contributer: Archit Sangal +My Github Account : <a href="https://github.com/architsangal">architsangal</a> (https://github.com/architsangal) +<br/></br> + +## Sub-Topics Covered: ++ Orthonormal Bases + +#### Video 1: Example of Orthonormal bases +![GIF1](file4.gif) + +#### Video 2: Adding the projections of a vector on orthonormal basis will produce the same vector +![GIF2](file5.gif) + +#### Video 3: Relating the example and the property +![GIF3](file6.gif)
\ No newline at end of file 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..a5d96f5 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file1_orthogonal.py @@ -0,0 +1,40 @@ +from manimlib.imports import *
+
+class Orthogonal(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ self.play(ShowCreation(axes))
+ self.move_camera(phi=60*DEGREES,theta=45*DEGREES,run_time=3)
+
+ text = TextMobject(r"$\hat{i}$",r"$\hat{j}$",r"$\hat{k}$")
+ text[0].move_to(0.7*DOWN+0.8*LEFT)
+ text[1].move_to(0.75*DOWN+0.7*RIGHT)
+ text[2].move_to(0.75*UP+0.4*RIGHT)
+ self.add_fixed_in_frame_mobjects(text)
+ self.play(Write(text))
+
+ line1 = Line(start = ORIGIN,end = RIGHT)
+ line1.set_color(DARK_BLUE)
+ tip1 = Polygon(-0.95*LEFT,-0.8*LEFT-0.1*DOWN,-0.8*LEFT-0.1*UP)
+ tip1.set_opacity(1)
+ tip1.set_fill(DARK_BLUE)
+ tip1.set_color(DARK_BLUE)
+
+ arrow2 = Line(start = ORIGIN,end = UP)
+ arrow2.set_color(DARK_BLUE)
+ tip2 = Polygon(0.95*UP,0.8*UP-0.1*RIGHT,0.8*UP-0.1*LEFT)
+ 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,1])
+ arrow3.set_color(DARK_BLUE)
+ tip3 = Polygon([0,0,0.95],[0,0,0.8]-0.1*RIGHT,[0,0,0.8]-0.1*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()
diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file2_sum_of_projections_part1.py b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file2_sum_of_projections_part1.py new file mode 100755 index 0000000..141e99b --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file2_sum_of_projections_part1.py @@ -0,0 +1,133 @@ +from manimlib.imports import *
+class LinearTrans(LinearTransformationScene):
+ CONFIG = {
+ "show_basis_vectors": True,
+ "basis_vector_stroke_width": 1,
+ "leave_ghost_vectors": False,
+ "show_coordinates": True,
+ }
+
+ def construct(self):
+
+ self.setup()
+
+ matrix = [[0.6,-0.8],[0.8,0.6]]
+ self.apply_matrix(matrix)
+
+ self.wait(2)
+ orthonormal = TextMobject(r"These are 2 orthonormal vectors($v_1$ and $v_2$)")
+ orthonormal.scale(0.7)
+ orthonormal.move_to(DOWN+LEFT*3.5)
+ orthonormal.add_background_rectangle()
+ v1 = TextMobject(r"$v_1$")
+ v1.scale(0.75)
+ v1.set_color(X_COLOR)
+ v1.move_to(0.75*UP+RIGHT)
+ v1.add_background_rectangle()
+ v2 = TextMobject(r"$v_2$")
+ v2.scale(0.75)
+ v2.set_color(Y_COLOR)
+ v2.move_to(0.75*UP+LEFT*1.25)
+ v2.add_background_rectangle()
+ self.play(Write(orthonormal))
+ self.play(Write(v1),Write(v2))
+ self.wait()
+ self.play(FadeOut(orthonormal), FadeOut(v1), FadeOut(v2))
+
+ arrow = Arrow(start = ORIGIN,end = 3*RIGHT+UP)
+ arrow.scale(1.2)
+ arrow.set_color(BLUE)
+ arrow.apply_matrix(matrix)
+ text3 = TextMobject("v")
+ text3.move_to(3.2*UP+1.2*RIGHT)
+ text3.add_background_rectangle()
+ self.play(ShowCreation(arrow),Write(text3))
+ self.wait()
+ v_cor = TextMobject("(1 , 3)")
+ v_cor.move_to(3.2*UP+1.3*RIGHT)
+ v_cor.set_color(BLUE)
+ v_cor.scale(0.75)
+ v_cor.add_background_rectangle()
+ self.play(Transform(text3,v_cor))
+
+ line1 = DashedLine(start = 1*UP+3*RIGHT, end = 3*RIGHT)
+ line2 = DashedLine(start = 1*UP+3*RIGHT, end = UP)
+ line1.apply_matrix(matrix)
+ line2.apply_matrix(matrix)
+ self.play(ShowCreation(line1),ShowCreation(line2),run_time = 2)
+
+ v1 = Arrow(start = ORIGIN,end = 3*RIGHT+UP)
+ v1.scale(1.2)
+ v1.set_color(BLUE)
+ v1.apply_matrix(matrix)
+ arrow1 = Arrow(start = ORIGIN,end = 3*RIGHT)
+ arrow1.scale(1.2)
+ arrow1.set_color("#6B8E23")
+ arrow1.apply_matrix(matrix)
+ self.play(Transform(v1,arrow1))
+ v1_cor = TextMobject(r"$<v,v_1> v_1$")
+ v1_cor.move_to(2.5*UP+3*RIGHT)
+ v1_cor.scale(0.75)
+ v1_cor.add_background_rectangle()
+ self.play(Write(v1_cor))
+ self.wait(0.5)
+ text1 = TextMobject("(1.8 , 2.4)")
+ text1.move_to(2.1*UP+2.5*RIGHT)
+ text1.scale(0.75)
+ text1.set_color("#6B8E23")
+ text1.add_background_rectangle()
+ self.play(Transform(v1_cor,text1))
+
+ v2 = Arrow(start = ORIGIN,end = 3*RIGHT+UP)
+ v2.scale(1.2)
+ v2.set_color("#8b0000")
+ v2.apply_matrix(matrix)
+ arrow2 = Arrow(start = ORIGIN,end = UP)
+ arrow2.scale(2.1)
+ arrow2.set_color("#8b0000")
+ arrow2.apply_matrix(matrix)
+ self.wait(0.5)
+ self.play(Transform(v2,arrow2))
+ self.wait(0.5)
+ v2_cor = TextMobject(r"$<v,v_2> v_2$")
+ v2_cor.move_to(0.75*UP+2.5*LEFT)
+ v2_cor.scale(0.75)
+ v2_cor.add_background_rectangle()
+ self.play(Write(v2_cor))
+ self.wait(0.5)
+ text2 = TextMobject("(-0.8 , 0.6)")
+ text2.move_to(0.75*UP+1.75*LEFT)
+ text2.scale(0.75)
+ text2.set_color("#8b0000")
+ text2.add_background_rectangle()
+ self.play(Transform(v2_cor,text2))
+
+ self.wait()
+
+ self.play(ApplyMethod(v2.move_to,1.4*RIGHT+2.7*UP),FadeOut(v1_cor),FadeOut(v2_cor),FadeOut(v_cor))
+
+ self.wait()
+
+ ending = TextMobject(r"$v = <v,v_1> v_1 + <v,v_2> v_2$")
+ ending.scale(0.7)
+ ending.move_to(DOWN)
+ ending.add_background_rectangle()
+ self.play(Write(ending))
+ self.wait()
+ self.play(FadeOut(ending))
+
+ ending = TextMobject(r"$\left[ \begin{array} {c} 1\\ 3 \end{array}\right] = \left[ \begin{array} {c}1.8 \\ 2.4 \end{array}\right] + \left[ \begin{array} {c} -0.8\\ 0.6 \end{array}\right]$")
+ ending.scale(0.7)
+ ending.move_to(DOWN)
+ ending.add_background_rectangle()
+ self.play(Write(ending))
+ self.wait()
+ self.play(FadeOut(ending))
+
+ ending = TextMobject(r"$v$ is the sum of projections on the orthonormal vectors")
+ ending.scale(0.7)
+ ending.move_to(DOWN)
+ ending.add_background_rectangle()
+ self.play(Write(ending))
+ self.wait()
+ self.play(FadeOut(ending))
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file3_sum_of_projections_part2.py b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file3_sum_of_projections_part2.py new file mode 100644 index 0000000..2899286 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file3_sum_of_projections_part2.py @@ -0,0 +1,181 @@ +from manimlib.imports import * +class ThreeDExplanation(ThreeDScene): + + def construct(self): + + basis = TextMobject(r"Set of Orthonormal Basis - $\left(\begin{array}{c}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\end{array}\right),\left(\begin{array}{c}\frac{-1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\end{array}\right),\left(\begin{array}{c}0\\0\\1\end{array}\right)$") + basis.scale(0.75) + basis.move_to(UP*1.5) + self.play(Write(basis)) + v = TextMobject(r"$v_1$",r"$v_2$",r"$v_3$") + v[0].move_to(UP*0.5+RIGHT*0.75) + v[1].move_to(UP*0.5+RIGHT*2.5) + v[2].move_to(UP*0.5+RIGHT*4) + eq = TextMobject(r"$v = \left(\begin{array}{c}3\\4\\5\end{array}\right)$") + eq1 = TextMobject(r"$<v,v_1> = \frac{3}{\sqrt{2}} + \frac{4}{\sqrt{2}}Â + 0 = \frac{7}{\sqrt{2}}$") + eq2 = TextMobject(r"$<v,v_2> = \frac{-3}{\sqrt{2}} + \frac{4}{\sqrt{2}}Â + 0 =\frac{1}{\sqrt{2}}$") + eq3 = TextMobject(r"$<v,v_3> =Â 0 + 0Â + 5Â =5$") + eq.move_to(4*LEFT+DOWN) + eq1.move_to(0.5*DOWN+2*RIGHT) + eq2.move_to(1.5*DOWN+2*RIGHT) + eq3.move_to(2.5*DOWN+2*RIGHT) + self.play(Write(v)) + self.play(Write(eq)) + self.play(Write(eq1)) + self.play(Write(eq2)) + self.play(Write(eq3)) + self.wait() + self.play(FadeOut(basis), FadeOut(eq), FadeOut(v), FadeOut(eq1), FadeOut(eq2), FadeOut(eq3)) + self.wait() + + text = TextMobject("These are the 3 mutually orthonormal basis of the set(", r"$v_1$, ", r"$v_2$, ", r"$v_3$",")") + text[1].set_color(DARK_BLUE) + text[2].set_color(RED) + text[3].set_color(YELLOW) + text.scale(0.75) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*DOWN) + self.play(Write(text)) + self.wait() + + axes = ThreeDAxes(x_min = -6,x_max=6,y_min=-6,y_max=6,z_min=-6,z_max=6) + self.play(ShowCreation(axes)) + self.move_camera(distance = 100, phi=45*DEGREES,theta=45*DEGREES,run_time=5) + self.begin_ambient_camera_rotation(rate=0.1) + + xy_plane = Polygon(6*RIGHT+6*UP,-6*RIGHT+6*UP,-6*RIGHT-6*UP,6*RIGHT-6*UP) + xy_plane.set_color("#333333") + xy_plane.set_fill("#333333") + xy_plane.set_opacity(1) + xy_plane.fade(0.7) + self.play(ShowCreation(xy_plane)) + + dashedline1 = DashedLine(start = -6*(UP+RIGHT), end = 6*(UP+RIGHT)) + dashedline2 = DashedLine(start = -6*(UP+LEFT), end = 6*(UP+LEFT)) + dashedline3 = DashedLine(start = 4*UP+3*RIGHT+[0,0,5], end = 3.5*UP+3.5*RIGHT) + dashedline4 = DashedLine(start = 4*UP+3*RIGHT+[0,0,5], end = 0.5*UP+0.5*LEFT) + dashedline5 = DashedLine(start = 4*UP+3*RIGHT+[0,0,5], end = [0,0,5]) + + self.play(ShowCreation(dashedline1), ShowCreation(dashedline2)) + + line1 = Line(start = ORIGIN,end = 0.707*RIGHT + 0.707*UP) + line1.set_color(DARK_BLUE) + tip1 = Polygon(0.707*RIGHT + 0.707*UP, 0.707*RIGHT + 0.607*UP, 0.607*RIGHT + 0.707*UP) + tip1.set_opacity(1) + tip1.set_fill(DARK_BLUE) + tip1.set_color(DARK_BLUE) + self.play(ShowCreation(line1), ShowCreation(tip1)) + + line2 = Line(start = ORIGIN,end = 0.707*LEFT + 0.707*UP) + line2.set_color(RED) + tip2 = Polygon(0.707*LEFT + 0.707*UP, 0.707*LEFT + 0.607*UP, 0.607*LEFT + 0.707*UP) + tip2.set_opacity(1) + tip2.set_fill(RED) + tip2.set_color(RED) + + self.play(ShowCreation(line2), ShowCreation(tip2)) + + line3 = Line(start = ORIGIN,end = [0,0,1]) + line3.set_color(YELLOW) + tip3 = Polygon([0,0,1],[0,0,0.8]-0.2*RIGHT,[0,0,0.8]-0.2*LEFT) + tip3.set_opacity(1) + tip3.set_fill(YELLOW) + tip3.set_color(YELLOW) + self.play(ShowCreation(line3), ShowCreation(tip3)) + self.wait() + + self.play(FadeOut(text)) + + text = TextMobject("Take the projection of ", r"$v$", " on the mutually orthonormal vectors") + text[1].set_color(GOLD_E) + text.scale(0.75) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*DOWN) + self.play(Write(text)) + self.wait(2) + + a_line = Line(start = ORIGIN,end = 4*UP+3*RIGHT+[0,0,5]) + a_line.set_color(GOLD_E) + a_tip = Polygon(3.92*UP+2.94*RIGHT+[0,0,4.9],3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*UP+0.1*LEFT,3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*DOWN+0.1*RIGHT) + a_tip.set_opacity(1) + a_tip.set_fill(GOLD_E) + a_tip.set_color(GOLD_E) + + self.play(ShowCreation(a_line), ShowCreation(a_tip)) + self.stop_ambient_camera_rotation() + self.move_camera(distance = 100, phi=45*DEGREES,theta=135*DEGREES,run_time=5) + + self.play(ShowCreation(dashedline3),ShowCreation(dashedline4),ShowCreation(dashedline5)) + self.wait() + + pv1 = Line(start = ORIGIN,end = 4*UP+3*RIGHT+[0,0,5]) + pv1.set_color(GOLD_E) + pv1tip = Polygon(4*UP+3*RIGHT+[0,0,5],3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*UP+0.1*LEFT,3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*DOWN+0.1*RIGHT) + pv1tip.set_opacity(1) + pv1tip.set_fill(GOLD_E) + pv1tip.set_color(GOLD_E) + + v1_p = Line(start = ORIGIN,end = 3.5*RIGHT + 3.5*UP) + v1_p.set_color(BLUE_E) + v1_p_tip = Polygon(3.5*RIGHT + 3.5*UP, 3.5*RIGHT + 3.4*UP, 3.4*RIGHT + 3.5*UP) + v1_p_tip.set_opacity(1) + v1_p_tip.set_fill(BLUE_E) + v1_p_tip.set_color(BLUE_E) + + pv2 = Line(start = ORIGIN,end = 4*UP+3*RIGHT+[0,0,5]) + pv2.set_color(GOLD_E) + pv2tip = Polygon(4*UP+3*RIGHT+[0,0,5],3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*UP+0.1*LEFT,3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*DOWN+0.1*RIGHT) + pv2tip.set_opacity(1) + pv2tip.set_fill(GOLD_E) + pv2tip.set_color(GOLD_E) + + v2_p = Line(start = ORIGIN,end = 0.5*LEFT + 0.5*UP) + v2_p.set_color(RED_E) + v2_p_tip = Polygon(0.5*LEFT + 0.5*UP, 0.5*LEFT + 0.4*UP, 0.4*LEFT + 0.5*UP) + v2_p_tip.set_opacity(1) + v2_p_tip.set_fill(RED_E) + v2_p_tip.set_color(RED_E) + + pv3 = Line(start = ORIGIN,end = 4*UP+3*RIGHT+[0,0,5]) + pv3.set_color(GOLD_E) + pv3tip = Polygon(4*UP+3*RIGHT+[0,0,5],3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*UP+0.1*LEFT,3.6*UP+2.7*RIGHT+[0,0,4.5]+0.1*DOWN+0.1*RIGHT) + pv3tip.set_opacity(1) + pv3tip.set_fill(GOLD_E) + pv3tip.set_color(GOLD_E) + + v3_p = Line(start = ORIGIN,end = [0,0,5]) + v3_p.set_color(YELLOW_E) + v3_p_tip = Polygon([0,0,5.15],[0,0,4.8]+0.2*RIGHT,[0,0,4.8]+0.2*LEFT) + v3_p_tip.set_opacity(1) + v3_p_tip.set_fill(YELLOW_E) + v3_p_tip.set_color(YELLOW_E) + + #self.stop_ambient_camera_rotation() + self.play(Transform(pv1,v1_p), + Transform(pv1tip,v1_p_tip), + Transform(pv2,v2_p), + Transform(pv2tip,v2_p_tip), + Transform(pv3,v3_p), + Transform(pv3tip,v3_p_tip)) + self.play(FadeOut(dashedline1), + FadeOut(dashedline2), + FadeOut(dashedline3), + FadeOut(dashedline4), + FadeOut(dashedline5), + FadeOut(line1), + FadeOut(tip1), + FadeOut(line2), + FadeOut(tip2), + FadeOut(line3), + FadeOut(tip3), + FadeOut(text)) + + text = TextMobject(r"$v$ is the sum of projections on the orthonormal vectors") + text.set_color(GOLD_E) + text.scale(0.75) + self.add_fixed_in_frame_mobjects(text) + text.move_to(3*DOWN) + self.play(Write(text), ApplyMethod(pv2.move_to,(3.5*RIGHT + 3.5*UP+3*RIGHT+4*UP)/2), ApplyMethod(pv2tip.move_to,(3.1*RIGHT + 3.9*UP))) + self.play(ApplyMethod(pv3.move_to,3*RIGHT + 4*UP + [0,0,2.5]), ApplyMethod(pv3tip.move_to,(3*RIGHT + 4*UP + [0,0,4.8]))) + + self.wait(3)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file4.gif b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file4.gif Binary files differnew file mode 100644 index 0000000..4891350 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file4.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file5.gif b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file5.gif Binary files differnew file mode 100644 index 0000000..d7eb0bc --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file5.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file6.gif b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file6.gif Binary files differnew file mode 100644 index 0000000..1df6413 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Orthonormal-Basis/file6.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/README.md b/FSF-2020/linear-algebra/linear-transformations/README.md index 692201e..067755e 100644 --- a/FSF-2020/linear-algebra/linear-transformations/README.md +++ b/FSF-2020/linear-algebra/linear-transformations/README.md @@ -1,9 +1,10 @@ # Contributer: Archit Sangal
-My Github Account : <a href="https://github.com/architsangal">architsangal</a>
+My Github Account : <a href="https://github.com/architsangal">architsangal</a> (https://github.com/architsangal). These code were written during the course of FOSSEE Summer Fellowship 2020 under the FLOSS: Mathematics using Python.
<br/></br>
+
## Sub-Topics Covered:
-+ Vector Space Homomorphisms (Linear Maps)
++ Linear Transformations (Linear Maps)
+ The Four Fundamental Subspaces
+ Rank-Nullity Theorem
+ Orthonormal basis
-+ Gramm-Schmidt Orthogonalization Process
++ Gramm-Schmidt Orthogonalization Process
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/README.md b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/README.md new file mode 100644 index 0000000..6c90bf4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/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: ++ The Four Fundamental Subspaces + +#### Video 1: Writing System of linear equations in form of Ax=b +![GIF1](file11.gif) + +#### Video 2: Column Space is same as the image of Linear Transformation +![GIF2](file14.gif) + +#### Video 3: Existance of Solution w.r.t. vector b +![GIF3](file17.gif) + +#### Video 4: Null Space (Visually) +![GIF4](file12.gif) + +#### Video 5: Definition 1 is equivalent to Definition 2 +![GIF5](file13.gif) + +#### Video 6: Relation between Row Space and Null Space +![GIF6](file16.gif) + +#### Fig. 1 Naming of the left null space +![GIF7](file10_Left_Null_Space_pSv8iio_d5Sy9qS.gif) + +#### Video 7: Left Null Space(Visually) +![GIF8](file15.gif)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file10_Left_Null_Space_pSv8iio_d5Sy9qS.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file10_Left_Null_Space_pSv8iio_d5Sy9qS.gif Binary files differnew file mode 100644 index 0000000..3f50635 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file10_Left_Null_Space_pSv8iio_d5Sy9qS.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file11.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file11.gif Binary files differnew file mode 100644 index 0000000..8f74202 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file11.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file12.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file12.gif Binary files differnew file mode 100644 index 0000000..aa7403b --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file12.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file13.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file13.gif Binary files differnew file mode 100644 index 0000000..34b54c7 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file13.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file14.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file14.gif Binary files differnew file mode 100644 index 0000000..b77791b --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file14.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file15.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file15.gif Binary files differnew file mode 100644 index 0000000..8bb24bf --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file15.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file16.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file16.gif Binary files differnew file mode 100644 index 0000000..87e0026 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file16.gif diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file17.gif b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file17.gif Binary files differnew file mode 100644 index 0000000..eec819a --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file17.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/file18_NOT_in_lecture_note_Column_Space.py index afe4f9a..afe4f9a 100644 --- 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/file18_NOT_in_lecture_note_Column_Space.py diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Axb.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Axb.py new file mode 100755 index 0000000..95d1021 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Axb.py @@ -0,0 +1,77 @@ +from manimlib.imports import *
+
+class Axb(Scene):
+
+ def construct(self):
+
+ text0 = TextMobject("Linear System Of Equations")
+ text1 = TextMobject(r"$x_{1}+x_{2}+x_{3} =b_{1}$")
+ text2 = TextMobject(r"$x_{1}+2x_{2}+x_{3} =b_{2}$")
+ text3 = TextMobject(r"$x_{1}+x_{2}+3x_{3} =b_{3}$")
+ text0.move_to(UP*2+LEFT*2)
+ text0.set_color(DARK_BLUE)
+ text1.move_to(UP)
+ text2.move_to(ORIGIN)
+ text3.move_to(DOWN)
+
+ text0.scale(0.75)
+ text1.scale(0.75)
+ text2.scale(0.75)
+ text3.scale(0.75)
+ self.play(Write(text0))
+ self.play(Write(text1))
+ self.play(Write(text2))
+ self.play(Write(text3))
+ self.play(ApplyMethod(text0.move_to,3*UP+LEFT*2), ApplyMethod(text1.move_to,2.5*UP), ApplyMethod(text2.move_to,2*UP), ApplyMethod(text3.move_to,1.5*UP))
+
+ A = TextMobject(r"$\left(Â \begin{array}{c c c} 1 & 1Â & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 3 \end{array}\right) \left[ \begin{array} {c} x_{1} \\ x_{2} \\ x_{3} \end{array}\right] =$", r"$\left[ \begin{array}{c} x_{1}+x_{2}+x_{3} \\ x_{1}+2x_{2}+x_{3} \\ x_{1}+x_{2}+3x_{3} \end{array}\right]$")
+ A.scale(0.75)
+ self.play(FadeIn(A))
+
+ textA = TextMobject("A")
+ textx = TextMobject("x")
+ textb = TextMobject("Ax")
+
+ textA.move_to(DOWN+3*LEFT)
+ textx.move_to(1.1*DOWN+0.5*LEFT)
+ textb.move_to(DOWN-2*LEFT)
+
+ self.play(Write(textA), Write(textx), Write(textb))
+
+ circle1 = Circle(radius = 0.24)
+ circle2 = Circle(radius = 0.24)
+ square = Square(side_length = 0.6)
+
+ circle1.move_to(UP*0.5+LEFT*3.05)
+ circle2.move_to(UP*0.4+LEFT*0.5)
+ square.move_to(UP*0.4+RIGHT*1.3)
+
+ self.play(FadeIn(circle1), FadeIn(circle2),FadeIn(square))
+
+ self.play(ApplyMethod(circle1.move_to,UP*0.5+LEFT*2.45), ApplyMethod(circle2.move_to,LEFT*0.5), ApplyMethod(square.move_to,UP*0.4+RIGHT*2.2))
+ self.play(ApplyMethod(circle1.move_to,UP*0.5+LEFT*1.85), ApplyMethod(circle2.move_to,DOWN*0.5+LEFT*0.5), ApplyMethod(square.move_to,UP*0.4+RIGHT*3.1))
+
+ self.play(ApplyMethod(circle1.move_to,LEFT*3.05), ApplyMethod(circle2.move_to,UP*0.4+LEFT*0.5), ApplyMethod(square.move_to,RIGHT*1.3))
+ self.play(ApplyMethod(circle1.move_to,LEFT*2.45), ApplyMethod(circle2.move_to,LEFT*0.5), ApplyMethod(square.move_to,RIGHT*2.2))
+ self.play(ApplyMethod(circle1.move_to,LEFT*1.85), ApplyMethod(circle2.move_to,DOWN*0.5+LEFT*0.5), ApplyMethod(square.move_to,RIGHT*3.1))
+
+ self.play(ApplyMethod(circle1.move_to,0.4*DOWN+LEFT*3.05), ApplyMethod(circle2.move_to,UP*0.4+LEFT*0.5), ApplyMethod(square.move_to,0.4*DOWN+RIGHT*1.3))
+ self.play(ApplyMethod(circle1.move_to,0.4*DOWN+LEFT*2.45), ApplyMethod(circle2.move_to,LEFT*0.5), ApplyMethod(square.move_to,0.4*DOWN+RIGHT*2.2))
+ self.play(ApplyMethod(circle1.move_to,0.4*DOWN+LEFT*1.85), ApplyMethod(circle2.move_to,DOWN*0.5+LEFT*0.5), ApplyMethod(square.move_to,0.4*DOWN+RIGHT*3.1))
+
+ self.play(FadeOut(circle1), FadeOut(circle2), FadeOut(square))
+ self.play(FadeOut(A[0]), ApplyMethod(A[1].move_to,2*LEFT),ApplyMethod(textb.move_to,DOWN+1.7*LEFT), FadeOut(textx), FadeOut(textA))
+ b = TextMobject(r"$=\left[ \begin{array}{c} b_{1} \\ b_{2} \\ b_{3} \end{array}\right]$")
+ b.move_to(RIGHT)
+ textB = TextMobject("b")
+ textB.move_to(1.2*DOWN+1.1*RIGHT)
+ self.play(FadeIn(b),FadeIn(textB))
+
+ self.wait()
+
+ self.play(FadeOut(text0), FadeOut(text1), FadeOut(text2), FadeOut(text3))
+
+ axb = TextMobject("Ax = b")
+ self.play(FadeIn(axb), FadeOut(textb), FadeOut(textB), FadeOut(b), FadeOut(A[1]))
+
+ self.wait()
\ No newline at end of file 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 differdeleted file mode 100644 index 7d8d2e1..0000000 --- a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file1_Column_Space.gif +++ /dev/null diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_CSasImage.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_CSasImage.py new file mode 100644 index 0000000..70547cb --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file2_CSasImage.py @@ -0,0 +1,169 @@ +from manimlib.imports import * + +class Column_Space(Scene): + def construct(self): + + A = TextMobject(r"$A = $",r"$\left( \begin{array}{c c} 1 & 2 \\ 3 & 4 \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 \\ 3 \end{array} \right)$",r"$+x_{2}$",r"$ \left( \begin{array}{c} 2 \\ 4\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.scale(0.75) + + self.play(Write(CS_A),run_time = 2) + + arrow1 = Arrow(start = 1.25*UP,end = (0.25*DOWN+1.75*LEFT+0.25*DOWN+1.2*RIGHT)/2) + arrow3 = Arrow(start = 1.25*UP+0.75*RIGHT,end = (0.25*DOWN+2.9*RIGHT+0.25*DOWN)/2) + + arrow1.scale(1.5) + arrow3.scale(1.5) + + Defn = TextMobject("Linear Combination of Columns of Matrix") + Defn.move_to(3*DOWN) + + self.play(Write(Defn), ShowCreation(arrow1), 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$ be ",r"$\left[\begin{array}{c c} 1 & -1 \\ 1 & -1 \end{array}\right]$",r". $A$ denotes 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(ORANGE) + arrow3.set_color(PURPLE) + 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"Let the matrix the of this linear transformation be $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/file3_solution.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file3_solution.py new file mode 100644 index 0000000..eb310f3 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file3_solution.py @@ -0,0 +1,77 @@ +from manimlib.imports import * +class solution(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + o = TextMobject(r"This is the original vector space $R^2$ (before Linear Transformation)") + o.move_to(3*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + A = TextMobject(r"Consider the matrix the of this linear transformation $A$ = $\left[\begin{array}{c c} 1 & -1 \\ 1 & -1 \end{array}\right]$") + A.move_to(3*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(3*DOWN) + o.scale(0.75) + o.add_background_rectangle() + self.play(Write(o)) + self.wait() + self.play(FadeOut(o)) + + arrow2 = Arrow(start = ORIGIN, end = 2*DOWN+2*LEFT) + arrow2.set_color(PURPLE) + arrow2.scale(1.2) + self.play(ShowCreation(arrow2)) + self.wait() + + o1 = TextMobject("If the ","vector b"," lies in the transformed vector space") + o2 = TextMobject("(the line) then the solution exist") + o1.move_to(2.5*DOWN+2*RIGHT) + o1[1].set_color(PURPLE) + o2.move_to(3*DOWN+2.5*RIGHT) + o1.scale(0.75) + o2.scale(0.75) + o1.add_background_rectangle() + o2.add_background_rectangle() + self.play(Write(o1)) + self.play(Write(o2)) + self.wait() + self.play(FadeOut(o1), FadeOut(o2)) + + self.play(FadeOut(arrow2)) + + arrow1 = Arrow(start = ORIGIN, end = 2*UP+RIGHT) + arrow1.set_color(ORANGE) + arrow1.scale(1.3) + self.play(ShowCreation(arrow1)) + self.wait() + + o1 = TextMobject("If the ","vector b"," does lies in the transformed") + o2 = TextMobject("vector space then the does not solution exist") + o1.move_to(2.5*DOWN+2*RIGHT) + o1[1].set_color(ORANGE) + o2.move_to(3*DOWN+2.5*RIGHT) + o1.scale(0.75) + o2.scale(0.75) + o1.add_background_rectangle() + o2.add_background_rectangle() + self.play(Write(o1)) + self.play(Write(o2)) + self.wait() + self.play(FadeOut(o1), FadeOut(o2)) + + self.play(FadeOut(arrow1)) +
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file4_null_space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file4_null_space.py new file mode 100644 index 0000000..3c52677 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file4_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 vector space $R^2$(before Linear Transformation)") + o.move_to(3*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 belongs 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(3*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)) diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file5_Row_Space_part_1.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file5_Row_Space_part_1.py new file mode 100644 index 0000000..5259eb4 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file5_Row_Space_part_1.py @@ -0,0 +1,68 @@ +from manimlib.imports import * +class LS(Scene): + def construct(self): + text1 = TextMobject(r"Consider a matrix $A =$") + text2 = TextMobject(r"[") + text3 = TextMobject(r"$\begin{array}{c c} 1 & -2\end{array}$") + text4 = TextMobject(r"$\begin{array}{c c} 1 & -1\end{array}$") + text5 = TextMobject(r"]") + + text2.scale(2) + text5.scale(2) + + text1.set_color(DARK_BLUE) + text2.set_color(DARK_BLUE) + text3.set_color(PURPLE) + text4.set_color(YELLOW) + text5.set_color(DARK_BLUE) + + text1.move_to(3.5*LEFT+3*UP+2*RIGHT) + text2.move_to(0.75*LEFT+3*UP+2*RIGHT) + text3.move_to(3.25*UP+2*RIGHT) + text4.move_to(2.75*UP+2*RIGHT) + text5.move_to(0.75*RIGHT+3*UP+2*RIGHT) + + self.play(FadeIn(text1), FadeIn(text2), FadeIn(text3), FadeIn(text4), FadeIn(text5)) + self.wait() + + ttext1 = TextMobject(r"$A^T =$") + ttext2 = TextMobject(r"[") + ttext3 = TextMobject(r"$\begin{array}{c} 1 \\ -2\end{array}$") + ttext4 = TextMobject(r"$\begin{array}{c} 1 \\ -1\end{array}$") + ttext5 = TextMobject(r"]") + + ttext2.scale(2) + ttext5.scale(2) + + ttext1.set_color(DARK_BLUE) + ttext2.set_color(DARK_BLUE) + ttext3.set_color(PURPLE) + ttext4.set_color(YELLOW) + ttext5.set_color(DARK_BLUE) + + ttext1.move_to(2*LEFT+1.5*UP+2*RIGHT) + ttext2.move_to(1*LEFT+1.5*UP+2*RIGHT) + ttext3.move_to(0.5*LEFT+1.5*UP+2*RIGHT) + ttext4.move_to(0.5*RIGHT+1.5*UP+2*RIGHT) + ttext5.move_to(1*RIGHT+1.5*UP+2*RIGHT) + + self.play(FadeIn(ttext1), FadeIn(ttext2), FadeIn(ttext3), FadeIn(ttext4), FadeIn(ttext5)) + + rtext = TextMobject(r"Row Space of $A$ = Column Space of $A^T = a_1$",r"$\left[\begin{array}{c} 1 \\ -2\end{array}\right]$",r"$+a_2$",r"$\left[\begin{array}{c} 1 \\ -1\end{array}\right]$") + rtext[1].set_color(PURPLE) + rtext[3].set_color(YELLOW) + rtext.move_to(2*DOWN+1.5*LEFT) + rtext.scale(0.75) + + self.play(Write(rtext)) + self.wait() + + arrow1 = Arrow(start = 1.5*RIGHT+UP, end = 1.25*(DOWN+RIGHT)) + arrow2 = Arrow(start = 2.5*RIGHT+UP, end = 1.25*DOWN+3.25*RIGHT) + arrow1.scale(1.25) + arrow2.scale(1.25) + arrow1.set_color(PURPLE) + arrow2.set_color(YELLOW) + + self.play(ShowCreation(arrow1), ShowCreation(arrow2)) + self.wait(2) 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/file6_Row_Space_part_2.py index b16a32a..b16a32a 100644 --- 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/file6_Row_Space_part_2.py diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file7_Row_space_Orthogonal_Complements.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file7_Row_space_Orthogonal_Complements.py new file mode 100644 index 0000000..c81d370 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file7_Row_space_Orthogonal_Complements.py @@ -0,0 +1,150 @@ +from manimlib.imports import * +class row_space(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + o = TextMobject(r"This is the original vector space $R^2$(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 $\left(\begin{array}{c} 1 \\ 1 \end{array}\right)$i.e. the null space.") + 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) + arrow.set_color(YELLOW) + arrow1 = Arrow(start = ORIGIN, end = 2*(UP+RIGHT)) + arrow1.set_color(YELLOW) + arrow2 = Arrow(start = ORIGIN, end = 3*(UP+RIGHT)) + arrow2.set_color(YELLOW) + arrow3 = Arrow(start = ORIGIN, end = 4*(UP+RIGHT)) + arrow3.set_color(YELLOW) + arrow4 = Arrow(start = ORIGIN, end = DOWN+LEFT) + arrow4.set_color(YELLOW) + arrow5 = Arrow(start = ORIGIN, end = 2*(DOWN+LEFT)) + arrow5.set_color(YELLOW) + arrow6 = Arrow(start = ORIGIN, end = 3*(DOWN+LEFT)) + arrow6.set_color(YELLOW) + arrow7 = Arrow(start = ORIGIN, end = 4*(DOWN+LEFT)) + arrow7.set_color(YELLOW) + + 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)) + + o1 = TextMobject("Consider a set of vectors which are linear") + o2 = TextMobject(r"span of a $\left(\begin{array}{c} 1 \\ -1 \end{array}\right)$i.e. the row space.") + 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)) + + rarrow = Arrow(start = ORIGIN, end = -UP+RIGHT) + rarrow.set_color(PURPLE) + rarrow1 = Arrow(start = ORIGIN, end = 2*(-UP+RIGHT)) + rarrow1.set_color(PURPLE) + rarrow2 = Arrow(start = ORIGIN, end = 3*(-UP+RIGHT)) + rarrow2.set_color(PURPLE) + rarrow3 = Arrow(start = ORIGIN, end = 4*(-UP+RIGHT)) + rarrow3.set_color(PURPLE) + rarrow4 = Arrow(start = ORIGIN, end = -DOWN+LEFT) + rarrow4.set_color(PURPLE) + rarrow5 = Arrow(start = ORIGIN, end = 2*(-DOWN+LEFT)) + rarrow5.set_color(PURPLE) + rarrow6 = Arrow(start = ORIGIN, end = 3*(-DOWN+LEFT)) + rarrow6.set_color(PURPLE) + rarrow7 = Arrow(start = ORIGIN, end = 4*(-DOWN+LEFT)) + rarrow7.set_color(PURPLE) + + rarrow.scale(1.5) + rarrow1.scale(1.2) + rarrow2.scale(1.15) + rarrow3.scale(1.1) + rarrow4.scale(1.5) + rarrow5.scale(1.2) + rarrow6.scale(1.15) + rarrow7.scale(1.1) + + self.play(ShowCreation(rarrow), + ShowCreation(rarrow1), + ShowCreation(rarrow2), + ShowCreation(rarrow3), + ShowCreation(rarrow4), + ShowCreation(rarrow5), + ShowCreation(rarrow6), + ShowCreation(rarrow7), + ) + + 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) + + self.add_transformable_mobject(rarrow) + self.add_transformable_mobject(rarrow1) + self.add_transformable_mobject(rarrow2) + self.add_transformable_mobject(rarrow3) + self.add_transformable_mobject(rarrow4) + self.add_transformable_mobject(rarrow5) + self.add_transformable_mobject(rarrow6) + self.add_transformable_mobject(rarrow7) + + o1 = TextMobject("Notice, entire set of vectors which belong to the null space of $A$ transforms to zero") + o2 = TextMobject(r"and entire set of vectors which belong to the row space of $A$ transforms to column space of $A$.") + o1.move_to(2.5*DOWN) + o2.move_to(3.5*DOWN) + 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(3) + + self.play(FadeOut(o1), FadeOut(o2))
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file8_Left_Null_Space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file8_Left_Null_Space.py new file mode 100755 index 0000000..fd05e75 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file8_Left_Null_Space.py @@ -0,0 +1,26 @@ +from manimlib.imports import * + +class Left_Null_Space(Scene): + def construct(self): + + A = TextMobject(r"Left Null Space of A") + A.move_to(3*UP) + defn = TextMobject(r"It is a vector space that consists of all the solution $x$ to the equation $A^{T}x=0$") + defn.move_to(2*UP) + defn.scale(0.75) + eqn1 = TextMobject(r"$A^{T}x=0 \cdots (i)$") + eqn1.move_to(UP) + self.play(Write(A), Write(defn), Write(eqn1),run_time=1) + statement = TextMobject(r"Taking transpose of eqn $(i)$") + eqn = TextMobject(r"$(A^{T}x)^{T}=0$") + eqn.move_to(DOWN) + eqn2 = TextMobject(r"$x^{T}(A^{T})^{T}=0$") + eqn2.move_to(DOWN) + eqn3 = TextMobject(r"$x^{T}A=0$") + eqn3.move_to(DOWN) + self.play(Write(statement),Write(eqn),run_time=1) + self.wait(0.5) + self.play(Transform(eqn,eqn2),run_time=1) + self.wait(0.5) + self.play(Transform(eqn,eqn3),run_time=1) + self.wait(0.5)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file9_left_null_space.py b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file9_left_null_space.py new file mode 100644 index 0000000..61285be --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Four-Fundamental-Subspaces/file9_left_null_space.py @@ -0,0 +1,186 @@ +from manimlib.imports import * +class row_space(LinearTransformationScene): + def construct(self): + + self.setup() + self.wait() + + o = TextMobject(r"This is the original vector space $R^2$(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 $\left(\begin{array}{c} 1 \\ 1 \end{array}\right)$i.e. the null space.") + 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) + arrow.set_color(YELLOW) + arrow1 = Arrow(start = ORIGIN, end = 2*(UP+RIGHT)) + arrow1.set_color(YELLOW) + arrow2 = Arrow(start = ORIGIN, end = 3*(UP+RIGHT)) + arrow2.set_color(YELLOW) + arrow3 = Arrow(start = ORIGIN, end = 4*(UP+RIGHT)) + arrow3.set_color(YELLOW) + arrow4 = Arrow(start = ORIGIN, end = DOWN+LEFT) + arrow4.set_color(YELLOW) + arrow5 = Arrow(start = ORIGIN, end = 2*(DOWN+LEFT)) + arrow5.set_color(YELLOW) + arrow6 = Arrow(start = ORIGIN, end = 3*(DOWN+LEFT)) + arrow6.set_color(YELLOW) + arrow7 = Arrow(start = ORIGIN, end = 4*(DOWN+LEFT)) + arrow7.set_color(YELLOW) + + 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)) + + o1 = TextMobject("Consider a set of vectors which are linear") + o2 = TextMobject(r"span of a vector $\left(\begin{array}{c} 1 \\ -1 \end{array}\right)$i.e. the row space.") + 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)) + + rarrow = Arrow(start = ORIGIN, end = -UP+RIGHT) + rarrow.set_color(PURPLE) + rarrow1 = Arrow(start = ORIGIN, end = 2*(-UP+RIGHT)) + rarrow1.set_color(PURPLE) + rarrow2 = Arrow(start = ORIGIN, end = 3*(-UP+RIGHT)) + rarrow2.set_color(PURPLE) + rarrow3 = Arrow(start = ORIGIN, end = 4*(-UP+RIGHT)) + rarrow3.set_color(PURPLE) + rarrow4 = Arrow(start = ORIGIN, end = -DOWN+LEFT) + rarrow4.set_color(PURPLE) + rarrow5 = Arrow(start = ORIGIN, end = 2*(-DOWN+LEFT)) + rarrow5.set_color(PURPLE) + rarrow6 = Arrow(start = ORIGIN, end = 3*(-DOWN+LEFT)) + rarrow6.set_color(PURPLE) + rarrow7 = Arrow(start = ORIGIN, end = 4*(-DOWN+LEFT)) + rarrow7.set_color(PURPLE) + + rarrow.scale(1.5) + rarrow1.scale(1.2) + rarrow2.scale(1.15) + rarrow3.scale(1.1) + rarrow4.scale(1.5) + rarrow5.scale(1.2) + rarrow6.scale(1.15) + rarrow7.scale(1.1) + + self.play(ShowCreation(rarrow), + ShowCreation(rarrow1), + ShowCreation(rarrow2), + ShowCreation(rarrow3), + ShowCreation(rarrow4), + ShowCreation(rarrow5), + ShowCreation(rarrow6), + ShowCreation(rarrow7), + ) + + 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) + + self.add_transformable_mobject(rarrow) + self.add_transformable_mobject(rarrow1) + self.add_transformable_mobject(rarrow2) + self.add_transformable_mobject(rarrow3) + self.add_transformable_mobject(rarrow4) + self.add_transformable_mobject(rarrow5) + self.add_transformable_mobject(rarrow6) + self.add_transformable_mobject(rarrow7) + + matrix = [[1,-1],[1,-1]] + self.apply_matrix(matrix) + self.wait(3) + + o1 = TextMobject("Consider a set of vectors which are linear span of a vector") + o2 = TextMobject(r"$\left(\begin{array}{c} 1 \\ -1 \end{array}\right)$ which is orthogonal to column space i.e. Left Null Space") + o1.move_to(2*DOWN) + o2.move_to(2.75*DOWN) + o1.scale(0.7) + o2.scale(0.7) + o1.add_background_rectangle() + o2.add_background_rectangle() + self.play(Write(o1)) + self.play(Write(o2)) + + rarrow = Arrow(start = ORIGIN, end = -UP+RIGHT) + rarrow.set_color(YELLOW) + rarrow1 = Arrow(start = ORIGIN, end = 2*(-UP+RIGHT)) + rarrow1.set_color(YELLOW) + rarrow2 = Arrow(start = ORIGIN, end = 3*(-UP+RIGHT)) + rarrow2.set_color(YELLOW) + rarrow3 = Arrow(start = ORIGIN, end = 4*(-UP+RIGHT)) + rarrow3.set_color(YELLOW) + rarrow4 = Arrow(start = ORIGIN, end = -DOWN+LEFT) + rarrow4.set_color(YELLOW) + rarrow5 = Arrow(start = ORIGIN, end = 2*(-DOWN+LEFT)) + rarrow5.set_color(YELLOW) + rarrow6 = Arrow(start = ORIGIN, end = 3*(-DOWN+LEFT)) + rarrow6.set_color(YELLOW) + rarrow7 = Arrow(start = ORIGIN, end = 4*(-DOWN+LEFT)) + rarrow7.set_color(YELLOW) + + rarrow.scale(1.5) + rarrow1.scale(1.2) + rarrow2.scale(1.15) + rarrow3.scale(1.1) + rarrow4.scale(1.5) + rarrow5.scale(1.2) + rarrow6.scale(1.15) + rarrow7.scale(1.1) + + self.play(ShowCreation(rarrow), + ShowCreation(rarrow1), + ShowCreation(rarrow2), + ShowCreation(rarrow3), + ShowCreation(rarrow4), + ShowCreation(rarrow5), + ShowCreation(rarrow6), + ShowCreation(rarrow7), + ) + + self.wait(2) + self.play(FadeOut(o1), FadeOut(o2)) diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/README.md b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/README.md new file mode 100644 index 0000000..9d49b4f --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/README.md @@ -0,0 +1,9 @@ +# Contributer: Archit Sangal +My Github Account : <a href="https://github.com/architsangal">architsangal</a> (https://github.com/architsangal) +<br/></br> + +## Sub-Topics Covered: ++ The Rank-Nullity Theorem + +#### Video 1: Visually understanding linear transformation(using grid) +![GIF1](file2.gif)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file2.gif b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file2.gif Binary files differnew file mode 100644 index 0000000..46efc66 --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/The-Rank-Nullity-Theorem/file2.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Basis_of_a_dual_vector_space.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Basis_of_a_dual_vector_space.py new file mode 100644 index 0000000..630670e --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Basis_of_a_dual_vector_space.py @@ -0,0 +1,126 @@ +from manimlib.imports import *
+class DualVectorSpace(ZoomedScene):
+
+ def construct(self):
+ c1 = Ellipse(radius = 2,color=BLUE)
+ c2 = Ellipse(radius = 2,color=YELLOW)
+ c1.rotate(np.pi/2)
+ c2.rotate(np.pi/2)
+ c1.shift(2*LEFT+0.6*UP)
+ c2.shift(2*RIGHT+0.6*UP)
+ c1.scale(2)
+ c2.scale(2)
+ self.play(ShowCreation(c1))
+ self.play(ShowCreation(c2))
+ dot1 = SmallDot(color=BLUE).shift(2*LEFT+2*UP)
+ dot2 = SmallDot(color=BLUE).shift(2*LEFT+1.5*UP)
+ dot3 = SmallDot(color=BLUE).shift(2*LEFT+1*UP)
+ dot4 = SmallDot(color=BLUE).shift(2*LEFT+0.5*UP)
+ dot5 = SmallDot(color=BLUE).shift(2*LEFT)
+ dot6 = SmallDot(color=BLUE).shift(2*LEFT+0.5*DOWN)
+ dot7 = SmallDot(color=BLUE).shift(2*LEFT+1*DOWN)
+ text1 = TextMobject(r"$V$").scale(0.6).shift(3*UP+2*LEFT)
+ text2 = TextMobject(r"$V^* = \{T:V\rightarrow F\}$").scale(0.6).shift(3*UP+2.5*RIGHT)
+ self.play(ShowCreation(dot1),ShowCreation(dot2),ShowCreation(dot3),ShowCreation(dot4),ShowCreation(dot5),ShowCreation(dot6),ShowCreation(dot7))
+ v1 = TextMobject(r"$v_1$").scale(0.5).shift(2.2*LEFT+2*UP)
+ v2 = TextMobject(r"$v_2$").scale(0.5).shift(2.2*LEFT+1.5*UP)
+ v3 = TextMobject(r"$v_3$").scale(0.5).shift(2.2*LEFT+1*UP)
+ v4 = TextMobject(r"$v_4$").scale(0.5).shift(2.2*LEFT+0.5*UP)
+ v5 = TextMobject(r"$v_5$").scale(0.5).shift(2.2*LEFT)
+ v6 = TextMobject(r"$v_6$").scale(0.5).shift(2.2*LEFT+0.5*DOWN)
+ v7 = TextMobject(r"$v_7$").scale(0.5).shift(2.2*LEFT+1*DOWN)
+ self.play(ShowCreation(v1),ShowCreation(v2),ShowCreation(v3),ShowCreation(v4),ShowCreation(v5),ShowCreation(v6),ShowCreation(v7))
+ self.play(ShowCreation(text1))
+ dot9 = SmallDot(color=YELLOW).shift(2*RIGHT+2*UP)
+ dot10 = SmallDot(color=YELLOW).shift(2*RIGHT+1.5*UP)
+ dot11 = SmallDot(color=YELLOW).shift(2*RIGHT+1*UP)
+ dot12 = SmallDot(color=YELLOW).shift(2*RIGHT+0.5*UP)
+ dot13 = SmallDot(color=YELLOW).shift(2*RIGHT)
+ dot14 = SmallDot(color=YELLOW).shift(2*RIGHT+0.5*DOWN)
+ dot15 = SmallDot(color=YELLOW).shift(2*RIGHT+1*DOWN)
+ self.play(ShowCreation(dot9),ShowCreation(dot10),ShowCreation(dot11),ShowCreation(dot12),ShowCreation(dot13),ShowCreation(dot14),ShowCreation(dot15))
+ v9 = TextMobject(r"${T_1}$").scale(0.5).shift(2.2*RIGHT+2*UP)
+ v10 = TextMobject(r"${T_2}$").scale(0.5).shift(2.2*RIGHT+1.5*UP)
+ v11 = TextMobject(r"${T_3}$").scale(0.5).shift(2.2*RIGHT+1*UP)
+ v12 = TextMobject(r"${T_4}$").scale(0.5).shift(2.2*RIGHT+0.5*UP)
+ v13 = TextMobject(r"${T_5}$").scale(0.5).shift(2.2*RIGHT)
+ v14 = TextMobject(r"${T_6}$").scale(0.5).shift(2.2*RIGHT+0.5*DOWN)
+ v15 = TextMobject(r"${T_7}$").scale(0.5).shift(2.2*RIGHT+1*DOWN)
+ self.play(ShowCreation(v9),ShowCreation(v10),ShowCreation(v11),ShowCreation(v12),ShowCreation(v13),ShowCreation(v14),ShowCreation(v15))
+ self.play(ShowCreation(text2))
+ line1 = Line(start=dot1,end=dot9,stroke_width=0.95)
+ line2 = Line(start=dot2,end=dot10,stroke_width=0.95)
+ line3 = Line(start=dot3,end=dot11,stroke_width=0.95)
+ line4 = Line(start=dot4,end=dot12,stroke_width=0.95)
+ line5 = Line(start=dot5,end=dot13,stroke_width=0.95)
+ line6 = Line(start=dot6,end=dot14,stroke_width=0.95)
+ line7 = Line(start=dot7,end=dot15,stroke_width=0.95)
+ self.play(ShowCreation(line1),ShowCreation(line2),ShowCreation(line3),ShowCreation(line4),ShowCreation(line5),ShowCreation(line6),ShowCreation(line7))
+ self.wait(1.5)
+ rect1 = Rectangle(stroke_width=0.5,width=1,height=1.9).set_fill(color=BLUE,opacity=0.3)
+ vgroup1 = VGroup(dot3,dot4,v3,v4)
+ rect1.surround(vgroup1)
+ self.play(ShowCreation(rect1))
+ text3 = TextMobject(r"Basis of $V$ = $\{v_3, v_4\}$").shift(4.6*LEFT+1*UP).scale(0.5)
+ self.play(ShowCreation(text3))
+ self.wait(1.5)
+ rect2 = Rectangle(stroke_width=0.5,width=1,height=1.7).set_fill(color=YELLOW,opacity=0.3)
+ vgroup2 = VGroup(dot11,dot12,v11,v12)
+ rect2.surround(vgroup2)
+ self.play(ShowCreation(rect2))
+ text4 = TextMobject(r"Basis of $V^*$ = $\{{T_3},{T_4} \}$").shift(4.6*RIGHT+1*UP).scale(0.5)
+ self.play(ShowCreation(text4))
+ self.wait(2.5)
+ v9.move_to(3*LEFT+3*UP).scale(1.2).set_color(YELLOW)
+ colon = TextMobject(":").shift(3*UP+2.6*LEFT)
+ vgroup3 = VGroup(line1,line2,line3,line4,line5,line6,line7)
+ vgroup4 = VGroup(v10,v11,v12,v13,v14,v15,rect1,rect2,text3,text4,c2)
+ vgroup5 = VGroup(dot9,dot10,dot11,dot12,dot13,dot14,dot15)
+ text5 = TextMobject(r"$F$").scale(0.6).shift(3*UP+2*RIGHT)
+ dot9 = SmallDot(color=GREEN).shift(2*RIGHT+2*UP)
+ dot10 = SmallDot(color=GREEN).shift(2*RIGHT+1.5*UP)
+ dot11 = SmallDot(color=GREEN).shift(2*RIGHT+1*UP)
+ dot12 = SmallDot(color=GREEN).shift(2*RIGHT+0.5*UP)
+ dot13 = SmallDot(color=GREEN).shift(2*RIGHT)
+ dot14 = SmallDot(color=GREEN).shift(2*RIGHT+0.5*DOWN)
+ dot15 = SmallDot(color=GREEN).shift(2*RIGHT+1*DOWN)
+ f1 = TextMobject(r"${f_1}$").scale(0.5).shift(2.2*RIGHT+2*UP)
+ f2 = TextMobject(r"${f_2}$").scale(0.5).shift(2.2*RIGHT+1.5*UP)
+ f3 = TextMobject(r"${f_3}$").scale(0.5).shift(2.2*RIGHT+1*UP)
+ f4 = TextMobject(r"${f_4}$").scale(0.5).shift(2.2*RIGHT+0.5*UP)
+ f5 = TextMobject(r"${f_5}$").scale(0.5).shift(2.2*RIGHT)
+ f6 = TextMobject(r"${f_6}$").scale(0.5).shift(2.2*RIGHT+0.5*DOWN)
+ f7 = TextMobject(r"${f_7}$").scale(0.5).shift(2.2*RIGHT+1*DOWN)
+ vgroup6 = VGroup(f1,f2,f3,f4,f5,f6,f7)
+ arrow = Arrow(stroke_width=1.6).scale(1.5).shift(3*UP)
+ c3 = Ellipse(radius = 2,color=GREEN)
+ c3.rotate(np.pi/2)
+ c3.shift(2*RIGHT+0.6*UP)
+ c3.scale(2)
+ self.play(ShowCreation(v9))
+ self.wait(1.5)
+ self.play(ShowCreation(arrow),ShowCreation(colon),Transform(text2,text5),FadeOut(vgroup3),FadeOut(vgroup4),FadeOut(vgroup5))
+ self.play(ShowCreation(vgroup5),ShowCreation(vgroup6),ShowCreation(c3))
+ self.wait(0.7)
+ self.play(ShowCreation(vgroup3))
+ self.wait(3)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_Basis_Example.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_Basis_Example.py new file mode 100644 index 0000000..d79ec3e --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_Basis_Example.py @@ -0,0 +1,97 @@ +from manimlib.imports import *
+import numpy as np
+
+class Dual_Basis(GraphScene):
+ CONFIG={
+ "x_min": -7,
+ "x_max": 7,
+ "y_min": -7,
+ "y_max": 7,
+ "graph_origin": ORIGIN,
+ "x_axis_label":"$X$",
+ "y_axis_label":"$Y$",
+ "x_labeled_nums": list(np.arange(-7, 8,1)),
+ "y_labeled_nums": list(np.arange(-7, 8,1)),
+ "x_axis_width": 10,
+ "y_axis_height": 10,
+ "x_tick_frequency":1,
+ "axes_color": GREY,
+ "area_opacity": 3,
+ "num_rects": 10,
+ }
+ def construct(self):
+ self.setup_axes(animate = True)
+ XD = self.x_axis_width/(self.x_max- self.x_min)
+ YD = self.y_axis_height/(self.y_max- self.y_min)
+ a1=2*XD*RIGHT+1*YD*UP
+ a2=3*XD*RIGHT+1*YD*UP
+ vec1=Vector(direction=a1,stroke_width=2).set_color(RED_E)
+ vec1.shift(self.graph_origin)
+ v1_label=TextMobject(r"$v_1$")
+ v1_label=(v1_label.shift(self.graph_origin+a1+0.1)).scale(.6)
+ self.play(ShowCreation(vec1),ShowCreation(v1_label))
+ text1=TextMobject(r"\text{$v_1$}",r"\text{$= (2,1)$}").scale(.6)
+ text1[0].set_color(RED_E)
+ text1.shift(5*LEFT+3.5*UP)
+ self.play(ShowCreation(text1))
+ self.wait(1.5)
+ vec2=Vector(direction=a2,stroke_width=2).set_color(YELLOW_E)
+ vec2.shift(self.graph_origin)
+ v2_label=TextMobject(r"$v_2$")
+ v2_label=(v2_label.shift(self.graph_origin+a2+0.1)).scale(.6)
+ self.play(ShowCreation(vec2),ShowCreation(v2_label))
+ text2=TextMobject(r"\text{$v_2$}",r"\text{$= (3,1)$}").scale(.6)
+ text2[0].set_color(YELLOW_E)
+ text2.shift(5*LEFT+3*UP)
+ self.play(ShowCreation(text2))
+ self.wait(1.5)
+ text3=TextMobject(r"\text{${T_2}$}",r"\text{$(v_1)$}",r"\text{$= 0$}").scale(.6)
+ text3[0].set_color(BLUE)
+ text3[1].set_color(RED_E)
+ text3.shift(4.94*LEFT+2.5*UP)
+ self.play(ShowCreation(text3))
+ self.wait(1.5)
+ text4=TextMobject(r"\text{${T_2}$}",r"\text{$= x - 2y$}").scale(.6)
+ text4[0].set_color(BLUE)
+ text4.shift(4.9*LEFT+2*UP)
+ self.play(ShowCreation(text4))
+ self.wait(1.5)
+ line1 = self.get_graph(lambda x : x/2, x_min = -5,x_max=5,color=BLUE)
+ v1_dual_label = TextMobject(r"${T_2}$").scale(.6).shift(3.9*RIGHT+1.85*UP)
+ self.play(ShowCreation(line1),ShowCreation(v1_dual_label))
+ self.wait(1.5)
+ text5=TextMobject(r"\text{${T_1}$}",r"\text{$(v_2)$}",r"\text{$= 0$}").scale(.6)
+ text5[1].set_color(YELLOW_E)
+ text5[0].set_color(PINK)
+ text5.shift(4.94*LEFT+1.5*UP)
+ self.play(ShowCreation(text5))
+ self.wait(1.5)
+ line2 = self.get_graph(lambda x : x/3, x_min = -5,x_max=5,color=PINK)
+ v2_dual_label = TextMobject(r"${T_1}$").scale(.6).shift(3.9*RIGHT+1.3*UP)
+ self.play(ShowCreation(line2),ShowCreation(v2_dual_label))
+ self.wait(1.5)
+ text6=TextMobject(r"\text{${T_1}$}",r"\text{$= - x + 3y$}").scale(.6)
+ text6[0].set_color(PINK)
+ text6.shift(4.76*LEFT+1*UP)
+ self.play(ShowCreation(text6))
+ self.wait(3)
+ text7 = TextMobject(r"\text{B =}",r"\text{$[$}",r"\text{$v_1,$}",r"\text{$v_2$}",r"\text{$]$}",r"\text{=}",r"\text{$[(2,1), (3,1)]$}").scale(0.6).shift(3*UP+4.5*LEFT)
+ text7[2].set_color(RED_E)
+ text7[3].set_color(YELLOW_E)
+ self.play(FadeOut(text1),FadeOut(text2),FadeOut(text3),FadeOut(text4),FadeOut(text5),FadeOut(text6))
+ self.play(ShowCreation(text7))
+ self.wait(0.7)
+ text8 = TextMobject(r"\text{B$^* =$}",r"\text{$[$}",r"\text{${T_1}$,}",r"\text{${T_2} $}",r"\text{$]$}",r"\text{=}",r"\text{$[-x + 3y, x - 2y]$}").scale(0.6).shift(2.3*UP+4.1*LEFT)
+ text8[3].set_color(BLUE)
+ text8[2].set_color(PINK)
+ self.play(ShowCreation(text8))
+ self.wait(3)
+
+
+
+
+
+
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_of_a_Cube.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_of_a_Cube.py new file mode 100644 index 0000000..a6f501e --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Dual_of_a_Cube.py @@ -0,0 +1,38 @@ +from manimlib.imports import *
+class Duality(ThreeDScene):
+
+
+ def construct(self):
+ axes = ThreeDAxes()
+ self.set_camera_orientation(phi = 65*DEGREES,theta =80*DEGREES)
+ self.begin_ambient_camera_rotation(rate=0.09)
+ cube = Cube(stroke_width=5,color=WHITE).scale(2)
+ cube.set_opacity(0.2)
+ self.play(ShowCreation(cube))
+ dot1= Dot(color=RED).scale(0.85).shift([2,0,0])
+ self.play(ShowCreation(dot1))
+ dot2= Dot(color=YELLOW).scale(0.85).shift([-2,0,0])
+ self.play(ShowCreation(dot2))
+ dot3= Dot(color=BLUE).scale(0.85).shift([0,-2,0])
+ self.play(ShowCreation(dot3))
+ dot4= Dot(color=GREEN).scale(0.85).shift([0,2,0])
+ self.play(ShowCreation(dot4))
+ dot5= Dot(color=ORANGE).scale(0.85).shift([0,0,2])
+ self.play(ShowCreation(dot5))
+ dot6= Dot(color=PINK).scale(0.85).shift([0,0,-2])
+ self.play(ShowCreation(dot6))
+ line1 = Line(start=[0,0,2],end=[2,0,0],stroke_width=2.5,color=BLACK)
+ line2 = Line(start=[0,0,2],end=[-2,0,0],stroke_width=2.5,color=BLACK)
+ line3 = Line(start=[0,0,2],end=[0,-2,0],stroke_width=2.5,color=BLACK)
+ line4 = Line(start=[0,0,2],end=[0,2,0],stroke_width=2.5,color=BLACK)
+ line5 = Line(start=[2,0,0],end=[0,0,-2],stroke_width=2.5,color=BLACK)
+ line6 = Line(start=[-2,0,0],end=[0,0,-2],stroke_width=2.5,color=BLACK)
+ line7 = Line(start=[0,-2,0],end=[0,0,-2],stroke_width=2.5,color=BLACK)
+ line8 = Line(start=[0,2,0],end=[0,0,-2],stroke_width=2.5,color=BLACK)
+ line9 = Line(start=[0,2,0],end=[-2,0,0],stroke_width=2.5,color=BLACK)
+ line10 = Line(start=[-2,0,0],end=[0,-2,0],stroke_width=2.5,color=BLACK)
+ line11 = Line(start=[0,-2,0],end=[2,0,0],stroke_width=2.5,color=BLACK)
+ line12 = Line(start=[2,0,0],end=[0,2,0],stroke_width=2.5,color=BLACK)
+ self.play(ShowCreation(line1),ShowCreation(line2),ShowCreation(line3),ShowCreation(line4),ShowCreation(line5),ShowCreation(line6),ShowCreation(line7),ShowCreation(line8),ShowCreation(line9),ShowCreation(line10),ShowCreation(line11),ShowCreation(line12))
+ self.wait(10)
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Duality_in_Sets.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Duality_in_Sets.py new file mode 100644 index 0000000..693017e --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Duality_in_Sets.py @@ -0,0 +1,25 @@ +from manimlib.imports import *
+import numpy as np
+class Duality_in_sets(Scene):
+ def construct(self):
+ circle1 = Circle(radius=0.4,color=BLACK).shift(2.3*LEFT)
+ circle1.set_fill(color=RED,opacity=200)
+ rect1=Rectangle(height=2,width=2,color=GREY).shift(2*LEFT)
+ rect1.set_fill(color=DARK_BLUE,opacity=1)
+ text1 = TextMobject("S").scale(0.7).shift(0.9*UP+0.7*LEFT)
+ text2 = TextMobject("X",color=BLACK,stroke_width=0.5).scale(0.5).shift(2.3*LEFT)
+ self.play(ShowCreation(rect1),ShowCreation(text1),ShowCreation(circle1),ShowCreation(text2))
+ circle2 = Circle(radius=0.4,color=BLACK).shift(1.7*RIGHT)
+ circle2.set_fill(color=BLACK,opacity=200)
+ rect2=Rectangle(height=2,width=2,color=GREY).shift(2*RIGHT)
+ rect2.set_fill(color=DARK_BLUE,opacity=1)
+ text3 = TextMobject("S").scale(0.7).shift(0.9*UP+3.3*RIGHT)
+ text4 = TextMobject(r"X$^c$",color=BLACK,stroke_width=0.2).scale(0.5).shift(2.55*RIGHT+0.6*UP)
+ text5 = TextMobject(r"\text{The subset}",r"\text{X$^c$}",r"\text{is the dual of subset}",r"\text{X}").scale(0.6).shift(2.7*UP+0.5*LEFT)
+ text5[1].set_color(GREY)
+ text5[3].set_color(GREY)
+ self.play(ShowCreation(rect2),ShowCreation(circle2),ShowCreation(text3),ShowCreation(text4))
+ self.wait(2)
+ self.play(ShowCreation(text5))
+ self.wait(3)
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Linear_Functional.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Linear_Functional.py new file mode 100644 index 0000000..6edc918 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/Linear_Functional.py @@ -0,0 +1,29 @@ +from manimlib.imports import *
+import numpy as np
+class LinearFunctional(Scene):
+ def construct(self):
+ big_box=Rectangle().scale(2.7)
+ box = Rectangle(height=2,width=2,color=DARK_GREY).set_fill(color=PURPLE,opacity=350)
+ arrow1 = Arrow(color=RED).shift(1.8*LEFT+0.5*UP)
+ arrow2 = Arrow(color=RED).shift(1.8*LEFT+0.5*DOWN)
+ arrow3 = Arrow(color=GREEN).shift(0.5*UP+1.8*RIGHT)
+ arrow4 = Arrow(color=GREEN).shift(0.5*DOWN+1.8*RIGHT)
+ Linear = TextMobject("LINEAR",color=BLACK).scale(0.5).shift(0.2*UP)
+ Functional = TextMobject("FUNCTIONAL",color=BLACK).scale(0.5).shift(0.2*DOWN)
+ u = TextMobject(r"$\vec{u}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*UP)
+ v = TextMobject(r"$\vec{v}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*DOWN)
+ f1 = TextMobject(r"$f_1$",color=YELLOW).scale(0.7).shift(2.8*RIGHT+0.5*UP)
+ f2 = TextMobject(r"$f_2$",color=YELLOW).scale(0.7).shift(2.8*RIGHT+0.5*DOWN)
+ text = TextMobject(r"The Linear Functional is a function that takes $\vec{u}, \vec{v} \in$ V as inputs and gives the output $f_1, f_2\in$ F.").scale(0.55).shift(2*DOWN)
+ self.play(ShowCreation(big_box))
+ self.play(ShowCreation(box))
+ self.play(ShowCreation(Linear),ShowCreation(Functional))
+ self.wait(2)
+ self.play(ShowCreation(arrow1),ShowCreation(u))
+ self.play(ShowCreation(arrow3),ShowCreation(f1))
+ self.wait(0.7)
+ self.play(ShowCreation(arrow2),ShowCreation(v))
+ self.play(ShowCreation(arrow4),ShowCreation(f2))
+ self.wait(1)
+ self.play(ShowCreation(text))
+ self.wait(4)
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Basis_of_a_dual_vector_space.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Basis_of_a_dual_vector_space.mp4 Binary files differnew file mode 100644 index 0000000..b96f541 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Basis_of_a_dual_vector_space.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_Basis_Example.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_Basis_Example.mp4 Binary files differnew file mode 100644 index 0000000..c93be25 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_Basis_Example.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_of_a_Cube.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_of_a_Cube.mp4 Binary files differnew file mode 100644 index 0000000..ebfb564 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Dual_of_a_Cube.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Duality_in_Sets.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Duality_in_Sets.mp4 Binary files differnew file mode 100644 index 0000000..86cc693 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Duality_in_Sets.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Linear_functional.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Linear_functional.mp4 Binary files differnew file mode 100644 index 0000000..d41fada --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Dual-Spaces/gifs4/Linear_functional.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Scalar_Multiplication.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Scalar_Multiplication.py new file mode 100644 index 0000000..ac74792 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Scalar_Multiplication.py @@ -0,0 +1,62 @@ +from manimlib.imports import *
+from scipy import exp
+class FunctionScalarMultiplication(GraphScene):
+ CONFIG = {
+ "x_min" : -5,
+ "x_max" : 5,
+ "y_min" : -5,
+ "y_max" : 5,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "axes_color":LIGHT_GRAY,
+ "graph_origin": ORIGIN,
+ }
+ def construct(self):
+ self.setup_axes(animate = True)
+ curve1 = self.get_graph(lambda x : 1/3*(x**2)+1, x_min=-2,x_max=2.5,color=ORANGE)
+ curve2 = self.get_graph(lambda x : 2*(1/3*(x**2)+1), x_min=-2,x_max=2.5,color=GOLD)
+ fx= TextMobject("$f(x)$").scale(0.6).shift(1.25*UP + 2.2*LEFT)
+ gx= TextMobject("$2 \cdot f(x)$").scale(0.6).shift(0.5*UP + 2.1*LEFT)
+ f1 = self.get_vertical_line_to_graph(-2,curve1,color=YELLOW)
+ f2 = self.get_vertical_line_to_graph(-1.5,curve1,color=YELLOW)
+ f3 = self.get_vertical_line_to_graph(-1,curve1,color=YELLOW)
+ f4 = self.get_vertical_line_to_graph(-0.5,curve1,color=YELLOW)
+ f5 = self.get_vertical_line_to_graph(0,curve1,color=YELLOW)
+ f6 = self.get_vertical_line_to_graph(0.5,curve1,color=YELLOW)
+ f7 = self.get_vertical_line_to_graph(1,curve1,color=YELLOW)
+ f8 = self.get_vertical_line_to_graph(1.5,curve1,color=YELLOW)
+ f9 = self.get_vertical_line_to_graph(2,curve1,color=YELLOW)
+ f10 = self.get_vertical_line_to_graph(2.5,curve1,color=YELLOW)
+ self.play(ShowCreation(curve1),ShowCreation(fx))
+ self.wait(1.5)
+ self.play(ShowCreation(f1),ShowCreation(f2),ShowCreation(f3),ShowCreation(f4),ShowCreation(f5),ShowCreation(f6),ShowCreation(f7),ShowCreation(f8),ShowCreation(f9),ShowCreation(f10))
+ self.wait(1.7)
+ line1=Line(color=YELLOW).shift(5*LEFT+1.8*UP).scale(0.5)
+ line1.rotate(np.pi/2)
+ scalar = TextMobject("2 x").scale(0.65).shift(5.5*LEFT+1.9*UP)
+ equal = TextMobject("=").scale(0.65).shift(4.5*LEFT+1.9*UP)
+ line2=Line(color=BLUE).shift(4*LEFT+2.3*UP)
+ line2.rotate(np.pi/2)
+ self.play(ShowCreation(line1),ShowCreation(scalar),ShowCreation(equal),ShowCreation(line2))
+ g1 = self.get_vertical_line_to_graph(-2,curve2,color=BLUE)
+ g2 = self.get_vertical_line_to_graph(-1.5,curve2,color=BLUE)
+ g3 = self.get_vertical_line_to_graph(-1,curve2,color=BLUE)
+ g4 = self.get_vertical_line_to_graph(-0.5,curve2,color=BLUE)
+ g5 = self.get_vertical_line_to_graph(0,curve2,color=BLUE)
+ g6 = self.get_vertical_line_to_graph(0.5,curve2,color=BLUE)
+ g7 = self.get_vertical_line_to_graph(1,curve2,color=BLUE)
+ g8 = self.get_vertical_line_to_graph(1.5,curve2,color=BLUE)
+ g9 = self.get_vertical_line_to_graph(2,curve2,color=BLUE)
+ g10 = self.get_vertical_line_to_graph(2.5,curve2,color=BLUE)
+ self.play(ShowCreation(g1),ShowCreation(g2),ShowCreation(g3),ShowCreation(g4),ShowCreation(g5),ShowCreation(g6),ShowCreation(g7),ShowCreation(g8),ShowCreation(g9),ShowCreation(g10))
+ self.wait(2)
+ fx2=TextMobject("2$\cdot f(x)$").scale(0.6).shift(2.6*UP+2.3*LEFT)
+ self.play(ShowCreation(curve2),ShowCreation(fx2))
+ self.wait(1.5)
+ self.play(FadeOut(curve1),FadeOut(fx))
+ sc_mult=TextMobject("$(2 f(x)) = 2f(x)$",color=GOLD).scale(0.65).shift(0.65*UP + 5*LEFT)
+ rect = Rectangle(height=0.5,width=2)
+ rect.surround(sc_mult)
+ self.play(ShowCreation(sc_mult),ShowCreation(rect))
+ self.wait(3)
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Space_Addition.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Space_Addition.py new file mode 100644 index 0000000..5ce0e11 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Function_Space_Addition.py @@ -0,0 +1,89 @@ +from manimlib.imports import *
+from scipy import sin,exp
+class FunctionalVectorSpace(GraphScene):
+ CONFIG = {
+ "x_min" : -5,
+ "x_max" : 5,
+ "y_min" : -5,
+ "y_max" : 5,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "axes_color":LIGHT_GRAY,
+ "graph_origin": ORIGIN,
+
+
+ }
+ def construct(self):
+ self.setup_axes(animate = True)
+ curve1 = self.get_graph(lambda x : exp(x) + 0.5, x_min=-2,x_max=2.5,color=ORANGE)
+ curve2 = self.get_graph(lambda x : 1/3*(x**2)+1, x_min=-2,x_max=2.5,color=DARK_BLUE)
+ curve3 = self.get_graph(lambda x : 1/3*(x**2)+1 + exp(x) + 0.5, x_min=-2,x_max=2.5,color=BLACK)
+ fx= TextMobject("$f(x)$").scale(0.6).shift(1.25*UP + 2.1*LEFT)
+ gx= TextMobject("$g(x)$").scale(0.6).shift(0.5*UP + 2.1*LEFT)
+ f1 = self.get_vertical_line_to_graph(-2,curve1,color=YELLOW)
+ f2 = self.get_vertical_line_to_graph(-1.5,curve1,color=YELLOW)
+ f3 = self.get_vertical_line_to_graph(-1,curve1,color=YELLOW)
+ f4 = self.get_vertical_line_to_graph(-0.5,curve1,color=YELLOW)
+ f5 = self.get_vertical_line_to_graph(0,curve1,color=YELLOW)
+ f6 = self.get_vertical_line_to_graph(0.5,curve1,color=YELLOW)
+ f7 = self.get_vertical_line_to_graph(1,curve1,color=YELLOW)
+ f8 = self.get_vertical_line_to_graph(1.5,curve1,color=YELLOW)
+ f9 = self.get_vertical_line_to_graph(2,curve1,color=YELLOW)
+ f10 = self.get_vertical_line_to_graph(2.5,curve1,color=YELLOW)
+
+ self.play(ShowCreation(curve1),ShowCreation(gx))
+ self.wait(1.2)
+ self.play(ShowCreation(curve2),ShowCreation(fx))
+ self.wait(1.2)
+ self.play(ShowCreation(f1),ShowCreation(f2),ShowCreation(f3),ShowCreation(f4),ShowCreation(f5),ShowCreation(f6),ShowCreation(f7),ShowCreation(f8),ShowCreation(f9),ShowCreation(f10))
+ self.wait(1.7)
+ g1 = self.get_vertical_line_to_graph(-2,curve2,color=BLUE)
+ g2 = self.get_vertical_line_to_graph(-1.5,curve2,color=BLUE)
+ g3 = self.get_vertical_line_to_graph(-1,curve2,color=BLUE)
+ g4 = self.get_vertical_line_to_graph(-0.5,curve2,color=BLUE)
+ g5 = self.get_vertical_line_to_graph(0,curve2,color=BLUE)
+ g6 = self.get_vertical_line_to_graph(0.5,curve2,color=BLUE)
+ g7 = self.get_vertical_line_to_graph(1,curve2,color=BLUE)
+ g8 = self.get_vertical_line_to_graph(1.5,curve2,color=BLUE)
+ g9 = self.get_vertical_line_to_graph(2,curve2,color=BLUE)
+ g10 = self.get_vertical_line_to_graph(2.5,curve2,color=BLUE)
+ self.play(ShowCreation(g1),ShowCreation(g2),ShowCreation(g3),ShowCreation(g4),ShowCreation(g5),ShowCreation(g6),ShowCreation(g7),ShowCreation(g8),ShowCreation(g9),ShowCreation(g10))
+ line1=Line(color=BLUE).shift(5*LEFT+2.3*UP).scale(0.25)
+ line1.rotate(np.pi/2)
+ line2=Line(color=YELLOW).shift(6*LEFT+2.5*UP).scale(0.5)
+ line2.rotate(np.pi/2)
+ line3=Line(color=PURPLE_B).shift(4*LEFT+2.7*UP).scale(0.75)
+ line3.rotate(np.pi/2)
+ add=TextMobject("+").shift(2.4*UP+5.5*LEFT).scale(0.7)
+ equal=TextMobject("=").shift(2.4*UP+4.5*LEFT).scale(0.7)
+ self.play(ShowCreation(line2),ShowCreation(line1),ShowCreation(add),ShowCreation(equal),ShowCreation(line3))
+ self.wait(2)
+ self.play(FadeOut(curve1),FadeOut(curve2))
+ self.wait(3)
+ h1 = self.get_vertical_line_to_graph(-2,curve3,color=PURPLE_B)
+ h2 = self.get_vertical_line_to_graph(-1.5,curve3,color=PURPLE_B)
+ h3 = self.get_vertical_line_to_graph(-1,curve3,color=PURPLE_B)
+ h4 = self.get_vertical_line_to_graph(-0.5,curve3,color=PURPLE_B)
+ h5 = self.get_vertical_line_to_graph(0,curve3,color=PURPLE_B)
+ h6 = self.get_vertical_line_to_graph(0.5,curve3,color=PURPLE_B)
+ h7 = self.get_vertical_line_to_graph(1,curve3,color=PURPLE_B)
+ h8 = self.get_vertical_line_to_graph(1.5,curve3,color=PURPLE_B)
+ h9 = self.get_vertical_line_to_graph(2,curve3,color=PURPLE_B)
+ h10 = self.get_vertical_line_to_graph(2.5,curve3,color=PURPLE_B)
+
+ line1.shift(1*LEFT+0.9*UP)
+ equal.shift(0.3*LEFT+0.2*UP)
+ f=TextMobject("$f(x)$").scale(0.5).shift(5.6*LEFT+3.2*UP)
+ g=TextMobject("$g(x)$").scale(0.5).shift(5.6*LEFT+2.4*UP)
+ fg=TextMobject("$(f + g)(x)$").scale(0.5).shift(2.85*UP+3.3*LEFT)
+ self.play(FadeOut(add),ShowCreation(equal),ShowCreation(line1),ShowCreation(f),ShowCreation(g),ShowCreation(fg),FadeOut(fx),FadeOut(gx))
+ self.wait(1.7)
+ self.play(ShowCreation(h1),ShowCreation(h2),ShowCreation(h3),ShowCreation(h4),ShowCreation(h5),ShowCreation(h6),ShowCreation(h7),ShowCreation(h8),ShowCreation(h9),ShowCreation(h10))
+ curve3 = self.get_graph(lambda x : 1/3*(x**2)+1 + exp(x) + 0.5, x_min=-2,x_max=2.5,color=RED_A)
+ fgx=TextMobject("$(f + g)(x)$").scale(0.5).shift(1.65*UP+2.4*LEFT)
+ self.play(ShowCreation(curve3),ShowCreation(fgx))
+ sum=TextMobject("$(f + g)(x) = f(x) + g(x)$",color=GOLD).scale(0.65).shift(0.8*UP + 5*LEFT)
+ rect = Rectangle(height=0.5,width=2)
+ rect.surround(sum)
+ self.play(ShowCreation(sum),ShowCreation(rect))
+ self.wait(3)
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Integral_Properties.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Integral_Properties.py new file mode 100644 index 0000000..97c0e09 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/Integral_Properties.py @@ -0,0 +1,77 @@ +from manimlib.imports import *
+from scipy import sin
+class Integral_Properties(GraphScene):
+ CONFIG = {
+ "x_min" : 0,
+ "x_max" : 5,
+ "y_min" : 0,
+ "y_max" : 6,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "axes_color":LIGHT_GRAY,
+ "x_labeled_nums" : list(range(6)),
+ "y_labeled_nums" : list(range(6))
+ }
+ def construct(self):
+ self.setup_axes(animate=False)
+ curve1 = self.get_graph(lambda x : sin(x), x_min=0,x_max=2.5,color=RED)
+ curve2 = self.get_graph(lambda x : x, x_min=0,x_max=2.5,color=DARK_BLUE)
+ curve3 = self.get_graph(lambda x : sin(x) + x, x_min=0,x_max=2.5,color=GREEN)
+ fx = TextMobject(r"$f(x)$").scale(0.5).shift(1*RIGHT+1.8*DOWN)
+ gx = TextMobject(r"$g(x)$").scale(0.5).shift(1*RIGHT)
+ sum = TextMobject(r"$f(x) + g(x)$").scale(0.5).shift(1.3*RIGHT+0.6*UP)
+ area1 = self.get_area(curve1,0,2.5)
+ area2 = self.get_area(curve2,0,2.5)
+ area3 = self.get_area(curve3,0,2.5)
+ area2.set_fill(color=PURPLE)
+ area3.set_fill(color=ORANGE)
+ text1=TextMobject(r"$\int_{0}^{2.5}$ f(x) dx = Area under the curve f(x)",color=BLUE_C).scale(0.7).shift(2.7*RIGHT+3*UP)
+ text2=TextMobject(r"$\int_{0}^{2.5}$ g(x) dx = Area under the curve g(x)",color=PURPLE_B).scale(0.7).shift(2.7*RIGHT+2.4*UP)
+ text3=TextMobject(r"Area under the curve f(x) + g(x) = $\int_{0}^{2.5} (f(x) + g(x)) dx$",color=ORANGE).scale(0.7).shift(2.7*RIGHT+1.8*UP)
+ text4=TextMobject(r"\text{$\int_{0}^{2.5}$ (f(x) + g(x)) dx}",r"\text{ = }",r"\text{ $\int_{0}^{2.5}$ f(x) dx }",r"\text{+}",r"\text{$\int_{0}^{2.5}$ g(x) dx}").scale(0.62).shift(2.7*RIGHT+2.7*UP)
+ text4[0].set_color(ORANGE)
+ text4[2].set_color(BLUE_C)
+ text4[4].set_color(PURPLE_B)
+ self.play(ShowCreation(curve1), ShowCreation(fx))
+ self.wait(1.2)
+ self.play(ShowCreation(curve2),ShowCreation(gx))
+ self.wait(1.2)
+ self.play(ShowCreation(area1))
+ self.play(ShowCreation(text1))
+ self.wait(1.5)
+ self.play(ShowCreation(area2))
+ self.play(ShowCreation(text2))
+ self.wait(1.5)
+ self.play(ShowCreation(curve3),ShowCreation(sum))
+ self.play(ShowCreation(area3))
+ self.play(ShowCreation(text3))
+ self.wait(2)
+ self.play(FadeOut(text1),FadeOut(text2),FadeOut(text3))
+ self.wait(1)
+ self.play(ShowCreation(text4))
+ self.wait(3)
+ self.play(FadeOut(curve1),FadeOut(curve2),FadeOut(area1),FadeOut(area2))
+ self.wait(1.5)
+ self.play(FadeOut(text4),FadeOut(area2),FadeOut(curve2),FadeOut(gx),FadeOut(curve3),FadeOut(sum),FadeOut(area3),ShowCreation(curve1),ShowCreation(fx))
+ self.wait(1.5)
+ self.play(ShowCreation(area1),ShowCreation(text1))
+ self.wait(1.5)
+ curve4 = self.get_graph(lambda x : 2*sin(x), x_min=0,x_max=2.5,color=RED)
+ area4 = self.get_area(curve4,0,2.5)
+ area4.set_fill(color=YELLOW)
+ fx2 = TextMobject(r"$2f(x)$").scale(0.7).shift(1*RIGHT+1.2*DOWN)
+ scalar_mul=TextMobject(r"$\int_{0}^{2.5} ( 2f(x) ) dx$ = 2 $\times$ Area under the curve f(x)",color=YELLOW).scale(0.7).shift(2.7*RIGHT+2.4*UP)
+ self.play(ShowCreation(curve4),ShowCreation(fx2))
+ self.wait(1)
+ self.play(ShowCreation(area4))
+ self.wait(2)
+ self.play(ShowCreation(scalar_mul))
+ self.wait(2)
+ text5=TextMobject(r"\text{$\int_{0}^{2.5}$ (2 f(x)) dx}",r"\text{ = }",r"\text{2 $\int_{0}^{2.5}$ f(x) dx }").scale(0.67).shift(2.7*RIGHT+2.7*UP)
+ text5[0].set_color(YELLOW)
+ text5[2].set_color(BLUE_C)
+ self.play(FadeOut(text1),FadeOut(scalar_mul))
+ self.wait(1)
+ self.play(ShowCreation(text5))
+ self.wait(3)
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Addition_of_Functions.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Addition_of_Functions.gif Binary files differnew file mode 100644 index 0000000..6c42b74 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Addition_of_Functions.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Function_Space_Example.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Function_Space_Example.gif Binary files differnew file mode 100644 index 0000000..996a9de --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Function_Space_Example.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Scalar_Multiplicaton_of_Functions.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Scalar_Multiplicaton_of_Functions.gif Binary files differnew file mode 100644 index 0000000..8fff2c8 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Function-and-Polynomial-Spaces/gifs3/Scalar_Multiplicaton_of_Functions.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Conjugate_Symmetry_and_Positivity_of_Inner_Product.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Conjugate_Symmetry_and_Positivity_of_Inner_Product.py new file mode 100644 index 0000000..1d84842 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Conjugate_Symmetry_and_Positivity_of_Inner_Product.py @@ -0,0 +1,141 @@ +from manimlib.imports import *
+VECTORS = [[0, 2],
+ [1, 1],
+ [0, -2],
+ [1, -1],
+ [2, -2],
+ [2, 2],
+ [2, 2],
+ [-2, -1],
+ [3, 4]]
+class Scene1(LinearTransformationScene):
+ CONFIG = {
+ "include_background_plane": True,
+ "include_foreground_plane": False,
+ "show_coordinates": True,
+ "show_basis_vectors": False,
+ "basis_vector_stroke_width": 3,
+ }
+ def construct(self):
+ text1 = TextMobject(r"\text{$u$}",r"\text{ = $0 + 2i$, }",r"\text{$v$}",r"\text{ = $1 + i$}").scale(0.6).shift(3.5*UP+4*LEFT)
+ text1[0].set_color(YELLOW)
+ text1[2].set_color(RED)
+ text1.add_background_rectangle()
+ self.play(ShowCreation(text1))
+ text2 = TextMobject(r"\text{$\overline{u}$}",r"\text{ = $0 - 2i$, }",r"\text{$\overline{v}$}",r"\text{ = $1 - i$}").scale(0.6).shift(3*UP+4*LEFT)
+ text2[0].set_color(YELLOW)
+ text2[2].set_color(RED)
+ text2.add_background_rectangle()
+ self.play(ShowCreation(text2))
+ self.wait(2)
+ v1 = self.add_vector(VECTORS[0],color = YELLOW, stroke_width = 3.5)
+ u = TextMobject(r"$u$",color=YELLOW).shift(0.3*LEFT+2*UP).scale(0.6)
+ self.play(ShowCreation(u))
+ v1b = self.add_vector(VECTORS[2],color = YELLOW, stroke_width = 3.5)
+ ub = TextMobject(r"$\overline{u}$",color=YELLOW).shift(2*DOWN+0.3*LEFT).scale(0.6)
+ self.play(ShowCreation(ub))
+ self.wait(2)
+ v2 = self.add_vector(VECTORS[1],color = RED, stroke_width = 3.5)
+ v = TextMobject(r"$v$",color=RED).shift(1.2*RIGHT+1*UP).scale(0.6)
+ self.play(ShowCreation(v))
+ v2b = self.add_vector(VECTORS[3],color = RED, stroke_width = 3.5)
+ vb = TextMobject(r"$\overline{v}$",color=RED).shift(1.2*RIGHT+1*DOWN).scale(0.6)
+ self.play(ShowCreation(vb))
+ text3 = TextMobject(r"\text{$<u, v>$}",r"\text{ = }",r"\text{$\overline{u}$",r"\text{$\cdot$}",r"\text{$v$}",r"\text{ = }",r"\text{$2 - 2i$}").shift(2.5*UP+3.7*LEFT).scale(0.6)
+ text3[0].set_color(BLUE)
+ text3[2].set_color(YELLOW)
+ text3[4].set_color(RED)
+ text3.add_background_rectangle()
+ self.play(ShowCreation(text3))
+ self.wait(2)
+ text4 = TextMobject(r"\text{$<\overline{u, v}>$",r"\text{ = }",r"\text{$\overline{u}$",r"\text{$\cdot$}",r"\text{$v$}",r"\text{ = }",r"\text{$2 + 2i$}").shift(2*UP+3.7*LEFT).scale(0.6)
+ text4[0].set_color(BLUE)
+ text4[2].set_color(YELLOW)
+ text4[4].set_color(RED)
+ text4.add_background_rectangle()
+ line = Line(stroke_width = 1.5).scale(0.33).shift(2.2*UP+3.54*LEFT)
+ self.play(ShowCreation(text4),ShowCreation(line))
+ self.wait(2)
+ self.play(FadeOut(v1),FadeOut(v1b),FadeOut(v2),FadeOut(v2b),FadeOut(u),FadeOut(ub),FadeOut(v),FadeOut(vb))
+ v3 = self.add_vector(VECTORS[4],color = BLUE, stroke_width = 3.5)
+ uv = TextMobject(r"$\overline{u}\cdot v$",color=BLUE).shift(2.4*RIGHT+2.1*DOWN).scale(0.6)
+ self.play(ShowCreation(uv))
+ v3b = self.add_vector(VECTORS[5],color = BLUE, stroke_width = 3.5)
+ uvb = TextMobject(r"$\overline{\overline{u}\cdot v}$",color=BLUE).shift(2.4*RIGHT+2.1*UP).scale(0.6)
+ self.play(ShowCreation(uvb))
+ self.wait(2)
+ text5 = TextMobject(r"\text{$<v, u>$}",r"\text{ = }",r"\text{$\overline{v}$",r"\text{$\cdot$}",r"\text{$u$}",r"\text{ = }",r"\text{$2 + 2i$}").shift(1.5*UP+3.7*LEFT).scale(0.6)
+ text5[0].set_color(MAROON_B)
+ text5[2].set_color(RED)
+ text5[4].set_color(YELLOW)
+ text5.add_background_rectangle()
+ self.play(ShowCreation(text5))
+ self.wait(2)
+ v4 = self.add_vector(VECTORS[5],color = MAROON_B, stroke_width = 3.5)
+ vu = TextMobject(r"$\overline{v}\cdot u$",color=MAROON_B).shift(1.3*RIGHT+2.1*UP).scale(0.6)
+ self.play(ShowCreation(vu))
+ self.play(FadeOut(uvb))
+ self.wait(2)
+ text6 = TextMobject(r"\text{$<\overline{u, v}>$",r"\text{ = }",r"\text{$<v, u>$").scale(0.6).shift(0.8*UP+4.2*LEFT)
+ text6[0].set_color(BLUE)
+ text6[2].set_color(MAROON_B)
+ text6.add_background_rectangle()
+ self.play(ShowCreation(text6))
+ rect = Rectangle(height = 0.7,width = 3.5)
+ rect.surround(text6)
+ self.play(ShowCreation(rect))
+ self.wait(3)
+ self.play(FadeOut(line),FadeOut(text1),FadeOut(text2),FadeOut(text3),FadeOut(text4),FadeOut(text5),FadeOut(text6),FadeOut(v4),FadeOut(vu),FadeOut(v3),FadeOut(uv),FadeOut(rect),FadeOut(v3b))
+
+ text7 = TextMobject(r"\text{$u$}",r"\text{ = $(1 + i) > 0$}").scale(0.6).shift(3.5*UP+4.5*LEFT)
+ text7[0].set_color(YELLOW)
+ text7.add_background_rectangle()
+ self.play(ShowCreation(text7))
+ v5 = self.add_vector(VECTORS[1],color = YELLOW, stroke_width = 3.5)
+ u = TextMobject(r"$u$",color=YELLOW).shift(1.2*RIGHT+1*UP).scale(0.6)
+ self.play(ShowCreation(u))
+ self.wait(1.5)
+ text8 = TextMobject(r"\text{$<u, u>$}",r"\text{ = $(0 + 2i) > 0$ }").scale(0.6).shift(2.7*UP+4*LEFT)
+ text8[0].set_color(GREEN)
+ text8.add_background_rectangle()
+ rect1 = Rectangle(height = 0.55, width = 3.3)
+ rect1.surround(text8)
+ self.play(ShowCreation(text8),ShowCreation(rect1))
+ self.wait(2)
+ v6 = self.add_vector(VECTORS[0],color = GREEN, stroke_width = 3.5)
+ uu = TextMobject(r"$<u, u>$",color=GREEN).shift(0.8*LEFT+1.9*UP).scale(0.6)
+ self.play(ShowCreation(uu))
+ text9 = TextMobject(r"\text{$v$}",r"\text{ = $(-2 - i) < 0$}").scale(0.6).shift(1.5*UP+4.4*LEFT)
+ text9[0].set_color(RED)
+ text9.add_background_rectangle()
+ self.play(ShowCreation(text9))
+ self.wait(1.5)
+ v7 = self.add_vector(VECTORS[7],color = RED, stroke_width = 3.5)
+ v = TextMobject(r"$v$",color=RED).shift(2.2*LEFT+1*DOWN).scale(0.6)
+ self.play(ShowCreation(v))
+ self.wait(1.5)
+ text10 = TextMobject(r"\text{$<v, v>$}",r"\text{ = $(3 + 4i) > 0$ }").scale(0.6).shift(0.7*UP+4*LEFT)
+ text10[0].set_color(BLUE)
+ text10.add_background_rectangle()
+ rect2 = Rectangle(height=0.55,width=3.3)
+ rect2.surround(text10)
+ self.play(ShowCreation(text10),ShowCreation(rect2))
+ self.wait(2)
+ v8 = self.add_vector(VECTORS[8],color = BLUE, stroke_width = 3.5)
+ vv = TextMobject(r"$<v, v>$",color=BLUE).shift(2.1*RIGHT+3.8*UP).scale(0.6)
+ self.play(ShowCreation(vv))
+ self.wait(4)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Example.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Example.py new file mode 100644 index 0000000..97b9696 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Example.py @@ -0,0 +1,182 @@ +from manimlib.imports import *
+from scipy import sin,cos
+class Inner_Product_Space_Example(GraphScene):
+ CONFIG = {
+ "x_min" : 0,
+ "x_max" : 5,
+ "y_min" : 0,
+ "y_max" : 6,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "axes_color":LIGHT_GRAY,
+ "x_labeled_nums" : list(range(6)),
+ "y_labeled_nums" : list(range(6))
+ }
+ def construct(self):
+ self.setup_axes(animate=True)
+ text = TextMobject(r"$f(x), g(x), h(x) \in C[0, 2]$",color=GOLD).scale(0.5).shift(3.5*UP+5.5*LEFT)
+ fx = TextMobject(r"$f(x)$ = sin(x)",color=GOLD).scale(0.5).shift(3*UP+6*LEFT)
+ gx = TextMobject(r"$g(x)$ = x",color=GOLD).scale(0.5).shift(2.5*UP+6.25*LEFT)
+ hx = TextMobject(r"$h(x)$ = 1.4",color=GOLD).scale(0.5).shift(2*UP+6.2*LEFT)
+
+ curve1 = self.get_graph(lambda x : sin(x), x_min=0,x_max=2,color=RED)
+ curve2 = self.get_graph(lambda x : x, x_min=0,x_max=2,color=DARK_BLUE)
+ curve3 = self.get_graph(lambda x : 1.4, x_min=0,x_max=2,color=GREEN)
+ text1 = TextMobject(r"$f(x)$").scale(0.5).shift(1.7*DOWN)
+
+ text2 = TextMobject(r"$g(x)$").scale(0.5).shift(0.34*DOWN)
+ text3 = TextMobject(r"$h(x)$").scale(0.5).shift(1.1*DOWN)
+
+
+ self.play(ShowCreation(text))
+ self.play(ShowCreation(curve1),ShowCreation(text1),ShowCreation(fx))
+ self.wait(1)
+ self.play(ShowCreation(curve2),ShowCreation(text2),ShowCreation(gx))
+ self.wait(1)
+ self.play(ShowCreation(curve3),ShowCreation(text3),ShowCreation(hx))
+ self.wait(2)
+ curve4 = self.get_graph(lambda x : sin(x) + x, x_min=0,x_max=2,color=YELLOW)
+ text4 = TextMobject(r"$f(x) + g(x)$").scale(0.5).shift(0.5*UP+0.5*RIGHT)
+ self.wait(1.5)
+
+ self.play(ShowCreation(curve4),ShowCreation(text4),FadeOut(curve2),FadeOut(text2),FadeOut(curve1),FadeOut(text1))
+ self.wait(1.5)
+ text5 = TextMobject(r"\text{$<f(x) + g(x), h(x)>$ = ",r"\text{$\int_{0}^{2} (f(x) + g(x))h(x)$ $dx$}",r"\text{= 4.78}").scale(0.57).shift(3.3*RIGHT+3.5*UP)
+ text5[1].set_color(ORANGE)
+ self.play(ShowCreation(text5))
+
+ curve5 = self.get_graph(lambda x : (sin(x) + x)*1.6, x_min=0,x_max=2,color=ORANGE)
+ text6 = TextMobject(r"$(f(x) + g(x))\cdot h(x)$").scale(0.5).shift(2.2*UP+0.72*RIGHT)
+ area1 = self.get_area(curve5,0,2)
+ area1.set_color(ORANGE)
+ self.wait(1)
+ self.play(FadeOut(curve4),FadeOut(text4),FadeOut(curve3),FadeOut(text3),ShowCreation(curve5),ShowCreation(text6),ShowCreation(area1))
+ self.wait(2)
+ text7 = TextMobject(r"\text{$<f(x), h(x)>$ = ",r"\text{$\int_{0}^{2} (f(x)h(x)$ $dx$}",r"\text{= 1.98}").scale(0.57).shift(4.5*RIGHT+3*UP)
+ text7[1].set_color(BLUE)
+ self.play(ShowCreation(text7))
+ self.wait(1.5)
+ curve6 = self.get_graph(lambda x : (sin(x))*1.6, x_min=0,x_max=2,color=BLUE)
+ text8 = TextMobject(r"$f(x)\cdot h(x)$").scale(0.5).shift(0.9*DOWN+0.3*RIGHT)
+ area2 = self.get_area(curve6,0,2)
+ self.play(ShowCreation(curve6),ShowCreation(text8),ShowCreation(area2))
+ self.wait(1.5)
+ text9 = TextMobject(r"\text{$<g(x), h(x)>$ = ",r"\text{$\int_{0}^{2} (g(x)h(x)$ $dx$}",r"\text{= 2.8}").scale(0.57).shift(4.5*RIGHT+2.5*UP)
+ text9[1].set_color(MAROON_B)
+ self.play(ShowCreation(text9))
+ self.wait(1.5)
+ curve7 = self.get_graph(lambda x : x*1.6, x_min=0,x_max=2,color=MAROON_B)
+ text10 = TextMobject(r"$g(x)\cdot h(x)$").scale(0.5).shift(0.3*RIGHT+0.78*UP)
+ area3 = self.get_area(curve7,0,2)
+ area3.set_color(MAROON_B)
+ self.play(ShowCreation(curve7),ShowCreation(text10),ShowCreation(area3))
+ self.wait(2.6)
+ curve8 = self.get_graph(lambda x : (sin(x))*1.6 + x*1.6, x_min=0,x_max=2,color=RED_C)
+ area4 = self.get_area(curve8,0,2)
+ area4.set_color(RED_C)
+ text11 = TextMobject(r"$f(x)h(x) + g(x)h(x)$").scale(0.5).shift(2.2*UP + 0.76*RIGHT)
+ self.play(FadeOut(curve6),FadeOut(text8),FadeOut(curve7),FadeOut(text10),FadeOut(area2),FadeOut(area3),ShowCreation(curve8),ShowCreation(area4))
+ self.wait(1)
+ self.play(Transform(text6,text11))
+ self.wait(1.7)
+ text12 = TextMobject(r"$<f(x) + g(x), h(x)>$ = $<f(x), h(x)>$ + $<g(x), h(x)>$").scale(0.465).shift(0.7*UP+4*RIGHT)
+ rect1 = Rectangle(height=0.5)
+ rect1.surround(text12)
+ self.play(ShowCreation(text12),ShowCreation(rect1))
+ self.wait(3)
+ self.play(FadeOut(text6),FadeOut(text5),FadeOut(text7),FadeOut(text9),FadeOut(text12),FadeOut(rect1),FadeOut(curve8),FadeOut(area4),FadeOut(text11),FadeOut(curve5),FadeOut(area1))
+
+ curve2.set_color(ORANGE)
+ self.play(ShowCreation(curve1),ShowCreation(text1))
+ self.wait(1)
+ self.play(ShowCreation(curve2),ShowCreation(text2))
+ self.wait(2)
+ curve9 = self.get_graph(lambda x : 2*sin(x), x_min=0,x_max=2,color=GREEN)
+ text13 = TextMobject(r"$2f(x)$").scale(0.5).shift(0.75*DOWN)
+ self.play(Transform(curve1,curve9),Transform(text1,text13))
+ self.wait(1.5)
+
+ text14 = TextMobject(r"\text{$<2f(x), g(x)>$ = ",r"\text{$\int_{0}^{2} (2f(x))g(x)$ $dx$}",r"\text{= 3.48}").scale(0.57).shift(4*RIGHT+3.5*UP)
+ text14[1].set_color(YELLOW)
+ self.play(ShowCreation(text14))
+ self.wait(2.2)
+ curve10 = self.get_graph(lambda x : 2*sin(x)*x, x_min=0,x_max=2,color=YELLOW)
+ text15 = TextMobject(r"$2f(x)\cdot g(x)$").scale(0.5).shift(0.35*RIGHT+1.03*UP)
+ area5 = self.get_area(curve10,0,2)
+ area5.set_color(YELLOW)
+ self.play(ShowCreation(area5),ShowCreation(curve10),ShowCreation(text15),FadeOut(curve1),FadeOut(text1),FadeOut(curve2),FadeOut(text2))
+ self.wait(2)
+ text16 = TextMobject(r"\text{$<f(x), g(x)>$ = ",r"\text{$\int_{0}^{2} f(x)g(x)$ $dx$}",r"\text{= 1.74}").scale(0.57).shift(3.8*RIGHT+2.9*UP)
+ text16[1].set_color(TEAL)
+ self.play(ShowCreation(text16))
+ self.wait(1.7)
+ curve11 = self.get_graph(lambda x : sin(x)*x, x_min=0,x_max=2,color=TEAL)
+ area6 = self.get_area(curve11,0,2)
+ area6.set_color(TEAL)
+ text17 = TextMobject(r"$f(x)\cdot g(x)$").scale(0.5).shift(0.4*RIGHT+0.7*DOWN)
+ self.play(ShowCreation(curve11),ShowCreation(text17),ShowCreation(area6))
+ self.wait(2)
+
+ text18 = TextMobject(r"\text{$2 <f(x), g(x)>$ = ",r"\text{$2 \int_{0}^{2} f(x)g(x)$ $dx$}",r"\text{= 3.48}").scale(0.57).shift(4*RIGHT+2.3*UP)
+ text18[1].set_color(DARK_BLUE)
+ self.play(ShowCreation(text18))
+ self.wait(2)
+ curve12 = self.get_graph(lambda x : 2*sin(x)*x, x_min=0,x_max=2,color=DARK_BLUE)
+ area7 = self.get_area(curve12,0,2)
+ area7.set_color(DARK_BLUE)
+ text19 = TextMobject(r"= $2( f(x)\cdot g(x) )$").scale(0.5).shift(1.89*RIGHT+1.03*UP)
+ self.play(ShowCreation(curve12),ShowCreation(area7),ShowCreation(text19),FadeOut(text17),FadeOut(area6),FadeOut(curve11))
+
+ self.wait(2.5)
+ text20 = TextMobject(r"$<2f(x), g(x)>$ = $2<f(x), g(x)>$").scale(0.57).shift(0.6*DOWN+4*RIGHT)
+ rect2 = Rectangle(height=0.5)
+ rect2.surround(text20)
+ self.play(ShowCreation(text20),ShowCreation(rect2))
+ self.wait(3)
+
+ self.play(FadeOut(text14),FadeOut(text15),FadeOut(text19),FadeOut(text16),FadeOut(text18),FadeOut(rect2),FadeOut(curve10),FadeOut(area5),FadeOut(curve12),FadeOut(area7),FadeOut(text20))
+ curve1 = self.get_graph(lambda x : sin(x), x_min=0,x_max=2,color=YELLOW)
+ text1 = TextMobject(r"$f(x)$").scale(0.5).shift(1.77*DOWN)
+ self.play(ShowCreation(curve1),ShowCreation(text1))
+ self.wait(1.5)
+ self.play(ShowCreation(curve2),ShowCreation(text2))
+ self.wait(1.7)
+ text21 = TextMobject(r"\text{$<f(x), g(x)>$ = ",r"\text{$\int_{0}^{2} f(x)g(x)$ $dx$}",r"\text{= 1.74}").scale(0.57).shift(3.5*RIGHT+3*UP)
+ text21[1].set_color(GREEN)
+ self.play(ShowCreation(text21))
+ self.wait(2)
+ curve13 = self.get_graph(lambda x : sin(x)*x, x_min=0,x_max=2,color=GREEN)
+ area8 = self.get_area(curve13,0,2)
+ area8.set_color(GREEN)
+ text22 = TextMobject(r"$f(x)\cdot g(x)$").scale(0.5).shift(0.32*RIGHT+0.7*DOWN)
+ self.play(ShowCreation(curve13),ShowCreation(area8),ShowCreation(text22),FadeOut(curve1),FadeOut(text1),FadeOut(curve2),FadeOut(text2))
+ self.wait(2.2)
+ curve14 = self.get_graph(lambda x : sin(x)*x, x_min=0,x_max=2,color=RED)
+ area9 = self.get_area(curve14,0,2)
+ area9.set_color(RED)
+ self.play(ShowCreation(curve14),ShowCreation(area9))
+ text23 = TextMobject(r"= $\overline{f(x)\cdot g(x)}$").scale(0.5).shift(0.7*DOWN+1.7*RIGHT)
+ self.play(ShowCreation(text23))
+ self.wait(2)
+ text24 = TextMobject(r"For all the real functions").scale(0.5).shift(2*RIGHT+2*UP)
+ text25 = TextMobject(r"$<\overline{f(x), g(x)}>$ = $<f(x), g(x)>$").scale(0.5).shift(2*RIGHT+1.4*UP)
+ rect3 = Rectangle(height=0.7)
+ rect3.surround(text25)
+ self.play(ShowCreation(text24),ShowCreation(text25),ShowCreation(rect3))
+ self.wait(3)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_product.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_product.py new file mode 100644 index 0000000..e1344f7 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_product.py @@ -0,0 +1,28 @@ +from manimlib.imports import *
+import numpy as np
+class InnerProduct(Scene):
+ def construct(self):
+ big_box=Rectangle().scale(2.7)
+ box = Rectangle(height=2,width=2,color=DARK_GREY).set_fill(color=BLUE_B,opacity=350)
+ arrow1 = Arrow(color=RED).shift(1.8*LEFT+0.5*UP)
+ arrow2 = Arrow(color=RED).shift(1.8*LEFT+0.5*DOWN)
+ arrow3 = Arrow(color=GREEN).shift(1.8*RIGHT)
+ Inner = TextMobject("INNER",color=BLACK).scale(0.65).shift(0.2*UP)
+ Product = TextMobject("PRODUCT",color=BLACK).scale(0.65).shift(0.2*DOWN)
+ u = TextMobject(r"$\vec{u}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*UP)
+ v = TextMobject(r"$\vec{v}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*DOWN)
+ scalar = TextMobject("(Scalar)").scale(0.55).shift(3.3*RIGHT+0.4*DOWN)
+ u.v = TextMobject(r"$<\vec{u}, \vec{v}>$",color=YELLOW).scale(0.7).shift(3.3*RIGHT)
+ V = TextMobject("V").scale(0.7).shift(2*UP+3.8*RIGHT)
+ text = TextMobject(r"The Inner Product is an operation that takes $\vec{u}, \vec{v} \in$ V as inputs and gives a scalar as an output.").scale(0.55).shift(2*DOWN)
+ self.play(ShowCreation(big_box),ShowCreation(V))
+ self.play(ShowCreation(box))
+ self.play(ShowCreation(Product),ShowCreation(Inner))
+ self.wait(2)
+ self.play(ShowCreation(arrow1),ShowCreation(u))
+ self.play(ShowCreation(arrow2),ShowCreation(v))
+ self.wait(1.5)
+ self.play(ShowCreation(arrow3),ShowCreation(scalar),ShowCreation(u.v))
+ self.wait(1)
+ self.play(ShowCreation(text))
+ self.wait(10)
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Instances_of_Topological_Spaces.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Instances_of_Topological_Spaces.py new file mode 100644 index 0000000..2b3cf14 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Instances_of_Topological_Spaces.py @@ -0,0 +1,36 @@ +from manimlib.imports import *
+class InnerProduct(Scene):
+ def construct(self):
+
+ circle1 = Circle(color=DARK_GREY).scale(3.7)
+ circle1.set_fill(color=GOLD,opacity=350)
+ square1 = Square(color=DARK_GREY).scale(2.5)
+ square1.set_fill(color=DARK_BLUE,opacity=350)
+ square2=Square(color=DARK_GREY).scale(1.6).shift(0.2*DOWN)
+ square2.rotate(np.pi/4).set_fill(color=YELLOW,opacity=350)
+ square3 = Square(color=DARK_GREY).scale(1).shift(0.3*DOWN)
+ square3.set_fill(color=BLACK,opacity=350)
+ circle2 = Circle(color=DARK_GREY).scale(0.5).shift(0.45*DOWN)
+ circle2.set_fill(color=MAROON_A,opacity=350)
+ text1 = TextMobject("Topological Spaces",color=BLACK).scale(0.5).shift(3*UP)
+ text2 = TextMobject("Metric Spaces",color=BLACK).scale(0.5).shift(2.2*UP)
+ text3 = TextMobject("Normed",color=BLACK).scale(0.44).shift(1.4*UP)
+ text4 = TextMobject("Vector Spaces",color=BLACK).scale(0.44).shift(1.17*UP)
+ text5 = TextMobject("Inner Product",color=WHITE).scale(0.37).shift(0.5*UP)
+ text6 = TextMobject("Spaces",color=WHITE).scale(0.37).shift(0.27*UP)
+ text7 = TextMobject("Dot",color=BLACK).scale(0.37).shift(0.3*DOWN)
+ text8 = TextMobject("Product",color=BLACK).scale(0.32).shift(0.5*DOWN)
+
+
+
+
+ self.play(ShowCreation(circle1),ShowCreation(text1))
+ self.wait(1.5)
+ self.play(ShowCreation(square1),ShowCreation(text2))
+ self.wait(1.5)
+ self.play(ShowCreation(square2),ShowCreation(text3),ShowCreation(text4))
+ self.wait(1.5)
+ self.play(ShowCreation(square3),ShowCreation(text5),ShowCreation(text6))
+ self.wait(1.5)
+ self.play(ShowCreation(circle2),ShowCreation(text7),ShowCreation(text8))
+ self.wait(4)
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Interpretation_of_Norm_as_Length.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Interpretation_of_Norm_as_Length.py new file mode 100644 index 0000000..23c568d --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Interpretation_of_Norm_as_Length.py @@ -0,0 +1,42 @@ +from manimlib.imports import *
+import numpy as np
+class Interpretation_of_norm_as_length(GraphScene):
+ CONFIG = {
+ "x_min" : 0,
+ "x_max" : 5,
+ "y_min" : 0,
+ "y_max" : 5,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "axes_color":LIGHT_GRAY,
+ "x_axis_width": 5,
+ "y_axis_height":5,
+ "graph_origin" : ORIGIN + 2*DOWN + 2*LEFT,
+ "enclude_zero_label": False
+
+ }
+ def construct(self):
+ self.setup_axes(animate=False)
+ dot = Dot().scale(0.5)
+ self.play(ShowCreation(dot))
+ origin = TextMobject(r"(0, 0)").scale(0.5).shift(2.5*LEFT+2.2*DOWN)
+ line1 = self.get_graph(lambda x : x, x_min=0,x_max=2,color=WHITE)
+ line2 = Line().rotate(np.pi/2).shift(1*DOWN)
+ text1 = TextMobject(r"$(v_1, 0)$").scale(0.5).shift(2.2*DOWN+0.2*RIGHT)
+ text2 = TextMobject(r"$(0, v_2)$").scale(0.5).shift(2.5*LEFT)
+ text3 = TextMobject(r"$(v_1, v_2)$").scale(0.5).shift(0.5*RIGHT)
+ text4 = TextMobject(r"$| v_1 |$",color=RED_B).scale(0.5).shift(1*LEFT+2.3*DOWN)
+ text5 = TextMobject(r"$| v_2 |$",color=RED_B).scale(0.5).shift(0.3*RIGHT+1*DOWN)
+ text6 = TextMobject(r"$\sqrt{{v_1}^2 + {v_2}^2}$",color=RED_B).scale(0.5).rotate(np.pi/4).shift(1.3*LEFT+1*DOWN)
+ line3 = Line(color=YELLOW).shift(1*LEFT+2*DOWN)
+ self.play(ShowCreation(line1),ShowCreation(line2),ShowCreation(text1),ShowCreation(text2),ShowCreation(text3),ShowCreation(origin))
+ self.wait(1.5)
+ self.play(ShowCreation(line3),ShowCreation(text4))
+ self.wait(1.5)
+ line2 = Line(color=YELLOW).rotate(np.pi/2).shift(1*DOWN)
+ self.play(ShowCreation(line2),ShowCreation(text5))
+ self.wait(1.5)
+ line1 = self.get_graph(lambda x : x, x_min=0,x_max=2,color=YELLOW)
+ self.play(ShowCreation(text6),ShowCreation(line1))
+ self.wait(4)
+
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Linearity_of_Inner_Product.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Linearity_of_Inner_Product.py new file mode 100644 index 0000000..e1344f7 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Linearity_of_Inner_Product.py @@ -0,0 +1,28 @@ +from manimlib.imports import *
+import numpy as np
+class InnerProduct(Scene):
+ def construct(self):
+ big_box=Rectangle().scale(2.7)
+ box = Rectangle(height=2,width=2,color=DARK_GREY).set_fill(color=BLUE_B,opacity=350)
+ arrow1 = Arrow(color=RED).shift(1.8*LEFT+0.5*UP)
+ arrow2 = Arrow(color=RED).shift(1.8*LEFT+0.5*DOWN)
+ arrow3 = Arrow(color=GREEN).shift(1.8*RIGHT)
+ Inner = TextMobject("INNER",color=BLACK).scale(0.65).shift(0.2*UP)
+ Product = TextMobject("PRODUCT",color=BLACK).scale(0.65).shift(0.2*DOWN)
+ u = TextMobject(r"$\vec{u}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*UP)
+ v = TextMobject(r"$\vec{v}$",color=YELLOW).scale(0.7).shift(2.8*LEFT+0.5*DOWN)
+ scalar = TextMobject("(Scalar)").scale(0.55).shift(3.3*RIGHT+0.4*DOWN)
+ u.v = TextMobject(r"$<\vec{u}, \vec{v}>$",color=YELLOW).scale(0.7).shift(3.3*RIGHT)
+ V = TextMobject("V").scale(0.7).shift(2*UP+3.8*RIGHT)
+ text = TextMobject(r"The Inner Product is an operation that takes $\vec{u}, \vec{v} \in$ V as inputs and gives a scalar as an output.").scale(0.55).shift(2*DOWN)
+ self.play(ShowCreation(big_box),ShowCreation(V))
+ self.play(ShowCreation(box))
+ self.play(ShowCreation(Product),ShowCreation(Inner))
+ self.wait(2)
+ self.play(ShowCreation(arrow1),ShowCreation(u))
+ self.play(ShowCreation(arrow2),ShowCreation(v))
+ self.wait(1.5)
+ self.play(ShowCreation(arrow3),ShowCreation(scalar),ShowCreation(u.v))
+ self.wait(1)
+ self.play(ShowCreation(text))
+ self.wait(10)
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Projection-in-3D-space.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Projection-in-3D-space.py new file mode 100644 index 0000000..e99202f --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Projection-in-3D-space.py @@ -0,0 +1,31 @@ +from manimlib.imports import *
+class ThreeDSpace(ThreeDScene):
+
+ def construct(self):
+ axes = ThreeDAxes()
+ axes.set_stroke(width=1,color=GOLD)
+ self.add(axes)
+ self.set_camera_orientation(phi = 70*DEGREES,theta =110*DEGREES)
+ line1 = Line(color = YELLOW,opacity=350,start = ORIGIN,end = [0.5,2,2])
+ self.play(ShowCreation(line1))
+ self.wait(1)
+ line2 = Line(color = BLUE,opacity=350,start = ORIGIN,end = [2,2,-1])
+ self.play(ShowCreation(line2))
+ self.wait(1)
+ line3 = Line(opacity=350,start=axes.c2p(0.5,2,2) ,end=axes.c2p(0.5,1.14,-0.17))
+ self.play(ShowCreation(line3))
+ self.wait(1)
+ line4 = Line(color=RED,opacity=350,start = ORIGIN,end=[0.5,1.14,-0.145])
+ self.play(ShowCreation(line4))
+ self.wait(2)
+ text1 = TextMobject(r"\text{Projection on }",r"\text{$\vec{v}$}",r"\text{ onto }",r"\text{$\vec{u}$}",r"\text{ = }",r"\text{$ |\vec{v}|cos\theta$,}").scale(0.6).shift(4*LEFT+3.5*UP)
+ text1[1].set_color(YELLOW)
+ text1[3].set_color(BLUE)
+ text1[5].set_color(RED)
+ text2 = TextMobject(r"\text{where $\theta$ is the angle between the vectors.}").scale(0.6).shift(4*LEFT+3*UP)
+ self.add_fixed_in_frame_mobjects(text1)
+ self.add_fixed_in_frame_mobjects(text2)
+ self.play(ShowCreation(text1),ShowCreation(text2))
+ self.wait(3)
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Vector_Projection.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Vector_Projection.py new file mode 100644 index 0000000..b1724c1 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Vector_Projection.py @@ -0,0 +1,43 @@ +from manimlib.imports import *
+VECTORS = [[3,1],
+ [1,3],
+ [1.96,0.65]]
+class Projection(LinearTransformationScene):
+ CONFIG = {
+ "include_background_plane": True,
+ "include_foreground_plane": False,
+ "show_coordinates": False,
+ "show_basis_vectors": False,
+ "basis_vector_stroke_width": 3,
+ }
+ def construct(self):
+ v1 = self.add_vector(VECTORS[0],color = YELLOW, stroke_width = 3.5)
+ u = TextMobject(r"$\vec{u}$",color=YELLOW).scale(0.65).shift(3.2*RIGHT,1*UP)
+ self.play(ShowCreation(u))
+ self.wait(0.7)
+ v2 = self.add_vector(VECTORS[1],color = RED, stroke_width = 3.5)
+ v = TextMobject(r"$\vec{v}$",color=RED).scale(0.65).shift(1.2*RIGHT,3*UP)
+ self.play(ShowCreation(v))
+ self.wait(0.7)
+ angle = Arc(radius=0.6).scale(0.5)
+ theta = TextMobject(r"$\theta$").scale(0.65).shift(0.5*UP+0.5*RIGHT).rotate(np.pi/6)
+ self.play(ShowCreation(angle),ShowCreation(theta))
+ self.wait(1)
+ line1 = Line().scale(1.25).rotate(np.pi/(2)).shift(1.8*UP+1.47*RIGHT)
+ line1.rotate(np.pi/8)
+ self.play(ShowCreation(line1))
+ self.wait(1.3)
+ v3 = self.add_vector(VECTORS[2],color = BLUE, stroke_width = 3.5)
+ text1 = TextMobject(r"$\vec{v}$cos$\theta$",color=BLUE).scale(0.55).shift(1.25*RIGHT+0.26*UP).rotate(np.pi/9)
+ self.play(ShowCreation(text1))
+ self.wait(2)
+ text2 = TextMobject(r"\text{Projection on }",r"\text{$\vec{v}$}",r"\text{ onto }",r"\text{$\vec{u}$}",r"\text{ = }",r"\text{$ |\vec{v}|cos\theta$}").scale(0.6).shift(4*RIGHT+3*UP)
+ text2[1].set_color(RED)
+ text2[3].set_color(YELLOW)
+ text2[5].set_color(BLUE)
+ text2.add_background_rectangle()
+ self.play(ShowCreation(text2))
+ self.wait(4)
+
+
+
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Conjugate_Symmetry_and_Positivity_of_Inner_Product.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Conjugate_Symmetry_and_Positivity_of_Inner_Product.mp4 Binary files differnew file mode 100644 index 0000000..6b44c55 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Conjugate_Symmetry_and_Positivity_of_Inner_Product.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/InnerProduct.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/InnerProduct.gif Binary files differnew file mode 100644 index 0000000..55b6546 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/InnerProduct.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Inner_Product_Space_Example.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Inner_Product_Space_Example.mp4 Binary files differnew file mode 100644 index 0000000..edecd88 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Inner_Product_Space_Example.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Instances_of_Topological_Spaces.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Instances_of_Topological_Spaces.gif Binary files differnew file mode 100644 index 0000000..82d5c75 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Instances_of_Topological_Spaces.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Interpretation_of_norm_as_length.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Interpretation_of_norm_as_length.gif Binary files differnew file mode 100644 index 0000000..9eda7c5 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Interpretation_of_norm_as_length.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Linerity_of_Inner_Product.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Linerity_of_Inner_Product.mp4 Binary files differnew file mode 100644 index 0000000..a1e7b29 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Linerity_of_Inner_Product.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection.gif Binary files differnew file mode 100644 index 0000000..c32fd6b --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection.gif diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection_of_vectors_in-3D_plane.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection_of_vectors_in-3D_plane.mp4 Binary files differnew file mode 100644 index 0000000..bdca5f9 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/gifs2/Projection_of_vectors_in-3D_plane.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Basis.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Basis.py new file mode 100644 index 0000000..6d2edc8 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Basis.py @@ -0,0 +1,174 @@ +from manimlib.imports import *
+
+
+VECTORS = [[1, 2],
+ [-4, 2],
+ [-3, -3],
+ [3,-2],
+ [3,3],
+ [-2,1],
+ [-1,-3]]
+
+class Scene1(LinearTransformationScene):
+
+ CONFIG = {
+ "include_background_plane": True,
+ "include_foreground_plane": False,
+ "show_coordinates": False,
+ "show_basis_vectors": True,
+ "basis_vector_stroke_width": 3,
+
+ }
+ def construct(self):
+ self.setup()
+ ihat, jhat = self.get_basis_vectors()
+ labels = self.get_basis_vector_labels()
+ self.add(ihat, jhat)
+ self.add(*labels)
+
+ self.show_vector_as_basis_sum()
+ self.wait(2)
+
+ def show_vector_as_basis_sum(self):
+ text1 = TextMobject(r"Vector Space $\mathbb{R}^2$}").scale(0.8).shift(3*UP)
+ text1.add_background_rectangle()
+ self.play(ShowCreation(text1))
+ text2 = TextMobject(r"$\mathbb{R}^2$",color=BLUE_E).scale(0.8).shift(6.5*LEFT+3.5*UP)
+ text3 = TextMobject(r"\text{Basis Vectors:}",r"\text{$\hat{i}$}",r"\text{,}",r"\text{$\hat{j}$}").scale(0.7).shift(2*UP+2.5*RIGHT)
+ text3[1].set_color(GREEN_C)
+ text3[3].set_color(RED_C)
+
+ self.wait(2)
+ self.play(Transform(text1,text2))
+ self.wait(1)
+ self.play(ShowCreation(text3))
+ self.wait(1.7)
+ self.play(FadeOut(text3))
+
+ for i in range(len(VECTORS)):
+ v = self.add_vector(VECTORS[i], stroke_width = 3,color=YELLOW_D)
+
+ linei = Line(start = ORIGIN, end = VECTORS[i][0]*RIGHT)
+ linei.set_color(GREEN_C)
+ linej = Line(start = linei.get_end(),
+ end = linei.get_end() + VECTORS[i][1]*UP)
+ linej.set_color(RED_C)
+ self.play(ShowCreation(linei))
+ self.play(ShowCreation(linej))
+ vlabel = self.get_vector_label(v, str(VECTORS[i][0]) +
+ r"\imath" + "+" +
+ str(VECTORS[i][1]) +
+ r"\jmath", at_tip = True)
+ self.play(ShowCreation(vlabel))
+
+ self.play(FadeOut(linei),FadeOut(linej))
+ self.wait(1)
+ dot = Dot(v.get_end(), fill_color = v.get_stroke_color())
+ self.play(ShowCreation(dot),FadeOut(v),FadeOut(vlabel))
+ self.wait(0.3)
+
+class Scene2(LinearTransformationScene):
+ CONFIG = {
+ "num_vectors" : 16,
+ "start_color" : GREY,
+ "end_color" : YELLOW_D,
+ "include_background_plane": True,
+ "include_foreground_plane": False,
+ }
+
+ def get_vectors(self):
+ return [
+ Vector([x, y], stroke_width = 3.5)
+ for x in np.arange(-int(FRAME_X_RADIUS), int(FRAME_X_RADIUS)+0.5, 0.5)
+ for y in np.arange(-int(FRAME_Y_RADIUS), int(FRAME_Y_RADIUS)+0.5, 0.5)
+ ]
+
+ def lock_in_faded_grid(self, dimness=0.7, axes_dimness=0.5):
+ plane = self.add_plane()
+ axes = plane.get_axes()
+ plane.fade(dimness)
+ axes.set_color(WHITE)
+ axes.fade(axes_dimness)
+ self.add(axes)
+
+ def construct(self):
+ self.lock_in_faded_grid()
+
+ vectors = self.get_vectors()
+ colors = Color(self.start_color).range_to(
+ self.end_color, len(vectors)
+ )
+ for vect, color in zip(vectors, colors):
+ vect.set_color(color)
+
+ vector_group = VGroup(*vectors)
+ self.play(
+ ShowCreation(
+ vector_group,
+ run_time = 3
+ )
+ )
+
+ self.wait(1)
+
+ vectors.sort(key=lambda v: v.get_length())
+ def v_to_dot(vector):
+ return Dot(vector.get_end(), fill_color = vector.get_stroke_color())
+ self.wait()
+ rate_functions = [
+ squish_rate_func(smooth, float(x)/(len(vectors)+2), 1)
+ for x in range(len(vectors))
+ ]
+ self.play(*[
+ Transform(v, v_to_dot(v), rate_func = rf, run_time = 3)
+ for v, rf in zip(vectors, rate_functions)
+ ])
+ self.wait(2)
+ self.play_final_animation(vectors, rate_functions)
+ self.wait(2)
+
+ text1 = TextMobject(" Basis is the minimum information required to ").shift(3.1*UP).scale(0.8)
+ text2 = TextMobject("generate the whole space.").scale(0.8).shift(2.6*UP)
+
+ text1.add_background_rectangle()
+ text2.add_background_rectangle()
+
+
+
+ self.play(ShowCreation(text1),ShowCreation(text2))
+
+ self.play(ShowCreation(self.get_basis_vectors()))
+ self.wait(3)
+
+ def play_final_animation(self, vectors, rate_functions):
+
+ h_line = Line(
+ FRAME_X_RADIUS*RIGHT, FRAME_X_RADIUS*LEFT,
+ stroke_width = 0.5,
+ color = BLUE_E
+ )
+ v_line = Line(
+ FRAME_Y_RADIUS*UP, FRAME_Y_RADIUS*DOWN,
+ stroke_width = 0.5,
+ color = BLUE_E
+ )
+ line_pairs = [
+ VGroup(h_line.copy().shift(y), v_line.copy().shift(x))
+ for v in vectors
+ for x, y, z in [v.get_center()]
+ ]
+ plane = NumberPlane()
+
+ self.play(
+ ShowCreation(plane),
+ *[
+ Transform(v, p, rate_func = rf)
+ for v, p, rf in zip(vectors, line_pairs, rate_functions)
+ ]
+ )
+ self.remove(*vectors)
+
+
+
+
+
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Intersection_of_Subspaces.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Intersection_of_Subspaces.py new file mode 100644 index 0000000..ec82daa --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Intersection_of_Subspaces.py @@ -0,0 +1,52 @@ +from manimlib.imports import *
+class ThreeDSpace(ThreeDScene):
+
+
+ def construct(self):
+ axes = ThreeDAxes()
+ self.set_camera_orientation(phi = 80*DEGREES,theta =110*DEGREES)
+ self.begin_ambient_camera_rotation(rate=0.09)
+
+
+
+
+ cube = Cube(stroke_width=5,color=WHITE).shift([1.5,1.5,1.5]).scale(1.5)
+ cube.set_fill(TEAL)
+
+ cube.set_opacity(0.4)
+
+
+ plane1 = Polygon([0,0,3],[3,0,3],[3,3,0],[0,3,0])
+ plane1.set_opacity(0.65)
+ plane1.set_fill(PURPLE)
+ plane1.set_color(PURPLE)
+
+
+ plane2 = Polygon([0,3,3],[3,3,3],[3,0,0],[0,0,0])
+ plane2.set_opacity(0.7)
+ plane2.set_fill(RED)
+ plane2.set_color(RED)
+ line = Line(color=YELLOW,set_opacity=100).shift([1.5,1.5,1.5]).scale(1.5)
+
+ vgroup = VGroup(plane1,plane2,line,cube)
+ vgroup.shift([-1,-1,-1])
+
+ dot = Dot(color=BLACK).shift([0.5,0.5,0.5]).scale(1)
+ text = TextMobject(r"\text{The}",r"\text{line}",r"\text{representing the intersection of the two planes is a Subspace.}",opacity = 0.6).scale(0.7).shift(3*UP)
+ text[1].set_color(YELLOW)
+ self.add_fixed_in_frame_mobjects(text)
+ self.play(ShowCreation(text))
+
+
+ self.play(ShowCreation(cube))
+ self.play(ShowCreation(plane1))
+ self.play(ShowCreation(plane2))
+
+ self.play(ShowCreation(line),ShowCreation(dot))
+
+
+ self.wait(15)
+
+
+
+
\ No newline at end of file diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Example.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Example.py deleted file mode 100644 index ada173e..0000000 --- a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Example.py +++ /dev/null @@ -1,82 +0,0 @@ -from manimlib.imports import *
-class Subspace_Example(Scene):
- def construct(self):
- sq = Square(side = 2, color=BLACK).shift(2*LEFT)
- sq.set_fill(color=RED,opacity=350)
- line1=Line(color=BLACK).shift(2*LEFT)
- line1.rotate(np.pi/2)
- line2=Line(color=BLACK).shift(2.5*LEFT+0.5*UP)
- line2.scale(0.5)
- line3=Line(color=BLACK).shift(+1.5*LEFT)
- line3.scale(0.5)
- a1=TextMobject(r"$a_1$",color=BLACK).scale(0.5).shift(3.4*LEFT+0.7*UP)
- a2=TextMobject(r"$a_2$",color=BLACK).scale(0.5).shift(3.4*LEFT+0.3*DOWN)
- a3=TextMobject(r"$a_3$",color=BLACK).scale(0.5).shift(0.7*LEFT+0.5*DOWN)
- a4=TextMobject(r"$a_4$",color=BLACK).scale(0.5).shift(0.7*LEFT+0.5*UP)
- big_rect=Rectangle().scale(3).shift(0.5*DOWN)
- big_rect.set_fill(color=GREY,opacity=350)
- vec_space=TextMobject("$Vector Space$").scale(0.77).shift(4.5*RIGHT+3.5*UP)
- sub=TextMobject(r"$Subspace$",color=BLACK).scale(0.77).shift(3.8*RIGHT+2*UP)
- self.play(ShowCreation(vec_space))
- self.play(ShowCreation(big_rect),ShowCreation(sub))
- self.play(ShowCreation(sq),ShowCreation(line1),ShowCreation(line2),ShowCreation(line3),ShowCreation(a1),ShowCreation(a2),ShowCreation(a3),ShowCreation(a4))
- rec = Rectangle(color=BLACK).scale(0.5).shift(1*RIGHT)
- rec.rotate(np.pi/2)
- rec.set_fill(color=BLUE,opacity=350)
- line4=Line(color=BLACK).shift(1*RIGHT).rotate(np.pi/2)
- line5=Line(color=BLACK).scale(0.25).shift(0.75*RIGHT)
- line6=Line(color=BLACK).scale(0.25).shift(0.5*DOWN+1.25*RIGHT)
- b1=TextMobject(r"$b_1$",color=BLACK).scale(0.5).shift(0.3*RIGHT+0.5*UP)
- b2=TextMobject(r"$b_2$",color=BLACK).scale(0.5).shift(0.3*RIGHT+0.5*DOWN)
- b3=TextMobject(r"$b_3$",color=BLACK).scale(0.5).shift(1.67*RIGHT+0.8*DOWN)
- b4=TextMobject(r"$b_4$",color=BLACK).scale(0.5).shift(1.67*RIGHT+0.5*UP)
- self.play(ShowCreation(rec),ShowCreation(line4),ShowCreation(line5),ShowCreation(line6),ShowCreation(b1),ShowCreation(b2),ShowCreation(b3),ShowCreation(b4))
- self.wait(1)
- text1=TextMobject(r"$a_1 + a_2 = a_3 + a_4$",color=BLACK).scale(0.5).shift(2*LEFT+1.5*DOWN)
- text2=TextMobject(r"$b_1 + b_2 = b_3 + b_4$",color=BLACK).scale(0.5).shift(1.5*RIGHT+1.5*DOWN)
- self.play(ShowCreation(text1),ShowCreation(text2))
- self.wait(3)
- self.play(FadeOut(text1),FadeOut(text2))
- rec.shift(3*LEFT+2.01*DOWN)
- line4.shift(3*LEFT+2*DOWN)
- line5.shift(3*LEFT+2*DOWN)
- line6.shift(3*LEFT+2*DOWN)
- b1.shift(3.1*LEFT+2.1*DOWN)
- b2.shift(3.1*LEFT+2.1*DOWN)
- b3.shift(2.9*LEFT+2*DOWN)
- b4.shift(2.9*LEFT+2.3*DOWN)
- self.play(ShowCreation(rec),ShowCreation(line4),ShowCreation(line5),ShowCreation(line6),ShowCreation(b1),ShowCreation(b2),ShowCreation(b3),ShowCreation(b4))
- self.wait(2)
-
- text3=TextMobject(r"$(a_1 + a_2) + (b_1 + b_2) = (a_3 + a_4) + (b_3 + b_4)$",color=BLACK).scale(0.5).shift(2.5*RIGHT+0.5*DOWN)
- text3=TextMobject(r"$(a_1 + a_2) + (b_1 + b_2) = (a_3 + a_4) + (b_3 + b_4)$",color=BLACK).scale(0.5).shift(2.5*RIGHT+0.5*DOWN)
- text4=TextMobject("Vector Addition",color=BLACK).scale(0.8).shift(2.5*RIGHT+0.5*UP)
- self.play(ShowCreation(text3),ShowCreation(text4))
- self.wait(3)
- rec.set_fill(color=GREY,opacity=350)
- self.play(FadeOut(text3),FadeOut(text4),FadeOut(line4),FadeOut(line5),FadeOut(line6),FadeOut(rec),FadeOut(b4),FadeOut(b3),FadeOut(b2),FadeOut(b1))
- sq1=Square(color=BLACK).scale(0.5).shift(1.5*LEFT+1.5*UP)
- sq1.set_fill(color=RED,opacity=350)
- sq2=Square(color=BLACK).scale(0.5).shift(1.5*LEFT+1.5*DOWN)
- sq2.set_fill(color=RED,opacity=350)
- rec1=Rectangle(height=0.5,width=1,color=BLACK).shift(2.5*LEFT+1.2*UP)
- rec1.set_fill(color=RED,opacity=350)
- rec2=Rectangle(height=1.5,width=1,color=BLACK)
- rec2.set_fill(color=RED,opacity=350).shift(2.5*LEFT+1.5*DOWN)
- self.play(ShowCreation(sq1),ShowCreation(sq2),ShowCreation(rec1),ShowCreation(rec2))
- a=TextMobject(r"$a_1$",color=BLACK).scale(0.5).shift(3.4*LEFT+1.2*UP)
- b=TextMobject(r"$a_2$",color=BLACK).scale(0.5).shift(3.4*LEFT+1.4*DOWN)
- c=TextMobject(r"$a_3$",color=BLACK).scale(0.5).shift(0.7*LEFT+1.4*DOWN)
- d=TextMobject(r"$a_4$",color=BLACK).scale(0.5).shift(0.7*LEFT+1.4*UP)
- self.play(ShowCreation(a),ShowCreation(b),ShowCreation(c),ShowCreation(d))
- self.wait(2.3)
- text4=TextMobject("Scalar Multiplication",color=BLACK).scale(0.8).shift(2.5*RIGHT+0.5*UP)
- text5=TextMobject(r"$\implies 2(a_1 + a_2) = 2(a_3 + a_4)$",color=BLACK).scale(0.5).shift(2*RIGHT+0.5*DOWN)
- text6=TextMobject(r"$(a_1 + a_1) + (a_2 + a_2) = (a_3 + a_3) + (a_4 +a_4)$",color=BLACK).scale(0.5).shift(2.5*RIGHT)
- self.play(ShowCreation(text4),ShowCreation(text5),ShowCreation(text6))
- self.wait(3)
-
-
-
-
-
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Non_Example.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Non_Example.py new file mode 100644 index 0000000..115a722 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Non_Example.py @@ -0,0 +1,25 @@ +from manimlib.imports import *
+class ThreeDSpace(ThreeDScene):
+
+
+ def construct(self):
+ axes = ThreeDAxes()
+ self.add(axes)
+ self.set_camera_orientation(phi = 80*DEGREES,theta =110*DEGREES)
+ self.begin_ambient_camera_rotation(rate=0.09)
+ plane1 = Polygon([-1.5,1.5,-1.5],[1.5,1.5,-1.5],[1.5,-1.5,1.5],[-1.5,-1.5,1.5])
+ plane1.set_opacity(0.65)
+ plane1.set_fill(GREEN)
+ plane1.set_color(GREEN)
+
+
+ plane2 = Polygon([-1.5,1.5,1.5],[1.5,1.5,1.5],[1.5,-1.5,-1.5],[-1.5,-1.5,-1.5])
+ plane2.set_opacity(0.7)
+ plane2.set_fill(MAROON_A)
+ plane2.set_color(MAROON_A)
+ line = Line(color=YELLOW,set_opacity=100,start=[1.5,1.2,1.2],end=[-1.5,1.2,1.2])
+
+
+ self.play(ShowCreation(plane1),ShowCreation(plane2),ShowCreation(line))
+ self.wait(10)
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_of_a_Subspace.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_of_a_Subspace.mp4 Binary files differnew file mode 100644 index 0000000..d384f80 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_of_a_Subspace.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Intersection_of_Subspaces.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Intersection_of_Subspaces.mp4 Binary files differnew file mode 100644 index 0000000..d43bfbe --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Intersection_of_Subspaces.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Example.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Example.gif Binary files differdeleted file mode 100644 index 32b02be..0000000 --- a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Example.gif +++ /dev/null diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Non_Example.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Non_Example.mp4 Binary files differnew file mode 100644 index 0000000..390f4cf --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Non_Example.mp4 diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scalar_Multiplication.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scalar_Multiplication.py new file mode 100644 index 0000000..12c9bce --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scalar_Multiplication.py @@ -0,0 +1,177 @@ +from manimlib.imports import *
+VECTORS = [[1, 2],
+ [1, 1],
+ [2, 2],
+ [3, 4]]
+class Scene1(LinearTransformationScene):
+ CONFIG = {
+ "include_background_plane": True,
+ "include_foreground_plane": False,
+ "show_coordinates": True,
+ "show_basis_vectors": False,
+ "basis_vector_stroke_width": 3,
+ }
+ def construct(self):
+ self.write_stuff()
+ v1 = self.add_vector(VECTORS[0],color = YELLOW, stroke_width = 3.5)
+ line1 = Line(start = ORIGIN, end = VECTORS[0][0]*RIGHT)
+ line1.set_color(RED_B)
+ line2 = Line(start = line1.get_end(), end = line1.get_end() + VECTORS[0][1]*UP)
+ line2.set_color(GREEN_D)
+ self.play(ShowCreation(line1))
+ self.play(ShowCreation(line2))
+ self.wait(0.5)
+ text1 = TextMobject("(1, 2)",color=YELLOW).scale(0.6).shift(2*UP + 1.5*RIGHT)
+ self.play(ShowCreation(text1))
+ text2 = TextMobject(r"$\vec{a}$",color = YELLOW).scale(0.8).shift(2*UP + 1.2*RIGHT)
+ text3 = TextMobject(r"\text{$\vec{a}$}",r"\text{=}",r"\text{(1, 2)}").scale(0.7).shift(5.1*LEFT + 2.5*UP)
+ text3[0].set_color(YELLOW)
+ text3[2].set_color(YELLOW)
+ self.wait(1)
+ self.play(Transform(text1,text2),FadeOut(line1),FadeOut(line2))
+ self.wait(0.5)
+ self.play(ShowCreation(text3))
+ self.wait(1)
+
+
+ v2 = self.add_vector(VECTORS[1],color = BLUE, stroke_width = 3.5)
+ line3 = Line(start = ORIGIN, end = VECTORS[1][0]*RIGHT)
+ line3.set_color(RED_B)
+ line4 = Line(start = line3.get_end(), end = line3.get_end() + VECTORS[1][1]*UP)
+ line4.set_color(GREEN_D)
+ self.play(ShowCreation(line3))
+ self.play(ShowCreation(line4))
+ self.wait(0.5)
+ text4 = TextMobject("(2, 2)",color=BLUE).scale(0.6).shift(1*UP + 1.5*RIGHT)
+ self.play(ShowCreation(text4))
+ text5 = TextMobject(r"$\vec{b}$",color = BLUE).scale(0.8).shift(1*UP + 1.2*RIGHT)
+ text6 = TextMobject(r"\text{$\vec{b}$}",r"\text{=}",r"\text{(1, 1)}").scale(0.7).shift(5.1*LEFT + 1.8*UP)
+ text6[0].set_color(BLUE)
+ text6[2].set_color(BLUE)
+ self.wait(1)
+ self.play(Transform(text4,text5),FadeOut(line3),FadeOut(line4))
+ self.wait(0.5)
+ self.play(ShowCreation(text6))
+ self.wait(2)
+
+
+
+ text7 = TextMobject(r"\text{Scaling}",r"\text{ $\vec{b}$ }",r"\text{by 2 units}",color = GOLD).scale(0.7).shift(2.8*UP+4*RIGHT)
+ text7[1].set_color(BLUE)
+ self.play(ShowCreation(text7))
+ self.play(FadeOut(text4))
+ v3 = self.add_vector(VECTORS[2],color = BLUE, stroke_width = 3.5)
+ line7 = Line(start = ORIGIN, end = VECTORS[2][0]*RIGHT)
+ line7.set_color(RED_B)
+ line8 = Line(start = line7.get_end(), end = line7.get_end() + VECTORS[2][1]*UP)
+ line8.set_color(GREEN_D)
+ self.play(FadeOut(v2))
+ self.play(ShowCreation(line7))
+ self.play(ShowCreation(line8))
+
+
+ self.wait(0.5)
+
+ text8 = TextMobject("(2, 2)",color=BLUE).scale(0.6).shift(2.5*RIGHT + 2*UP)
+ text9 = TextMobject(r"$2\vec{b}$",color = BLUE).scale(0.8).shift(2*UP + 2.3*RIGHT)
+ self.play(ShowCreation(text8))
+ self.wait(1)
+ self.play(Transform(text8,text9),FadeOut(line7),FadeOut(line8))
+ self.wait(1)
+ text10 = TextMobject(r"\text{$2\vec{b}$}",r"\text{=}",r"\text{(2, 2)}").scale(0.7).shift(5.1*LEFT + 1.8*UP)
+ text10[0].set_color(BLUE)
+ text10[2].set_color(BLUE)
+ self.play(Transform(text6,text10))
+ self.wait(1)
+ self.play(FadeOut(text7))
+ self.wait(1.5)
+
+
+
+ text11 = TextMobject(r"Addition of vectors",color = GOLD).scale(0.7).shift(2.8*UP+5*RIGHT)
+ self.play(ShowCreation(text11))
+ v1.move_to(3*UP+2.5*RIGHT)
+ self.play(ShowCreation(v1),FadeOut(text8),FadeOut(text1))
+ v4 = self.add_vector(VECTORS[3],color = ORANGE, stroke_width = 3.5)
+ line7 = Line(start = ORIGIN, end = VECTORS[3][0]*RIGHT)
+ line7.set_color(RED_B)
+ line8 = Line(start = line7.get_end(), end = line7.get_end() + VECTORS[3][1]*UP)
+ line8.set_color(GREEN_D)
+ self.play(ShowCreation(line7))
+ self.play(ShowCreation(line8))
+ text12 = TextMobject("(3, 4)",color=ORANGE).scale(0.6).shift(3.5*RIGHT + 3.8*UP)
+ text13 = TextMobject(r"$\vec{c}$",color = ORANGE).scale(0.8).shift(3.7*UP + 3.3*RIGHT)
+ self.play(ShowCreation(text12))
+ self.wait(1)
+ self.play(Transform(text12,text13),FadeOut(line7),FadeOut(line8))
+ self.wait(1)
+ add = TextMobject("+").scale(0.8).shift(6.2*LEFT + 1.8*UP)
+ line_1= Line().shift(1.5*UP+5.1*LEFT).scale(1.5)
+ line_2= Line().shift(0.8*UP+5.1*LEFT).scale(1.5)
+
+ text14=TextMobject(r"\text{$\vec{c}$}",r"\text{=}",r"\text{$\vec{a}$}",r"\text{+}",r"\text{$2\vec{b}$}",r"\text{=}",r"\text{(3, 4)}").scale(0.7).shift(1.2*UP+5.1*LEFT)
+ text14[0].set_color(ORANGE)
+ text14[2].set_color(YELLOW)
+ text14[4].set_color(BLUE)
+ text14[6].set_color(ORANGE)
+
+
+ self.play(ShowCreation(add),ShowCreation(line_1))
+ self.play(ShowCreation(text14),ShowCreation(line_2))
+ self.wait(3)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def write_stuff(self):
+ self.text = []
+ text = self.text
+
+ text.append(TexMobject(r"\text{Consider the Vector Space }",
+ r"{\mathbb{R}^2}"))
+ self.add_title(text[0], 0.7, animate = True)
+ text.append(TexMobject(r"{\mathbb{R}^2}",
+ tex_to_color_map = {r"{\mathbb{R}^2}": BLUE_E}))
+ text[1].shift(6.5*LEFT+3.5*UP)
+ self.wait(0.5)
+ self.play(Transform(text[0], text[1]))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scaling.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scaling.py deleted file mode 100644 index 70af123..0000000 --- a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/Vector_Addition_and_Scaling.py +++ /dev/null @@ -1,137 +0,0 @@ -from manimlib.imports import *
-import numpy as np
-
-class vectorspace(GraphScene):
- CONFIG={
- "x_min": -7,
- "x_max": 7,
- "y_min": -7,
- "y_max": 7,
- "graph_origin": ORIGIN,
- "x_axis_label":"$X$",
- "y_axis_label":"$Y$",
- "x_labeled_nums": list(np.arange(-7, 8,1)),
- "y_labeled_nums": list(np.arange(-7, 8,1)),
- "x_axis_width": 8,
- "y_axis_height": 7,
- "x_tick_frequency":1,
- "axes_color": GREY,
- "area_opacity": 3,
- "num_rects": 10,
- }
- def construct(self):
- XD = self.x_axis_width/(self.x_max- self.x_min)
- YD = self.y_axis_height/(self.y_max- self.y_min)
- a1=1*XD*RIGHT+2*YD*UP
- a2=1*XD*RIGHT+1*YD*UP
- vec1=Vector(direction=a1).set_color(RED_E)
- vec1.shift(self.graph_origin)
- vec2=Vector(direction=a2).set_color(YELLOW_E)
- vec2.shift(self.graph_origin)
- vec1_text=TextMobject(r"$\vec{a}$")
- vec2_text=TextMobject(r"$\vec{b}$")
- vec1_text=(vec1_text.shift(self.graph_origin+a1+0.2)).scale(.7)
- vec2_text=(vec2_text.shift(self.graph_origin+a2+0.2)).scale(.7)
- self.setup_axes(animate=True)
- self.wait(2)
- self.play(ShowCreation(vec1))
- self.play(ShowCreation(vec1_text))
- self.wait(.7)
- self.play(ShowCreation(vec2))
- self.play(ShowCreation(vec2_text))
- self.wait(.7)
- a=TextMobject(r"$\vec{a} = (1,2)$",color=RED_B).scale(.6)
- a.shift(3*LEFT+2.7*UP)
- b=TextMobject(r"$\vec{b} = (1,1)$",color=YELLOW_E).scale(.6)
- b.shift(3*LEFT+2*UP)
- self.play(ShowCreation(a))
- self.play(ShowCreation(b))
- self.wait(.5)
- c=TextMobject(r"$2\cdot\vec{a} = 2\cdot(1,2) = (2,4)$",color=RED_B)
- c.shift(3*LEFT+2.7*UP)
- c.scale(.6)
- self.play(Transform(a,c))
- scaling1=TextMobject(r"Scaling vector $\vec{a}$ by 2 units",color=GOLD).scale(.5)
- scaling1.shift(3.4*RIGHT+2.4*UP)
- self.play(ShowCreation(scaling1))
- a1=2*XD*RIGHT+4*YD*UP
- self.play(FadeOut(vec1_text))
- vec1_scaled=Vector(direction=a1).set_color(RED_E)
- vec1_scaled.shift(self.graph_origin)
- self.play(ShowCreation(vec1_scaled))
- self.play(FadeOut(vec1))
- vec1_scaled_text=TextMobject(r"$2\vec{a}$").scale(.7)
- vec1_scaled_text.shift(self.graph_origin+a1+0.2)
- self.play(ShowCreation(vec1_scaled_text))
- self.play(FadeOut(scaling1))
- d=TextMobject(r"$3\cdot\vec{b} = 3\cdot(1,1) = (3,3)$",color=YELLOW_E).scale(.6)
- d.shift(3*LEFT+2*UP)
- self.play(Transform(b,d))
- scaling2=TextMobject(r"Scaling vector $\vec{b}$ by 3 units",color=GOLD).scale(.5)
- scaling2.shift(3.4*RIGHT+2.4*UP)
- self.play(ShowCreation(scaling2))
- a2=3*XD*RIGHT+3*YD*UP
- self.play(FadeOut(vec2_text))
- vec2_2=Vector
- vec2_scaled=Vector(direction=a2).set_color(YELLOW_E)
- vec2_scaled.shift(self.graph_origin)
- self.play(ShowCreation(vec2_scaled))
- self.play(FadeOut(vec2))
- vec2_scaled_text=TextMobject(r"$3\vec{b}$").scale(.7)
- vec2_scaled_text.shift(self.graph_origin+a2+0.2)
- self.play(ShowCreation(vec2_scaled_text))
- self.wait(.7)
- self.play(FadeOut(scaling2))
- add = TextMobject("+").scale(.7)
- add.shift(4.8*LEFT+2*UP)
- self.play(ShowCreation(add))
- self.wait(.5)
- line = Line()
- line.shift(3*LEFT+1.6*UP)
- line.scale(1.8)
- self.play(ShowCreation(line))
- self.wait(1)
- e = TextMobject(r"$\vec{c} = 2\cdot\vec{a} + 3\cdot\vec{b} = (5,7)$",color=GREEN_D).scale(.6)
- e.shift(3*LEFT+1.3*UP)
- self.play(ShowCreation(e))
- self.wait(.5)
- add1=TextMobject("Addition of the scaled vectors",color=GOLD).scale(.5)
- add1.shift(4.1*RIGHT+2.4*UP)
- self.play(ShowCreation(add1))
- self.wait(.5)
- self.play(FadeOut(vec1_scaled_text))
- self.play(FadeOut(vec2_scaled_text))
- self.play(FadeOut(vec1_scaled))
- vec1_scaled2=Vector(direction=a1).set_color(RED_E)
- vec1_scaled2.shift(self.graph_origin+3*RIGHT*XD+3*UP*YD)
- self.play(ShowCreation(vec1_scaled2))
- a3=5*XD*RIGHT+7*YD*UP
- vec3=Vector(direction=a3).set_color(GREEN_C)
- vec3.shift(self.graph_origin)
- vec3_text=TextMobject(r"$\vec{c}$").scale(.7)
- vec3_text.shift(self.graph_origin+a3+0.2)
- self.play(ShowCreation(vec3))
- self.wait(.5)
- self.play(ShowCreation(vec3_text))
- self.wait(1)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.gif Binary files differdeleted file mode 100644 index ed65f8a..0000000 --- a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.gif +++ /dev/null diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.mp4 Binary files differnew file mode 100644 index 0000000..8acbb81 --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Vector-Spaces/gifs/Vector_Addition_and_Scalar_Multiplication.mp4 |