summaryrefslogtreecommitdiff
path: root/FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py
diff options
context:
space:
mode:
authorPurusharth Saxena2020-07-09 23:50:00 +0530
committerGitHub2020-07-09 23:50:00 +0530
commit6f1144709dac5bef832b5039cad6852fe3f4d832 (patch)
tree3ca8df9bb643b2fd1f090b674f09ee227a99b049 /FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py
parent02503a96d86a6304977d6791de17913d391dcb98 (diff)
parentd55ea3bd90b05ab4ba731d822f347bcdbea67159 (diff)
downloadFSF-mathematics-python-code-archive-6f1144709dac5bef832b5039cad6852fe3f4d832.tar.gz
FSF-mathematics-python-code-archive-6f1144709dac5bef832b5039cad6852fe3f4d832.tar.bz2
FSF-mathematics-python-code-archive-6f1144709dac5bef832b5039cad6852fe3f4d832.zip
Merge pull request #54 from architsangal/master
README.md files updated and gif(s) are added
Diffstat (limited to 'FSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py')
-rwxr-xr-xFSF-2020/linear-algebra/linear-transformations/Gram-Schmidt-Orthonormalization-Process/file2_projections.py79
1 files changed, 79 insertions, 0 deletions
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