summaryrefslogtreecommitdiff
path: root/FSF-2020/approximations-and-optimizations
diff options
context:
space:
mode:
authorVaishnavi2020-05-27 20:36:37 +0530
committerGitHub2020-05-27 20:36:37 +0530
commit407c6ad5fda44100792a0e309c2d56a05dfbe228 (patch)
tree193d6f46dc674fede019bfec6521bbe38eef5b57 /FSF-2020/approximations-and-optimizations
parentaeb9f27dfc12d5d64502f015d13e1a75c32ac7e1 (diff)
downloadFSF-mathematics-python-code-archive-407c6ad5fda44100792a0e309c2d56a05dfbe228.tar.gz
FSF-mathematics-python-code-archive-407c6ad5fda44100792a0e309c2d56a05dfbe228.tar.bz2
FSF-mathematics-python-code-archive-407c6ad5fda44100792a0e309c2d56a05dfbe228.zip
Create file3_non_differentiable_function.py
Manim code for Video 3 of lecture note on the subtopic Tangent Plane Approximations
Diffstat (limited to 'FSF-2020/approximations-and-optimizations')
-rw-r--r--FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py
new file mode 100644
index 0000000..13bd73e
--- /dev/null
+++ b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py
@@ -0,0 +1,30 @@
+from manimlib.imports import*
+import math
+
+#---- tangent plane does not exists for f(x,y): sqrt(x**2+y**2) at origin
+
+class TangenttoSurface(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+
+ #----f(x,y): sqrt(x**2+y**2)
+ p = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ math.sqrt(u**2+v**2)
+ ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D],
+ resolution = (20, 20)).scale(1)
+
+ self.set_camera_orientation(phi = 75 * DEGREES)
+
+ d = Dot([0,0,0],color = '#800000') #----critical point
+ d_text = TextMobject("$(0,0)$").scale(0.5).shift(0.2*DOWN)
+ f_text = TextMobject("$f$ is not differentiable at origin").scale(0.5).to_corner(UL)
+
+ self.begin_ambient_camera_rotation(rate=0.1)
+ self.add(axes)
+ self.play(Write(p),Write(d))
+ self.add_fixed_in_frame_mobjects(d_text)
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.wait(2)