diff options
author | Somnath Pandit | 2020-05-26 12:17:38 +0530 |
---|---|---|
committer | GitHub | 2020-05-26 12:17:38 +0530 |
commit | f26d34f6f654c5070fd62b92c8bb59f9e5b00762 (patch) | |
tree | 6ef78a3a15415b9a730158dbf6ae6a4feedbdb42 /FSF-2020/approximations-and-optimizations/Critical Points/example.py | |
parent | 0a079186b73414908e7af909bb950dacb7ebac07 (diff) | |
parent | 4f868ac75ba1c8777cb7ab023909fc09bae9e3d0 (diff) | |
download | FSF-mathematics-python-code-archive-f26d34f6f654c5070fd62b92c8bb59f9e5b00762.tar.gz FSF-mathematics-python-code-archive-f26d34f6f654c5070fd62b92c8bb59f9e5b00762.tar.bz2 FSF-mathematics-python-code-archive-f26d34f6f654c5070fd62b92c8bb59f9e5b00762.zip |
Merge pull request #1 from FOSSEE/master
Update with head repo
Diffstat (limited to 'FSF-2020/approximations-and-optimizations/Critical Points/example.py')
-rw-r--r-- | FSF-2020/approximations-and-optimizations/Critical Points/example.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Critical Points/example.py b/FSF-2020/approximations-and-optimizations/Critical Points/example.py new file mode 100644 index 0000000..3a41be7 --- /dev/null +++ b/FSF-2020/approximations-and-optimizations/Critical Points/example.py @@ -0,0 +1,32 @@ +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) |