summaryrefslogtreecommitdiff
path: root/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py
diff options
context:
space:
mode:
authorVaishnavi2020-07-19 20:51:24 +0530
committerGitHub2020-07-19 20:51:24 +0530
commitfbc57951a3d9154e9a1fb979491308d378e139da (patch)
tree91773c83ef1cbc20419e4c86993fb06f39371e5a /FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py
parent8fcbefa74a25ace1dd68831797898dfaf2fab512 (diff)
parenta15447d7f518153438894928f960329cc32b1053 (diff)
downloadFSF-mathematics-python-code-archive-fbc57951a3d9154e9a1fb979491308d378e139da.tar.gz
FSF-mathematics-python-code-archive-fbc57951a3d9154e9a1fb979491308d378e139da.tar.bz2
FSF-mathematics-python-code-archive-fbc57951a3d9154e9a1fb979491308d378e139da.zip
Merge pull request #6 from FOSSEE/master
Update fork repo. DONE
Diffstat (limited to 'FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py')
-rw-r--r--FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file1_transformations.py34
1 files changed, 31 insertions, 3 deletions
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