summaryrefslogtreecommitdiff
path: root/FSF-2020/linear-algebra/vector-spaces
diff options
context:
space:
mode:
authorsimranchhattani2020-05-27 19:03:05 +0530
committerGitHub2020-05-27 19:03:05 +0530
commitc905171679fa8ef186f4594f6713e0b887f730d5 (patch)
treea7db5fb18cbbfbb1d2d3596deb0d819336ee2136 /FSF-2020/linear-algebra/vector-spaces
parent730cd6af1e4478d9ebf9051e06abdc4d318f72d6 (diff)
downloadFSF-mathematics-python-code-archive-c905171679fa8ef186f4594f6713e0b887f730d5.tar.gz
FSF-mathematics-python-code-archive-c905171679fa8ef186f4594f6713e0b887f730d5.tar.bz2
FSF-mathematics-python-code-archive-c905171679fa8ef186f4594f6713e0b887f730d5.zip
Add files via upload
Diffstat (limited to 'FSF-2020/linear-algebra/vector-spaces')
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Straight_Line_through_Origin.py48
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Example.py82
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Unit_Circle.py68
3 files changed, 198 insertions, 0 deletions
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Straight_Line_through_Origin.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Straight_Line_through_Origin.py
new file mode 100644
index 0000000..5790d2e
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Straight_Line_through_Origin.py
@@ -0,0 +1,48 @@
+from manimlib.imports import *
+from scipy import exp, sin, log,tan,cos
+class Straight_Line(GraphScene):
+ CONFIG = {
+ "x_min" : -4,
+ "x_max" : 4,
+ "y_min" : -4,
+ "y_max" : 4,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "x_labeled_nums" : list(np.arange(-4,5,1)),
+ "y_labeled_nums" : list(np.arange(-4,5,1)),
+ "graph_origin" : ORIGIN+0.7*DOWN,
+ "axes_color" : GREY,
+ "x_axis_width": 6,
+ "y_axis_height":6,
+ }
+ def construct(self):
+ self.setup_axes(animate=True)
+ line_1 = self.get_graph(lambda x : x, x_min=-3,x_max=3,color=YELLOW)
+ self.play(ShowCreation(line_1))
+ text1 = TextMobject("ax + by = 0",color=BLUE_B)
+ text1.shift(3*RIGHT+2*UP)
+ text1.scale(0.65)
+ dot = Dot(color=BLUE_B).shift(0.7*DOWN)
+ dot.scale(1.3)
+ self.play(ShowCreation(dot))
+ text2 = TextMobject("Line passing through the origin")
+ text2.scale(0.7)
+ text2.shift(3.5*UP)
+ self.play(ShowCreation(text1),ShowCreation(text2))
+ self.wait(1)
+ self.play(FadeOut(line_1),FadeOut(text2),FadeOut(text1))
+ text4=TextMobject("Line not passing through the origin")
+ text4.scale(0.7)
+ text4.shift(3.5*UP)
+ self.play(ShowCreation(text4))
+
+ line_2 = self.get_graph(lambda x : 2.5*x +1, x_min = -2, x_max=1, color = RED)
+ text3 = TextMobject(r"ax + by $\neq 0$",color=BLUE_B)
+ text3.scale(0.65)
+ self.play(ShowCreation(line_2))
+ text3.shift(1.5*RIGHT+2.2*UP)
+ self.play(ShowCreation(text3))
+ self.wait(1)
+
+
+ \ 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
new file mode 100644
index 0000000..ada173e
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Subspace_Example.py
@@ -0,0 +1,82 @@
+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/Unit_Circle.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Unit_Circle.py
new file mode 100644
index 0000000..2973f08
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Unit_Circle.py
@@ -0,0 +1,68 @@
+from manimlib.imports import *
+import numpy as np
+import math
+
+class Unit_Circle(GraphScene):
+ CONFIG = {
+ "x_min" : -3,
+ "x_max" : 3,
+ "y_min" : -3,
+ "y_max" : 3,
+ "y_tick_frequency" : 1,
+ "x_tick_frequency" : 1,
+ "x_labeled_nums" : list(np.arange(-3,4,1)),
+ "y_labeled_nums" : list(np.arange(-3,4,1)),
+ "graph_origin" : ORIGIN,
+ "axes_color" : GREY,
+ "x_axis_width": 6,
+ "y_axis_height":6,
+ }
+
+ def construct(self):
+ self.setup_axes(animate = True)
+ circle = Circle(radius=1,color=BLUE)
+ self.play(ShowCreation(circle))
+ dot1 = Dot(color=RED).scale(0.7)
+ dot1.shift(1*UP)
+ dot2 = Dot(color=RED).scale(0.7)
+ dot2.shift(1*LEFT)
+ dot3 = Dot(color=RED).scale(0.7)
+ dot3.shift(1*DOWN)
+ dot4 = Dot(color=RED).scale(0.7)
+ dot4.shift(1*RIGHT)
+ dot5= Dot(color=RED).scale(0.7)
+ dot6 = Dot(color=RED).scale(0.7)
+ dot5.shift(0.5*RIGHT+(math.sqrt(3)/2)*UP)
+ dot6.shift(0.5*LEFT+(math.sqrt(3)/2)*DOWN)
+ dot7 = Dot(color=RED).scale(0.7)
+ dot7.shift(math.sqrt(2)/2*RIGHT+math.sqrt(2)/2*UP)
+ dot8 = Dot(color=RED).scale(0.7)
+ dot8.shift(math.sqrt(2)/2*LEFT+math.sqrt(2)/2*UP)
+ dot9 = Dot(color=RED).scale(0.7)
+ dot9.shift(0.5*LEFT+(math.sqrt(3)/2)*UP)
+ dot10 = Dot(color=RED).scale(0.7)
+ dot10.shift(math.sqrt(3)/2*LEFT+0.5*UP)
+ dot11=Dot(color=RED).scale(0.7)
+ dot11.shift(math.sqrt(3)/2*RIGHT+0.5*UP)
+ dot12= Dot(color=RED).scale(0.7)
+ dot12.shift(math.sqrt(3)/2*LEFT+0.5*DOWN)
+ dot13=Dot(color=RED).scale(0.7)
+ dot13.shift(math.sqrt(2)/2*RIGHT+math.sqrt(2)/2*DOWN)
+ dot14=Dot(color=RED).scale(0.7)
+ dot14.shift(math.sqrt(2)/2*LEFT+math.sqrt(2)/2*DOWN)
+ dot15=Dot(color=RED).scale(0.7)
+ dot15.shift(math.sqrt(3)/2*RIGHT+0.5*DOWN)
+ dot16=Dot(color=RED).scale(0.7)
+ dot16.shift(0.5*RIGHT+(math.sqrt(3)/2)*DOWN)
+ self.play(ShowCreation(dot1),ShowCreation(dot2))
+ self.play(ShowCreation(dot3),ShowCreation(dot4))
+ self.play(ShowCreation(dot5),ShowCreation(dot6))
+ self.play(ShowCreation(dot7),ShowCreation(dot8))
+ self.play(ShowCreation(dot9),ShowCreation(dot10))
+ self.play(ShowCreation(dot11),ShowCreation(dot12))
+ self.play(ShowCreation(dot13),ShowCreation(dot14))
+ self.play(ShowCreation(dot15),ShowCreation(dot16))
+ self.wait(4)
+
+
+