summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/scalar-functions/file6_scalar_function_application.py
blob: 3ccfad698caff9cf46719b4e37ba74ce9fe809a3 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from manimlib.imports import *

class ScalarApplication(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes() # creates a 3D Axis

        self.add(axes)

        axis = TextMobject(r"X",r"Y",r"Z")
        axis[0].move_to(6*RIGHT)
        axis[1].move_to(6*UP)
        axis[2].move_to(np.array([0,0,3.7]))

        self.add_fixed_orientation_mobjects(axis[2])
        self.add_fixed_orientation_mobjects(axis[0])
        self.add_fixed_orientation_mobjects(axis[1]) 
        
        cube = Cube()
        cube.set_fill(YELLOW_C, opacity = 0.2)
        cube.scale(2)
        self.set_camera_orientation(phi=0 * DEGREES,theta=270*DEGREES)
        self.play(ShowCreation(cube))
        
        dot = Sphere()
        dot.scale(0.1)
        dot.move_to(np.array([1,0.5,1]))
        dot.set_fill(RED)

        #dot = Dot(np.array([1,0.5,1]), color = RED)
        temp_func = TextMobject("T(x,y,z)")
        temp_func.next_to(dot,RIGHT)
        temp_func.set_color(RED)
        temp_func_trans = TextMobject("T(1,0.5,1)")
        temp_func_trans.next_to(dot,RIGHT)
        temp_func_trans.set_color(RED)
        temp = TextMobject(r"$36 ^\circ$")
        temp.next_to(dot,RIGHT)
        temp.set_color(RED_E)


        self.play(ShowCreation(dot))
        self.play(ShowCreation(temp_func))
        self.play(Transform(temp_func, temp_func_trans))
        self.wait(1)
        self.play(Transform(temp_func, temp))




        dot1 = Sphere()
        dot1.scale(0.1)
        dot1.move_to(np.array([-1,-0.8,-1.5]))
        dot1.set_fill(BLUE_E)
        #dot1 = Dot(np.array([-1,-0.8,-1.5]), color = BLUE)
        temp_func1 = TextMobject("T(x,y,z)")
        temp_func1.next_to(dot1,LEFT)
        temp_func1.set_color(BLUE)
        temp_func_trans1 = TextMobject("T(-1,-0.8,-1.5)")
        temp_func_trans1.next_to(dot1,LEFT)
        temp_func_trans1.set_color(BLUE)
        temp1 = TextMobject(r"$24 ^\circ$")
        temp1.next_to(dot1,LEFT)
        temp1.set_color(BLUE)

        self.play(ShowCreation(dot1))
        self.play(ShowCreation(temp_func1))
        self.play(Transform(temp_func1, temp_func_trans1))
        self.wait(1)
        self.play(Transform(temp_func1, temp1))

        self.play(FadeOut(temp_func))
        self.play(FadeOut(temp_func1))


        self.move_camera(phi=80* DEGREES,theta=45*DEGREES,run_time=3)

        self.begin_ambient_camera_rotation(rate=0.2)
        self.wait(4)
        self.stop_ambient_camera_rotation()
        self.wait(2)
        



class AddTempScale(Scene):
    def construct(self):
        temp_scale = ImageMobject("tempscale.png")
        temp_scale.scale(4) 
        temp_scale.move_to(2*RIGHT) 
        self.play(ShowCreation(temp_scale))


        temp_func = TextMobject("T(x,y,z)")
        temp_func.move_to(3*UP +2*LEFT)
        temp_func.set_color(RED)
        temp_func_trans = TextMobject("T(1,0.5,1)")
        temp_func_trans.move_to(3*UP +2*LEFT)
        temp_func_trans.set_color(RED)
        temp = TextMobject(r"$36 ^\circ$")
        temp.set_color(RED)
        temp.move_to(3*UP +2*LEFT)
        temp.scale(0.7)

        self.play(ShowCreation(temp_func))
        self.play(Transform(temp_func, temp_func_trans))
        self.wait(1)
        self.play(Transform(temp_func, temp))
        self.play(ApplyMethod(temp_func.move_to, 1.8*UP +1.8*RIGHT))

        
        temp_func1 = TextMobject("T(x,y,z)")
        temp_func1.move_to(2*UP +2*LEFT)
        temp_func1.set_color(BLUE)
        temp_func_trans1 = TextMobject("T(-1,-0.8,-1.5)")
        temp_func_trans1.move_to(2*UP +2*LEFT)
        temp_func_trans1.set_color(BLUE)
        temp1 = TextMobject(r"$24 ^\circ$")
        temp1.set_color(BLUE)
        temp1.move_to(2*UP +2*LEFT)
        temp1.scale(0.7)
        
        self.play(ShowCreation(temp_func1))
        self.play(Transform(temp_func1, temp_func_trans1))
        self.wait(1)
        self.play(Transform(temp_func1, temp1))
        self.play(ApplyMethod(temp_func1.move_to, 0.6*UP +1.8*RIGHT))



        transtext = TextMobject("Scalar Function Transform:")
        transtext.set_color(GREEN)
        transtext1 = TextMobject(r"$\mathbb{R}^3 \rightarrow \mathbb{R}$")
        transtext1.set_color(YELLOW_E)
        transtext.move_to(3*UP +3*LEFT)
        transtext1.next_to(transtext,DOWN)
        self.play(Write(transtext))
        self.play(Write(transtext1))
        self.wait(2)