summaryrefslogtreecommitdiff
path: root/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces')
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Basis.py174
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Intersection_of_Subspaces.py52
-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_Non_Example.py25
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/Unit_Circle.py68
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_generating_the_whole_2D_space.mp4bin0 -> 10252339 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Intersection_of_Subspaces.mp4bin0 -> 1112086 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Linear-Dependence-and-Independence.mp4bin0 -> 12080022 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Straight_Line_Through_Origin.gifbin0 -> 314823 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Non_Example.mp4bin0 -> 818876 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Unit_Circle.gifbin0 -> 149852 bytes
-rw-r--r--FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/linear_dependence_and_independence.py293
12 files changed, 660 insertions, 0 deletions
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/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_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/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)
+
+
+
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_generating_the_whole_2D_space.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_generating_the_whole_2D_space.mp4
new file mode 100644
index 0000000..9a43846
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Basis_generating_the_whole_2D_space.mp4
Binary files differ
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
new file mode 100644
index 0000000..d43bfbe
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Intersection_of_Subspaces.mp4
Binary files differ
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Linear-Dependence-and-Independence.mp4 b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Linear-Dependence-and-Independence.mp4
new file mode 100644
index 0000000..c44801f
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Linear-Dependence-and-Independence.mp4
Binary files differ
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Straight_Line_Through_Origin.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Straight_Line_Through_Origin.gif
new file mode 100644
index 0000000..b7695a4
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Straight_Line_Through_Origin.gif
Binary files differ
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
new file mode 100644
index 0000000..390f4cf
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Subspace_Non_Example.mp4
Binary files differ
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Unit_Circle.gif b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Unit_Circle.gif
new file mode 100644
index 0000000..165d040
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/gifs/Unit_Circle.gif
Binary files differ
diff --git a/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/linear_dependence_and_independence.py b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/linear_dependence_and_independence.py
new file mode 100644
index 0000000..b092777
--- /dev/null
+++ b/FSF-2020/linear-algebra/vector-spaces/Vector-Spaces/Subspaces/linear_dependence_and_independence.py
@@ -0,0 +1,293 @@
+from manimlib.imports import *
+class Linear_Dependence(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)
+ self.begin_ambient_camera_rotation(rate=0.05)
+ self.wait(0.5)
+ text1 = TextMobject(r"Consider 3 linearly dependent vectors in $\mathbb{R}^3$").scale(0.5).shift(2.5*UP+4*LEFT)
+ line1 = Line(color = YELLOW,opacity=350,start = ORIGIN,end = [-1,1,1])
+ self.add_fixed_in_frame_mobjects(text1)
+ self.play(ShowCreation(text1))
+ self.play(ShowCreation(line1))
+ self.wait(1)
+ line2 = Line(color = RED,opacity=350,start = ORIGIN,end = [1,0.5,0.5])
+ self.play(ShowCreation(line2))
+ self.wait(1)
+ line3 = Line(color = BLUE,opacity=350,start = ORIGIN,end = [0.5,1,1])
+ self.play(ShowCreation(line3))
+ self.wait(1)
+ text2 = TextMobject("Scaling the Vectors").scale(0.5).shift(2.5*UP+4.5*LEFT)
+ text3 = TextMobject(r"\text{and}",r"\text{Adding}",r"\text{them}").scale(0.5).shift(2*UP+4.5*LEFT)
+ text3[1].set_color(GREEN)
+
+
+ line4 = Line(color = YELLOW,opacity=350,start = ORIGIN,end = [-2,2,2])
+ line5 = Line(color = RED,opacity = 350,start = ORIGIN,end = [3,1.5,1.5])
+ line6 = Line(color = BLUE,opacity = 350,start = ORIGIN,end = [-0.5,-1,-1])
+ self.wait(1.1)
+ self.play(FadeOut(text1))
+ self.add_fixed_in_frame_mobjects(text2)
+ self.play(ShowCreation(text2))
+ self.wait(0.7)
+ self.play(Transform(line1,line4))
+ self.wait(0.5)
+ self.play(Transform(line2,line5))
+ self.wait(0.5)
+ self.play(Transform(line3,line6))
+
+ self.wait(1.5)
+
+ line7 = Line(color = RED,opacity = 350,start = [-2,2,2],end = [1,3.5,3.5])
+ line8 = Line(color = BLUE,opacity = 350,start = [1,3.5,3.5],end = [0.5,2.5,2.5])
+ line9 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [0.5,2.5,2.5])
+
+ self.add_fixed_in_frame_mobjects(text3)
+ self.play(ShowCreation(text3))
+ self.wait(0.7)
+ self.play(FadeOut(line2),ShowCreation(line7))
+ self.play(FadeOut(line3),ShowCreation(line8))
+ self.wait(0.7)
+ self.play(ShowCreation(line9))
+ self.wait(1.2)
+
+
+ plane = Polygon([-4,4,4],[4,4,4],[4,-4,-4],[-4,-4,-4])
+ plane.set_opacity(0.4)
+ plane.set_fill(DARK_BLUE)
+ plane.set_color(DARK_BLUE)
+ self.play(ShowCreation(plane))
+ self.wait(1.2)
+ text4 = TextMobject("Linearly Combinations").scale(0.65).shift(3.5*UP+4*RIGHT)
+
+ text5 = TextMobject(r"\text{$\vec{z_1}$}",r"\text{=}",r"\text{2}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{3}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{(-1)}",r"\text{$\vec{w}$}",).scale(0.55).shift(2.5*UP+3.9*RIGHT)
+ text5[0].set_color(GREEN)
+ text5[3].set_color(YELLOW)
+ text5[6].set_color(RED)
+ text5[9].set_color(BLUE)
+ self.add_fixed_in_frame_mobjects(text5)
+ self.add_fixed_in_frame_mobjects(text4)
+ self.play(ShowCreation(text4),ShowCreation(text5))
+ self.wait(3.8)
+ bunch1 = VGroup(line7,line8,line9)
+ line10 = Line(color=YELLOW,opacity=350,start=ORIGIN,end=[-0.5,0.5,0.5])
+ line11 = Line(color=RED,opacity=350,start=ORIGIN,end=[2,1,1])
+ line12 = Line(color = BLUE,opacity = 350,start = ORIGIN,end = [-1.5,-3,-3])
+ line13 = Line(color = RED,opacity = 350,start = [-0.5,0.5,0.5],end = [1.5,1.5,1.5])
+ line14 = Line(color = BLUE,opacity = 350,start = [1.5,1.5,1.5],end = [0,-1.5,-1.5])
+ line15 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [0,-1.5,-1.5])
+ bunch2 = VGroup(line13,line14,line15,line10)
+ self.play(FadeOut(line1),Transform(bunch1,bunch2))
+ self.wait(1.2)
+ text6 = TextMobject(r"\text{$\vec{z_2}$}",r"\text{=}",r"\text{0.5}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{2}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{(-3)}",r"\text{$\vec{w}$}",).scale(0.55).shift(2*UP+4*RIGHT)
+ text6[0].set_color(GREEN)
+ text6[3].set_color(YELLOW)
+ text6[6].set_color(RED)
+ text6[9].set_color(BLUE)
+
+ self.add_fixed_in_frame_mobjects(text6)
+ self.play(ShowCreation(text6))
+ self.wait(2.8)
+ bunch3 = VGroup(line10,bunch1)
+
+ line16 = Line(color=YELLOW,opacity=350,start=ORIGIN,end=[-2,2,2])
+ line17 = Line(color=RED,opacity=350,start=ORIGIN,end=[1,0.5,0.5])
+
+ line18 = Line(color = RED,opacity = 350,start = [-2,2,2],end = [-1,2.5,2.5])
+
+ line19 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [-1,2.5,2.5])
+ bunch4 = VGroup(line16,line18,line19)
+ self.play(Transform(bunch3,bunch4))
+ self.wait(1.2)
+ text7 = TextMobject(r"\text{$\vec{z_3}$}",r"\text{=}",r"\text{(-2)}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{2}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{(0)}",r"\text{$\vec{w}$}",).scale(0.55).shift(1.5*UP+4*RIGHT)
+ text7[0].set_color(GREEN)
+ text7[3].set_color(YELLOW)
+ text7[6].set_color(RED)
+ text7[9].set_color(BLUE)
+ self.add_fixed_in_frame_mobjects(text7)
+ self.play(ShowCreation(text7))
+
+ self.wait(5)
+ self.play(FadeOut(text2),FadeOut(text3))
+ text8 = TextMobject(r"\text{$\vec{z}$}",r"\text{=}",r"\text{a}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{b}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{c}",r"\text{$\vec{w}$}",).scale(0.55).shift(0.8*UP+4*RIGHT)
+ text8[0].set_color(GREEN)
+ text8[3].set_color(YELLOW)
+ text8[6].set_color(RED)
+ text8[9].set_color(BLUE)
+ rect1 = Rectangle(height=0.7,stroke_width=1.2)
+ rect1.surround(text8)
+ self.add_fixed_in_frame_mobjects(rect1)
+ self.add_fixed_in_frame_mobjects(text8)
+ self.play(ShowCreation(text8))
+ text9 = TextMobject(r"\text{All the}",r"\text{linear combinations}",r"\text{of linearly dependent vectors}",r"\text{$\vec{u},$}",r"\text{$\vec{v},$}",r"\text{and}",r"\text{$\vec{w}$}",r"\text{spans}").scale(0.5).shift(2.5*DOWN)
+ text9[1].set_color(GREEN)
+ text9[3].set_color(YELLOW)
+ text9[4].set_color(RED)
+ text9[6].set_color(BLUE)
+ text9.add_background_rectangle()
+ text10 = TextMobject(r"this entire plane (and not the entire $\mathbb{R}^3 )$.").scale(0.5).shift(3*DOWN)
+ text10.add_background_rectangle()
+ self.wait(2)
+ self.add_fixed_in_frame_mobjects(text10)
+
+ self.add_fixed_in_frame_mobjects(text9)
+ self.play(ShowCreation(text9),ShowCreation(text10))
+ self.wait(7)
+
+class Linear_Independence(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)
+ self.begin_ambient_camera_rotation(rate=0.1)
+ self.wait(0.5)
+ text1 = TextMobject(r"Consider 3 linearly independent vectors in $\mathbb{R}^3$").scale(0.5).shift(2.5*UP+4*LEFT)
+ self.add_fixed_in_frame_mobjects(text1)
+ self.play(ShowCreation(text1))
+ line1 = Line(color = YELLOW,opacity=350,start = ORIGIN,end = [-1,1,1])
+ self.play(ShowCreation(line1))
+ self.wait(0.7)
+ line2 = Line(color = RED,opacity=350,start = ORIGIN,end = [1,0.5,0.5])
+ self.play(ShowCreation(line2))
+ self.wait(0.7)
+ line3 = Line(color = BLUE,opacity=350,start = ORIGIN,end = [0,-1,-2])
+ self.play(ShowCreation(line3))
+ self.wait(0.7)
+
+ self.wait(1)
+ self.play(FadeOut(text1))
+ text2 = TextMobject("Scaling the Vectors").scale(0.5).shift(2.5*UP+5*LEFT)
+ self.add_fixed_in_frame_mobjects(text2)
+ self.play(ShowCreation(text2))
+ self.wait(0.7)
+ line4 = Line(color = YELLOW,opacity=350,start = ORIGIN,end = [-0.5,0.5,0.5])
+ self.play(Transform(line1,line4))
+ self.wait(0.7)
+ line5 = Line(color = RED,opacity=350,start = ORIGIN,end = [2,1,1])
+ self.play(Transform(line2,line5))
+ self.wait(0.7)
+ line6 = Line(color = BLUE,opacity=350,start = ORIGIN,end = [0,-1.5,-3])
+ self.play(Transform(line3,line6))
+ self.wait(1.7)
+ text3 = TextMobject(r"\text{and}",r"\text{Adding}",r"\text{them}").scale(0.5).shift(2*UP+5*LEFT)
+ text3[1].set_color(GREEN)
+
+ line7 = Line(color = RED,opacity = 350,start = [-0.5,0.5,0.5],end = [1.5,1.5,1.5])
+ line8 = Line(color = BLUE,opacity = 350,start = [1.5,1.5,1.5],end = [1.5,0,-1.5])
+ line9 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [1.5,0,-1.5])
+ self.add_fixed_in_frame_mobjects(text3)
+ self.play(ShowCreation(text3))
+ self.wait(0.7)
+ self.play(FadeOut(line2),ShowCreation(line7))
+ self.play(FadeOut(line3),ShowCreation(line8))
+ self.wait(0.7)
+ self.play(ShowCreation(line9))
+ self.wait(1.5)
+ plane = Polygon([-4,4,4],[4,4,4],[4,-4,-4],[-4,-4,-4])
+ plane.set_opacity(0.3)
+ plane.set_fill(DARK_BLUE)
+ plane.set_color(DARK_BLUE)
+ self.play(ShowCreation(plane))
+ self.wait(1.2)
+ text4 = TextMobject("Linearly Combinations").scale(0.65).shift(3.5*UP+4*RIGHT)
+ self.add_fixed_in_frame_mobjects(text4)
+ self.play(ShowCreation(text4))
+ self.wait(0.7)
+ text5 = TextMobject(r"\text{$\vec{z_1}$}",r"\text{=}",r"\text{0.5}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{2}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{1.5}",r"\text{$\vec{w}$}").scale(0.55).shift(2.5*UP+3.8*RIGHT)
+ text5[0].set_color(GREEN)
+ text5[3].set_color(YELLOW)
+ text5[6].set_color(RED)
+ text5[9].set_color(BLUE)
+ self.add_fixed_in_frame_mobjects(text5)
+
+ self.play(ShowCreation(text5))
+ self.wait(3.8)
+ bunch1 = VGroup(line7,line8,line9)
+ line10 = Line(color=YELLOW,opacity=350,start=ORIGIN,end=[-3,3,3])
+
+ line11 = Line(color = BLUE,opacity = 350,start = [-3,3,3],end = [-2,3.5,3.5])
+
+
+ line12 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [-2,3.5,3.5])
+ bunch2 = VGroup(line10,line11,line12)
+ self.play(FadeOut(line1),Transform(bunch1,bunch2))
+ self.wait(1.2)
+
+ text6 = TextMobject(r"\text{$\vec{z_2}$}",r"\text{=}",r"\text{3}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{1}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{0}",r"\text{$\vec{w}$}").scale(0.55).shift(2*UP+3.6*RIGHT)
+ text6[0].set_color(GREEN)
+ text6[3].set_color(YELLOW)
+ text6[6].set_color(RED)
+ text6[9].set_color(BLUE)
+
+ self.add_fixed_in_frame_mobjects(text6)
+ self.play(ShowCreation(text6))
+ self.wait(2.8)
+ bunch3 = VGroup(line10,bunch1)
+
+ line13 = Line(color=YELLOW,opacity=350,start=ORIGIN,end=[2.5,-2.5,-2.5])
+ line14 = Line(color=RED,opacity=350,start=[2.5,-2.5,-2.5],end=[0.5,-3.5,-3.5])
+
+ line15 = Line(color = BLUE,opacity = 350,start = [0.5,-3.5,-3.5],end = [0.5,-0.5,2.5])
+
+ line16 = Line(color = GREEN,opacity = 350,start = ORIGIN,end = [0.5,-0.5,2.5])
+ bunch4 = VGroup(line13,line14,line15,line16)
+ self.play(Transform(bunch3,bunch4))
+ self.wait(1.2)
+ text7 = TextMobject(r"\text{$\vec{z_3}$}",r"\text{=}",r"\text{(-2.5)}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{(-2)}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{(-3)}",r"\text{$\vec{w}$}").scale(0.55).shift(1.5*UP+4.2*RIGHT)
+ text7[0].set_color(GREEN)
+ text7[3].set_color(YELLOW)
+ text7[6].set_color(RED)
+ text7[9].set_color(BLUE)
+ self.add_fixed_in_frame_mobjects(text7)
+ self.play(ShowCreation(text7))
+ self.play(FadeOut(text3),FadeOut(text2))
+ self.wait(1.2)
+ text8 = TextMobject(r"\text{$\vec{z}$}",r"\text{=}",r"\text{a}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{b}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{c}",r"\text{$\vec{w}$}").scale(0.55).shift(0.8*UP+3.6*RIGHT)
+ text8[0].set_color(GREEN)
+ text8[3].set_color(YELLOW)
+ text8[6].set_color(RED)
+ text8[9].set_color(BLUE)
+ rect1 = Rectangle(height=0.7,stroke_width=1.2)
+ rect1.surround(text8)
+ self.add_fixed_in_frame_mobjects(rect1)
+ self.add_fixed_in_frame_mobjects(text8)
+ self.play(ShowCreation(text8))
+ self.wait(1.7)
+ self.play(FadeOut(plane))
+ self.wait(1.5)
+ text9 = TextMobject(r"\text{All the}",r"\text{linear combinations}",r"\text{of linearly independent vectors}",r"\text{$\vec{u},$}",r"\text{$\vec{v},$}",r"\text{and}",r"\text{$\vec{w}$}",r"\text{spans}").scale(0.5).shift(2.5*DOWN)
+ text9[1].set_color(GREEN)
+ text9[3].set_color(YELLOW)
+ text9[4].set_color(RED)
+ text9[6].set_color(BLUE)
+ text9.add_background_rectangle()
+ text10 = TextMobject("not only the plane but the entire 3-D space.").scale(0.5).shift(3*DOWN)
+ text10.add_background_rectangle()
+ self.add_fixed_in_frame_mobjects(text9)
+
+ self.add_fixed_in_frame_mobjects(text10)
+ self.play(ShowCreation(text9),ShowCreation(text10))
+ self.wait(2.3)
+
+ self.play(FadeOut(text5),FadeOut(text6),FadeOut(text7))
+ self.wait(0.6)
+ text9 = TextMobject(r"\text{$\vec{z}$}",r"\text{=}",r"\text{a}",r"\text{$\vec{u}$}",r"\text{+}",r"\text{b}",r"\text{$\vec{v}$}",r"\text{+}",r"\text{c}",r"\text{$\vec{w}$}",r"\text{= 0}").scale(0.55).shift(2.6*UP+3.9*RIGHT)
+ text9[0].set_color(GREEN)
+ text9[3].set_color(YELLOW)
+ text9[6].set_color(RED)
+ text9[9].set_color(BLUE)
+ text10 = TextMobject("only when a = b = c = 0.").scale(0.55).shift(2.2*UP+3.9*RIGHT)
+ self.play(FadeOut(text8),FadeOut(rect1))
+ self.wait(0.7)
+ self.add_fixed_in_frame_mobjects(text9)
+ self.add_fixed_in_frame_mobjects(text10)
+
+ self.play(ShowCreation(text9),ShowCreation(text10))
+ self.wait(5)