From 75b6e721aecb4aea903b560f4c584f751b269155 Mon Sep 17 00:00:00 2001 From: simranchhattani Date: Sat, 20 Jun 2020 21:56:47 +0530 Subject: Add files via upload --- ...ate_Symmetry_and_Positivity_of_Inner_Product.py | 141 +++++++++++++++++ .../Inner_Product_Space_Example.py | 175 +++++++++++++++++++++ .../Inner-Product_Spaces/Inner_product.py | 28 ++++ .../Instances_of_Topological_Spaces.py | 36 +++++ .../Interpretation_of_Norm_as_Length.py | 42 +++++ .../Linearity_of_Inner_Product.py | 28 ++++ .../Inner-Product_Spaces/Vector_Projection.py | 43 +++++ 7 files changed, 493 insertions(+) create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Conjugate_Symmetry_and_Positivity_of_Inner_Product.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Space_Example.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_product.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Instances_of_Topological_Spaces.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Interpretation_of_Norm_as_Length.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Linearity_of_Inner_Product.py create mode 100644 FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Vector_Projection.py 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{$$}",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{$$}",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{$$").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{$$}",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"$$",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{$$}",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"$$",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_Space_Example.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Space_Example.py new file mode 100644 index 0000000..1f98bad --- /dev/null +++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Inner-Product_Spaces/Inner_Product_Space_Example.py @@ -0,0 +1,175 @@ +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) + curve1 = self.get_graph(lambda x : sin(x), x_min=0,x_max=2.3,color=RED) + curve2 = self.get_graph(lambda x : x, x_min=0,x_max=2.3,color=DARK_BLUE) + curve3 = self.get_graph(lambda x : 1.4, x_min=0,x_max=2.3,color=GREEN) + text1 = TextMobject(r"$f(x)$").scale(0.5).shift(1.77*DOWN+0.55*RIGHT) + + text2 = TextMobject(r"$g(x)$").scale(0.5).shift(0.15*DOWN+0.55*RIGHT) + text3 = TextMobject(r"$h(x)$").scale(0.5).shift(1.03*DOWN+0.55*RIGHT) + + self.play(ShowCreation(curve1),ShowCreation(text1)) + self.wait(1) + self.play(ShowCreation(curve2),ShowCreation(text2)) + self.wait(1) + self.play(ShowCreation(curve3),ShowCreation(text3)) + self.wait(2) + curve4 = self.get_graph(lambda x : sin(x) + x, x_min=0,x_max=2.3,color=YELLOW) + text4 = TextMobject(r"$f(x) + g(x)$").scale(0.5).shift(0.6*UP+1*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{$$ = ",r"\text{$\int_{a}^{b} (f(x) + g(x))h(x)$ $dx$}").scale(0.57).shift(4*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.3,color=ORANGE) + text6 = TextMobject(r"$(f(x) + g(x))\cdot h(x)$").scale(0.5).shift(2.2*UP+1.4*RIGHT) + area1 = self.get_area(curve5,0,2.3) + 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{$$ = ",r"\text{$\int_{a}^{b} (f(x)h(x)$ $dx$}").scale(0.57).shift(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.3,color=BLUE) + text8 = TextMobject(r"$f(x)\cdot h(x)$").scale(0.5).shift(1.4*DOWN+0.8*RIGHT) + area2 = self.get_area(curve6,0,2.3) + self.play(ShowCreation(curve6),ShowCreation(text8),ShowCreation(area2)) + self.wait(1.5) + text9 = TextMobject(r"\text{$$ = ",r"\text{$\int_{a}^{b} (g(x)h(x)$ $dx$}").scale(0.57).shift(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.3,color=MAROON_B) + text10 = TextMobject(r"$g(x)\cdot h(x)$").scale(0.5).shift(0.8*RIGHT+1*UP) + area3 = self.get_area(curve7,0,2.3) + 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.3,color=RED_C) + area4 = self.get_area(curve8,0,2.3) + area4.set_color(RED_C) + text11 = TextMobject(r"$f(x)h(x) + g(x)h(x)$").scale(0.5).shift(2.2*UP + 1.4*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"$$ = $$ + $$").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.3,color=GREEN) + text13 = TextMobject(r"$2f(x)$").scale(0.5).shift(1.1*DOWN+0.55*RIGHT) + self.play(Transform(curve1,curve9),Transform(text1,text13)) + self.wait(1.5) + + text14 = TextMobject(r"\text{$<2f(x), g(x)>$ = ",r"\text{$\int_{a}^{b} (2f(x))g(x)$ $dx$}").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.3,color=YELLOW) + text15 = TextMobject(r"$2f(x)\cdot g(x)$").scale(0.5).shift(1*RIGHT+0.97*UP) + area5 = self.get_area(curve10,0,2.3) + 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{$$ = ",r"\text{$\int_{a}^{b} f(x)g(x)$ $dx$}").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.3,color=TEAL) + area6 = self.get_area(curve11,0,2.3) + area6.set_color(TEAL) + text17 = TextMobject(r"$f(x)\cdot g(x)$").scale(0.5).shift(0.9*RIGHT+0.7*DOWN) + self.play(ShowCreation(curve11),ShowCreation(text17),ShowCreation(area6)) + self.wait(2) + + text18 = TextMobject(r"\text{$2 $ = ",r"\text{$2 \int_{a}^{b} f(x)g(x)$ $dx$}").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.3,color=DARK_BLUE) + area7 = self.get_area(curve12,0,2.3) + area7.set_color(DARK_BLUE) + text19 = TextMobject(r"= $2( f(x)\cdot g(x) )$").scale(0.5).shift(2.5*RIGHT+0.97*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$").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.3,color=YELLOW) + text1 = TextMobject(r"$f(x)$").scale(0.5).shift(1.77*DOWN+0.55*RIGHT) + self.play(ShowCreation(curve1),ShowCreation(text1)) + self.wait(1.5) + self.play(ShowCreation(curve2),ShowCreation(text2)) + self.wait(1.7) + text21 = TextMobject(r"\text{$$ = ",r"\text{$\int_{a}^{b} f(x)g(x)$ $dx$}").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.3,color=GREEN) + area8 = self.get_area(curve13,0,2.3) + area8.set_color(GREEN) + text22 = TextMobject(r"$f(x)\cdot g(x)$").scale(0.5).shift(0.8*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.3,color=RED) + area9 = self.get_area(curve14,0,2.3) + 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+2.1*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)}>$ = $$").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/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 -- cgit