summaryrefslogtreecommitdiff
path: root/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
diff options
context:
space:
mode:
authorVaishnavi2020-05-27 20:27:04 +0530
committerGitHub2020-05-27 20:27:04 +0530
commit003d8f6f9c391b675b73fc2610dd86d609ea498b (patch)
tree9b6f0ae76e6cea374d45c6e9d0692f4eb038d56f /FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
parent3db080a68a32f82722dd77b7ca65cc8336f6c9fb (diff)
downloadFSF-mathematics-python-code-archive-003d8f6f9c391b675b73fc2610dd86d609ea498b.tar.gz
FSF-mathematics-python-code-archive-003d8f6f9c391b675b73fc2610dd86d609ea498b.tar.bz2
FSF-mathematics-python-code-archive-003d8f6f9c391b675b73fc2610dd86d609ea498b.zip
file2_Tangent_plane_approximation_visualization.py
Manim code for Video 2 of the lecture note on the subtopic Tangent Plane Approximations
Diffstat (limited to 'FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py')
-rw-r--r--FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
new file mode 100644
index 0000000..984db16
--- /dev/null
+++ b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
@@ -0,0 +1,34 @@
+from manimlib.imports import*
+
+class TangenttoSurface(ThreeDScene):
+
+ def construct(self):
+ axes = ThreeDAxes()
+
+ #----f(x,y): x**2+y**2
+ p = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ u**2+v**2
+ ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [GREEN_C,GREEN_D],
+ resolution = (20, 20)).scale(1)
+ self.set_camera_orientation(phi = 75*DEGREES)
+
+ h_text = TextMobject("The graph tends to coincide with its tangent plane").scale(0.5).to_corner(UL)
+ d = Dot([0,0,0],color ='#800000') #----critical point
+ r = Rectangle(height = 2,breadth = 1,color = YELLOW).scale(0.5) #----tangent plane to critical point
+ line1 = DashedLine(color=RED).shift(4*UP+1.3*RIGHT).rotate(1.571,UP).scale(1.2)
+ line2 = DashedLine(color=RED).shift(4*UP-1.3*RIGHT).rotate(1.571,UP).scale(1.2)
+
+ r2 = Rectangle(height = 2, breadth = 1,color = GREEN, fill_opacity=0.3).scale(0.5)
+
+ self.add(axes)
+ self.play(Write(r))
+ self.play(Write(p),Write(d))
+ self.play(ShowCreation(line1),ShowCreation(line2))
+ self.wait(2)
+
+ self.play(FadeOut(line1),FadeOut(line2),ReplacementTransform(p,r2))
+ self.add_fixed_in_frame_mobjects(h_text)
+ self.wait(1)