summaryrefslogtreecommitdiff
path: root/FSF-2020/approximations-and-optimizations
diff options
context:
space:
mode:
authorVaishnavi2020-06-14 00:42:55 +0530
committerGitHub2020-06-14 00:42:55 +0530
commit50cd0ef4bf0348aa2bb2e7d26a05419e67623a76 (patch)
tree837092609717a793374f4fbc9935f3d965e9ae3e /FSF-2020/approximations-and-optimizations
parentc104de4d17e814ec63e5a4984e2558cb70fb9116 (diff)
downloadFSF-mathematics-python-code-archive-50cd0ef4bf0348aa2bb2e7d26a05419e67623a76.tar.gz
FSF-mathematics-python-code-archive-50cd0ef4bf0348aa2bb2e7d26a05419e67623a76.tar.bz2
FSF-mathematics-python-code-archive-50cd0ef4bf0348aa2bb2e7d26a05419e67623a76.zip
Update and rename file4_f(x,y)=(y-x)(1-2x-3y).py to file4_Types_of_critical_points.py
Diffstat (limited to 'FSF-2020/approximations-and-optimizations')
-rw-r--r--FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py70
-rw-r--r--FSF-2020/approximations-and-optimizations/Critical-Points/file4_f(x,y)=(y-x)(1-2x-3y).py32
2 files changed, 70 insertions, 32 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py b/FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py
new file mode 100644
index 0000000..f9c1ef0
--- /dev/null
+++ b/FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py
@@ -0,0 +1,70 @@
+from manimlib.imports import *
+
+class TypescpAnimation(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+
+ r_text = TextMobject("Relative Maximum at ORIGIN",color ='#87CEFA')
+ f_text = TextMobject("$f(x,y) = -x^2-y^2$").to_corner(UL)
+
+ #----graph of first function f(x,y) = -x**2-y**2
+ f = 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 = [YELLOW_B,YELLOW_C,YELLOW_D, YELLOW_E],
+ resolution = (20, 20)).scale(1.5).shift([0,0,-0.51]).fade(0.3)
+
+ r2_text = TextMobject("Saddle Point at ORIGIN",color ='#87CEFA')
+ f2_text = TextMobject("$f(x,y) = -x^2+y^2$").to_corner(UL)
+
+ #----graph of second function f(x,y) = -x**2+y**2
+ f2 = 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 = [RED_B,RED_C,RED_D, RED_E],
+ resolution = (20, 20)).scale(1.5).shift([0,0.2,0]).fade(0.3)
+
+ r3_text = TextMobject("Relative Minimum at ORIGIN",color ='#87CEFA')
+ f3_text = TextMobject("$f(x,y) = x^2+y^2$").to_corner(UL)
+
+ #----graph of third function f(x,y) = x**2+y**2
+ f3 = 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 =[TEAL_B,TEAL_C,TEAL_D,TEAL_E],
+ resolution = (20, 20)).scale(1.5).shift([0,0,0.55]).fade(0.1)
+
+ self.set_camera_orientation(phi = 75 * DEGREES, theta = -45 * DEGREES )
+ d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point
+
+ self.add_fixed_in_frame_mobjects(r_text)
+ self.wait(1)
+ self.play(FadeOut(r_text))
+ self.add(axes)
+ self.play(Write(f),Write(d))
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.wait(2)
+ self.play(FadeOut(axes),FadeOut(f),FadeOut(f_text),FadeOut(d))
+
+ self.add_fixed_in_frame_mobjects(r2_text)
+ self.wait(1)
+ self.play(FadeOut(r2_text))
+ self.add(axes)
+ self.play(Write(f2),Write(d))
+ self.add_fixed_in_frame_mobjects(f2_text)
+ self.wait(2)
+ self.play(FadeOut(axes),FadeOut(f2),FadeOut(f2_text),FadeOut(d))
+
+ self.add_fixed_in_frame_mobjects(r3_text)
+ self.wait(1)
+ self.play(FadeOut(r3_text))
+ self.add(axes)
+ self.play(Write(f3),Write(d))
+ self.add_fixed_in_frame_mobjects(f3_text)
+ self.wait(2)
diff --git a/FSF-2020/approximations-and-optimizations/Critical-Points/file4_f(x,y)=(y-x)(1-2x-3y).py b/FSF-2020/approximations-and-optimizations/Critical-Points/file4_f(x,y)=(y-x)(1-2x-3y).py
deleted file mode 100644
index 72c93b1..0000000
--- a/FSF-2020/approximations-and-optimizations/Critical-Points/file4_f(x,y)=(y-x)(1-2x-3y).py
+++ /dev/null
@@ -1,32 +0,0 @@
-from manimlib.imports import*
-
-class ExampleAnimation(ThreeDScene):
- def construct(self):
- axes = ThreeDAxes()
-
- f_text = TextMobject("$f(x,y) = (y-x)(1-2x-3y)$").to_corner(UL)
- d = Dot(np.array([0,0,0]), color = '#800000') #---- Critical Point
- d_text = TextMobject("$(0.2,0.2)$",color = '#DC143C').scale(0.5).shift(0.2*UP) #----x = 0.2, y = 0.2
- r_text=TextMobject("Critical Point",color = '#00FFFF').shift(0.3*DOWN).scale(0.6)
-
- #----f(x,y) = (y-x)(1-2x-3y)
- f = ParametricSurface(
- lambda u, v: np.array([
- u,
- v,
- (v-u)*(1-2*u-3*v)
- ]),v_min = -1, v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [PURPLE_D, PURPLE_E],
- resolution=(20, 20)).scale(1)
-
- self.set_camera_orientation(phi = 75 * DEGREES)
- self.begin_ambient_camera_rotation(rate=0.5)
-
- self.add_fixed_in_frame_mobjects(f_text)
- self.wait(1)
- self.add(axes)
- self.play(Write(f),Write(d))
- self.wait(1)
- self.add_fixed_in_frame_mobjects(d_text)
- self.wait(1)
- self.add_fixed_in_frame_mobjects(r_text)
- self.wait(3)