diff options
author | Vaishnavi | 2020-05-25 22:30:42 +0530 |
---|---|---|
committer | GitHub | 2020-05-25 22:30:42 +0530 |
commit | 4319bd86cbce60580c118fd95aacc9ae4430ff5d (patch) | |
tree | 1424220879fa7b001b5873ba01dd61b6ee4a83fc /FSF-2020/approximations-and-optimizations | |
parent | a943082849ca96f6b0ffd7f33f919161b8bd828b (diff) | |
download | FSF-mathematics-python-code-archive-4319bd86cbce60580c118fd95aacc9ae4430ff5d.tar.gz FSF-mathematics-python-code-archive-4319bd86cbce60580c118fd95aacc9ae4430ff5d.tar.bz2 FSF-mathematics-python-code-archive-4319bd86cbce60580c118fd95aacc9ae4430ff5d.zip |
Create example.py
Diffstat (limited to 'FSF-2020/approximations-and-optimizations')
-rw-r--r-- | FSF-2020/approximations-and-optimizations/Critical Points/example.py | 33 |
1 files changed, 33 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..0ff4c15 --- /dev/null +++ b/FSF-2020/approximations-and-optimizations/Critical Points/example.py @@ -0,0 +1,33 @@ +from manimlib.imports import* + +class ExampleAnimation(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + + #----f(x,y) = (y-x)(1-2x-3y) + e = 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 = 35 * DEGREES, theta = -40* DEGREES) + + 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) + + self.add_fixed_in_frame_mobjects(f_text) + self.wait(2) + self.add(axes) + self.play(Write(e)) + self.wait(2) + self.play(ShowCreation(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) |