summaryrefslogtreecommitdiff
path: root/FSF-2020
diff options
context:
space:
mode:
authorPurusharth Saxena2020-06-27 03:25:51 +0530
committerGitHub2020-06-27 03:25:51 +0530
commit6e306094c68d05559b068fff2a46f594ec25f5e1 (patch)
treeb9f744eade0e6ac3fb798a6ad8d4e115f8935195 /FSF-2020
parent66412a4580140cf4684ebaff1aa59c0d2d12e641 (diff)
parentebfe7a6656b240aacffc4c92e873d4f3fed79971 (diff)
downloadFSF-mathematics-python-code-archive-6e306094c68d05559b068fff2a46f594ec25f5e1.tar.gz
FSF-mathematics-python-code-archive-6e306094c68d05559b068fff2a46f594ec25f5e1.tar.bz2
FSF-mathematics-python-code-archive-6e306094c68d05559b068fff2a46f594ec25f5e1.zip
Merge pull request #40 from vishal786-commits/master
Added new file
Diffstat (limited to 'FSF-2020')
-rw-r--r--FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file4_cube_surface.py195
-rw-r--r--FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/README.md2
-rw-r--r--FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.gifbin0 -> 7241572 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.py237
4 files changed, 415 insertions, 19 deletions
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file4_cube_surface.py b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file4_cube_surface.py
index 5963996..9301a00 100644
--- a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file4_cube_surface.py
+++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file4_cube_surface.py
@@ -43,29 +43,186 @@ class cuber(ThreeDScene):
n1.rotate(PI/2,axis=RIGHT)
n1.shift(3*RIGHT+1.3*OUT+DOWN)
+ spaceloc = [[0,0,2],[1,0,2],[-1,0,2],[2,0,2],[-2,0,2],[3,0,2],[-3,0,2],
+ [0,1,2],[1,1,2],[-1,1,2],[2,1,2],[-2,1,2],[3,1,2],[-3,1,2],
+ [0,-1,2],[1,-1,2],[-1,-1,2],[2,-1,2],[-2,-1,2],[3,-1,2],[-3,-1,2],
+ [0,2,2],[1,2,2],[-1,2,2],[2,2,2],[-2,2,2],[3,2,2],[-3,2,2],
+ [0,-2,2],[1,-2,2],[-1,-2,2],[2,-2,2],[-2,-2,2],[3,-2,2],[-3,-2,2],
+ [0,3,2],[1,3,2],[-1,3,2],[2,3,2],[-2,3,2],[3,3,2],[-3,3,2],
+ [0,3,2],[1,3,2],[-1,3,2],[2,3,2],[-2,3,2],[3,3,2],[-3,3,2],
+ [0,4,2],[1,4,2],[-1,4,2],[2,4,2],[-2,4,2],[3,4,2],[-3,4,2],
+ [0,4,2],[1,4,2],[-1,4,2],[2,4,2],[-2,4,2],[3,4,2],[-3,4,2],
+ [0,5,2],[1,5,2],[-1,5,2],[2,5,2],[-2,5,2],[3,5,2],[-3,5,2],
+ [0,5,2],[1,5,2],[-1,5,2],[2,5,2],[-2,5,2],[3,5,2],[-3,5,2],
+ [0,6,2],[1,6,2],[-1,6,2],[2,6,2],[-2,6,2],[3,6,2],[-3,6,2],
+ [0,1.5,2],[1,1.5,2],[-1,1.5,2],[2,1.5,2],[-2,1.5,2],[3,1.5,2],[-3,1.5,2],
+ [0,3,2],[1,3,2],[-1,3,2],[2,3,2],[-2,3,2],[3,3,2],[-3,3,2]]
+
+
+ veclist1=[Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E)]
+
+
+
+
+
+ [veclist1[i].rotate(PI/4,axis=RIGHT) for i in range(10,30,1)]
+ [veclist1[i].rotate(PI/4,axis=RIGHT) for i in range(40,80,2)]
+ [veclist1[i].rotate(PI/6,axis=OUT) for i in range(98)]
+ [veclist1[i].rotate(PI/8,axis=DOWN) for i in range(98)]
+ vectorfield1=VGroup(*veclist1)
+ [veclist1[i].shift(spaceloc[i]) for i in range(98)]
- self.set_camera_orientation(phi=75 * DEGREES,theta=-15*DEGREES)
+
+
+ veclist2=[Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),
+ Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E),Vector(color=GOLD_E)]
+
+
+
+
+
+ [veclist2[i].rotate(PI/4,axis=RIGHT) for i in range(10,30,1)]
+ [veclist2[i].rotate(PI/4,axis=RIGHT) for i in range(40,80,2)]
+ [veclist2[i].rotate(PI/6,axis=OUT) for i in range(98)]
+ [veclist2[i].rotate(PI/8,axis=DOWN) for i in range(98)]
+ vectorfield2=VGroup(*veclist2)
+ [veclist2[i].shift(spaceloc[i]) for i in range(98)]
+
+
+
+ veclist3=[Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector()]
+
+
+
+
+
+ [veclist3[i].rotate(PI/4,axis=RIGHT) for i in range(10,30,1)]
+ [veclist3[i].rotate(PI/4,axis=RIGHT) for i in range(40,80,2)]
+ [veclist3[i].rotate(PI/6,axis=OUT) for i in range(98)]
+ [veclist3[i].rotate(PI/8,axis=DOWN) for i in range(98)]
+ vectorfield3=VGroup(*veclist3)
+ [veclist3[i].shift(spaceloc[i]) for i in range(98)]
+
+
+
+
+ veclist4=[Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector(),
+ Vector(color=RED),Vector(color=GREEN),Vector(color=BLUE),Vector(color=PINK),Vector(color=MAROON),Vector(color=GREEN),Vector()]
+
+
+
+
+
+ [veclist4[i].rotate(PI/4,axis=RIGHT) for i in range(10,30,1)]
+ [veclist4[i].rotate(PI/4,axis=RIGHT) for i in range(40,80,2)]
+ [veclist4[i].rotate(PI/6,axis=OUT) for i in range(98)]
+ [veclist4[i].rotate(PI/8,axis=DOWN) for i in range(98)]
+ vectorfield4=VGroup(*veclist4)
+ [veclist4[i].shift(spaceloc[i]) for i in range(98)]
+
+
+ vectorfield1.shift(1.5*DOWN)
+ vectorfield2.shift(IN+1.5*DOWN)
+ vectorfield3.shift(2*IN+1.5*DOWN)
+ vectorfield4.shift(3*IN+1.5*DOWN)
+
+ vectors=[vectorfield1,vectorfield2,vectorfield3,vectorfield4]
+ vectorfield=VGroup(*vectors)
+ vectorfield.scale(1.25)
+
+ fv=[Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),
+ Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),
+ Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),
+ Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),Vector(color=ORANGE),
+ ]
+
+ spaceloc2 = [[1.5,0.5,0.5],[1.5,1,0.5],[1.5,1.5,0.5],[1.5,2,0.5],
+ [1.5,0.5,1],[1.5,1,1],[1.5,1.5,1],[1.5,2,1],
+ [1.5,0.5,1.5],[1.5,1,1.5],[1.5,1.5,1.5],[1.5,2,1.5],
+ [1.5,0.5,2],[1.5,1,2],[1.5,1.5,2],[1.5,2,2]]
+
+ [fv[i].rotate(PI/4,axis=RIGHT) for i in range(1)]
+ [fv[i].rotate(PI/6,axis=OUT) for i in range(16)]
+ [fv[i].rotate(PI/8,axis=DOWN) for i in range(16)]
+ [fv[i].shift(spaceloc2[i]) for i in range(16)]
+ fvfield=VGroup(*fv)
+ fvfield.shift(0.5*IN+2*DOWN)
+
+ flux=TextMobject("Flux through one side of the cube").set_color(ORANGE)
+ flux.shift(3*UP+1.5*LEFT)
+
+
+
+
+
+ self.set_camera_orientation(phi=70 * DEGREES,theta=-75*DEGREES)
self.play(ShowCreation(axes),ShowCreation(axis_label))
- self.play(ShowCreation(cube, run_time=3))
- self.begin_ambient_camera_rotation(rate=-0.2)
- # self.move_camera(phi=150*DEGREES,theta=-45*DEGREES, run_time=3)
+ self.play(ShowCreation(vectorfield))
+ self.add(fvfield)
+ self.begin_ambient_camera_rotation(rate=0.01)
+
+ self.play(ShowCreation(cube, run_time=1))
+
self.wait(1)
self.play(ShowCreation(sq3))
-
self.wait(1)
- self.play(ShowCreation(v1),ShowCreation(n1))
+ self.play(FadeOut(cube))
+ self.play(FadeOut(vectorfield))
+ self.add_fixed_in_frame_mobjects(flux)
+ # self.play(ShowCreation(flux))
self.wait(1)
- self.stop_ambient_camera_rotation()
- self.wait(2)
-
-
- # self.play(Write(t1))
- # self.play(Transform(vg,t1))
- # self.wait(3)
- # self.play(ReplacementTransform(t1,t2))
- # self.wait(3)
- # # self.move_camera(phi=50*DEGREES,theta=-45*DEGREES,run_time=3)
- # self.wait(8)
- # self.move_camera(phi=75 * DEGREES, run_time=3)
- # self.wait(3)
+ self.play(ShowCreation(v1),ShowCreation(n1))
+ self.wait(6)
+ # self.stop_ambient_camera_rotation()
+
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/README.md b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/README.md
index a4a1c84..a1de8b5 100644
--- a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/README.md
+++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/README.md
@@ -6,3 +6,5 @@
![file3_cube_sideC](sideC.gif)
**file4_pauseandponder.py**
![file4_pauseandponder](pauseandponder.gif)
+**file5_surface.py**
+![file5_surface](file5_surface.gif)
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.gif b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.gif
new file mode 100644
index 0000000..27dcac8
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.py b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.py
new file mode 100644
index 0000000..3c2e145
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.py
@@ -0,0 +1,237 @@
+from manimlib.imports import *
+
+class Surf(ThreeDScene):
+
+ CONFIG = {
+ "axes_config": {
+ "x_min": 0,
+ "x_max": 8,
+ "y_min": 0,
+ "y_max": 8,
+ "z_min": 0,
+ "z_max": 6,
+ "a":2 ,"b": 6, "c":1 , "d":6,
+ "axes_shift":-3*OUT + 5*LEFT,
+ "x_axis_config": {
+ "tick_frequency": 1,
+ # "include_tip": False,
+ },
+ "y_axis_config": {
+ "tick_frequency": 1,
+ # "include_tip": False,
+ },
+ "z_axis_config": {
+ "tick_frequency": 1,
+ # "include_tip": False,
+ },
+ "num_axis_pieces": 1,
+ },
+ "default_graph_style": {
+ "stroke_width": 2,
+ "stroke_color": WHITE,
+ },
+ "default_surface_config": {
+ "fill_opacity": 0.5,
+ "checkerboard_colors": [LIGHT_GREY],
+ "stroke_width": 0.5,
+ "stroke_color": WHITE,
+ "stroke_opacity": 0.5,
+ },
+ "Func": lambda x,y: 2+y/4+np.sin(x)
+ }
+
+
+ def construct(self):
+
+ self.setup_axes()
+ self.set_camera_orientation(distance=35,
+ phi=80 * DEGREES,
+ theta=-80 * DEGREES,
+ )
+
+ fn_text=TextMobject("$S$").set_color(BLUE)
+ self.add_fixed_in_frame_mobjects(fn_text)
+ fn_text.to_edge(TOP,buff=MED_SMALL_BUFF)
+
+ R=TextMobject("D").set_color(BLACK).scale(3)
+ R.move_to(self.axes.input_plane,IN)
+ self.add(R)
+
+ #get the surface
+ surface= self.get_surface(
+ self.axes, lambda x , y:
+ self.Func(x,y)
+ )
+ surface.set_style(
+ fill_opacity=0.8,
+ fill_color=YELLOW,
+ stroke_width=0.8,
+ stroke_color=WHITE,
+ )
+
+
+ self.begin_ambient_camera_rotation(rate=0.05)
+ self.play(Write(surface))
+ # self.play(LaggedStart(ShowCreation(surface)))
+
+ self.get_lines()
+ # self.play(FadeIn(self.axes.input_plane))
+ self.wait(2)
+ self.stop_ambient_camera_rotation()
+ self.wait(1)
+
+ def get_surface(self,axes, func, **kwargs):
+ config = {
+ "u_min": axes.c,
+ "u_max": axes.d,
+ "v_min": axes.a,
+ "v_max": axes.b,
+ "resolution": (
+ (axes.y_max - axes.y_min) // axes.y_axis.tick_frequency,
+ (axes.x_max - axes.x_min) // axes.x_axis.tick_frequency,
+ ),
+ }
+
+ config.update(self.default_surface_config)
+ config.update(kwargs)
+ return ParametricSurface(
+ lambda x,y : axes.c2p(
+ x, y, func(x, y)
+ ),
+ **config
+ )
+
+ def get_lines(self):
+ axes = self.axes
+ labels=[axes.x_axis.n2p(axes.a), axes.x_axis.n2p(axes.b), axes.y_axis.n2p(axes.c),
+ axes.y_axis.n2p(axes.d)]
+
+
+ surface_corners=[]
+ for x,y,z in self.region_corners:
+ surface_corners.append([x,y,self.Func(x,y)])
+
+ lines=VGroup()
+ for start , end in zip(surface_corners,
+ self.region_corners):
+ lines.add(self.draw_lines(start,end,"WHITE"))
+
+ for start , end in zip(labels,
+ self.region_corners):
+ # lines.add(self.draw_lines(start,end,"BLUE"))
+ # print (start,end)
+ pass
+ self.play(ShowCreation(lines))
+
+
+ def draw_lines(self,start,end,color):
+ start=self.axes.c2p(*start)
+ end=self.axes.c2p(*end)
+ line=DashedLine(start,end,color=color)
+
+ return line
+
+ def get_three_d_axes(self, include_labels=True, include_numbers=True, **kwargs):
+ config = dict(self.axes_config)
+ config.update(kwargs)
+ axes = ThreeDAxes(**config)
+ axes.set_stroke(width=2)
+
+ if include_numbers:
+ self.add_axes_numbers(axes)
+
+ if include_labels:
+ self.add_axes_labels(axes)
+
+ # Adjust axis orientation
+ axes.x_axis.rotate(
+ 90 * DEGREES, RIGHT,
+ about_point=axes.c2p(0, 0, 0),
+ )
+ axes.y_axis.rotate(
+ 90 * DEGREES, UP,
+ about_point=axes.c2p(0, 0, 0),
+ )
+
+ # Add xy-plane
+ input_plane = self.get_surface(
+ axes, lambda x, t: 1e-5
+ )
+ input_plane.set_style(
+ fill_opacity=0.5,
+ fill_color=TEAL,
+ stroke_width=0,
+ stroke_color=WHITE,
+ )
+
+ axes.input_plane = input_plane
+
+ self.region_corners=[
+ input_plane.get_corner(pos) for pos in (DL,DR,UR,UL)]
+
+ return axes
+
+
+ def setup_axes(self):
+ axes = self.get_three_d_axes(include_labels=True)
+ axes.add(axes.input_plane)
+ axes.scale(1)
+ # axes.center()
+ axes.shift(axes.axes_shift)
+
+ self.add(axes)
+ self.axes = axes
+
+ def add_axes_numbers(self, axes):
+ x_axis = axes.x_axis
+ y_axis = axes.y_axis
+ tex_vals_x = [
+ ("a", axes.a),
+ ("b", axes.b),
+ ]
+ tex_vals_y=[
+ ("c", axes.c),
+ ("d", axes.d)
+ ]
+ x_labels = VGroup()
+ y_labels = VGroup()
+ for tex, val in tex_vals_x:
+ label = TexMobject(tex)
+ label.scale(1)
+ label.next_to(x_axis.n2p(val), DOWN)
+ x_labels.add(label)
+ x_axis.add(x_labels)
+ x_axis.numbers = x_labels
+
+ for tex, val in tex_vals_y:
+ label = TexMobject(tex)
+ label.scale(1.5)
+ label.next_to(y_axis.n2p(val), LEFT)
+ label.rotate(90 * DEGREES)
+ y_labels.add(label)
+
+ y_axis.add(y_labels)
+ y_axis.numbers = y_labels
+
+ return axes
+
+ def add_axes_labels(self, axes):
+ x_label = TexMobject("X")
+ x_label.next_to(axes.x_axis.get_end(), RIGHT)
+ axes.x_axis.label = x_label
+
+ y_label = TextMobject("Y")
+ y_label.rotate(90 * DEGREES, OUT)
+ y_label.next_to(axes.y_axis.get_end(), UP)
+ axes.y_axis.label = y_label
+
+ z_label = TextMobject("Z")
+ z_label.rotate(90 * DEGREES, RIGHT)
+ z_label.next_to(axes.z_axis.get_zenith(), RIGHT)
+ axes.z_axis.label = z_label
+ for axis in axes:
+ axis.add(axis.label)
+ return axes
+ ######Code_by_Somnath_Pandit_https://github.com/panditsomnath10016git#########
+
+