summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/Limits and Continuity of Multivariable Functions/limit_approach_point.py
blob: 57d1d45db0e6d3a111088af419d9a3fd92a87817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from manimlib.imports import *

class Limit(GraphScene):
    CONFIG = {
    "x_min": 0,
    "x_max": 4,
    "y_min": 0,
    "y_max": 4,
    "graph_origin": ORIGIN + 3* DOWN+4*LEFT,
    "x_labeled_nums": list(range(0, 4)),
    "y_labeled_nums": list(range(0, 5)),
    }
    def construct(self):
        topic = TextMobject("Different paths of approach to limit point")
        topic.scale(1.5)
        topic.set_color_by_gradient(RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE)
        self.play(Write(topic))
        self.wait(1)
        self.play(FadeOut(topic))
        
        

        XTD = self.x_axis_width/(self.x_max- self.x_min)
        YTD = self.y_axis_height/(self.y_max- self.y_min)

        self.setup_axes(animate = True)

        y_x = self.get_graph(lambda x :  x, x_min = -1, x_max = 4)
        y_x_lab = self.get_graph_label(y_x, label = r"y = x")

        y_xsquare = self.get_graph(lambda x :  x*x, x_min = -1, x_max = 4)
        y_xsquare_lab = self.get_graph_label(y_xsquare, label = r"y = x^2")

        y_1 = self.get_graph(lambda x :  1, x_min = -1, x_max = 4)
        y_1_lab = self.get_graph_label(y_1, label = r"y = 1")

        y_2minusx = self.get_graph(lambda x :  2 - x, x_min = -1, x_max = 4, color = RED)
        y_2minusx_lab = self.get_graph_label(y_2minusx, label = r"y = 2 - x")

        limit_point = Dot().shift(self.graph_origin+1*XTD*RIGHT+1*YTD*UP)
        limit_point_lab = TextMobject(r"(1,1)") 
        limit_point_lab.next_to(limit_point, DOWN)

        self.play(ShowCreation(limit_point))
        self.play(Write(limit_point_lab))
        self.wait(1)

        self.play(ShowCreation(y_x))
        self.play(Write(y_x_lab))
        self.wait(1)

        self.play(ShowCreation(y_xsquare))
        self.play(Write(y_xsquare_lab))
        self.wait(1)

        self.play(ShowCreation(y_1))
        self.play(Write(y_1_lab))
        self.wait(1)

        self.play(ShowCreation(y_2minusx))
        self.play(Write(y_2minusx_lab))
        self.wait(1)