diff options
author | Vaishnavi | 2020-06-28 02:10:50 +0530 |
---|---|---|
committer | GitHub | 2020-06-28 02:10:50 +0530 |
commit | eda3c6deb9402847b9b04c53b17a9fb6c262420b (patch) | |
tree | 03263b6c412e1001de1589902946ebca914a2367 /FSF-2020 | |
parent | 7650a4ad8777a8a979c4899c1e0d852bd5111be8 (diff) | |
parent | 8ad6529190a9ee7e3324b71b555c6807c2a8cf15 (diff) | |
download | FSF-mathematics-python-code-archive-eda3c6deb9402847b9b04c53b17a9fb6c262420b.tar.gz FSF-mathematics-python-code-archive-eda3c6deb9402847b9b04c53b17a9fb6c262420b.tar.bz2 FSF-mathematics-python-code-archive-eda3c6deb9402847b9b04c53b17a9fb6c262420b.zip |
Merge pull request #3 from FOSSEE/master
Update fork
Diffstat (limited to 'FSF-2020')
13 files changed, 555 insertions, 38 deletions
diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/README.md index f5313c9..a2f71d7 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/README.md +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/README.md @@ -1,11 +1,8 @@ -**file1_simple_visualization.py** +**file1_simple_visualization.py** <br> ![file1_simple_visualization.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.gif) **file2_circle_curvature.py** <br> ![file2_circle_curvature.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.gif) -**file3_curvature_intuition.gif** <br> -![file3_curvature_intuition.gif](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_intuition.gif) - -**file4_different_curvature_single_curve.py** +**file4_different_curvature_single_curve.py** <br> ![file4_different_curvature_single_curve.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.gif) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/README.md index d6b89ef..29d2f6a 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/README.md +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/README.md @@ -1,14 +1,14 @@ **file1_line_eqn.py**<br> ![file1_line_eqn.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file1_line_eqn.gif) -**file2_point_normal_form_plane.py** +**file2_point_normal_form_plane.py**<br> ![file2_point_normal_form_plane.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file2_point_normal_form_plane.gif) -**file3_intercept_form_plane.py** +**file3_intercept_form_plane.py**<br> ![file3_intercept_form_plane.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file3_intercept_form_plane.gif) -**file4_3d_plane.py** +**file4_3d_plane.py**<br> ![file4_3d_plane.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file4_3d_plane.gif) -**file5_vector_form_line.py** +**file5_vector_form_line.py**<br> ![file5_vector_form_line.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file5_vector_form_line.gif) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/README.md index be358ac..8a47a0e 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/README.md +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/README.md @@ -1,11 +1,11 @@ -**file1_parametric_circle..py** +**file1_parametric_circle..py** <br> ![file1_parametric_circle.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/file1_parametric_circle.gif) -**file2_cycloid_manim.py** +**file2_cycloid_manim.py** <br> ![file2_cycloid_manim.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/file2_cycloid_manim.gif) -**file3_brachistochrone.py** +**file3_brachistochrone.py** <br> ![file3_brachistochrone.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/file3_brachistochrone.gif) -**file4_helix_visualization.py** +**file4_helix_visualization.py** <br> ![file4_helix_visualization.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/general-parametric-curves/file4_helix_visualization.gif) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/README.md index 18516b7..42f5df1 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/README.md +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/README.md @@ -1,7 +1,7 @@ -**file1_parametric_ellipse.py** +**file1_parametric_ellipse.py** <br> ![file1_parametric_ellipse.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.gif) -**file2_parametric_helix.py** +**file2_parametric_helix.py** <br> ![file2_parametric_helix.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.gif) **file3_circletosphere.py** <br> diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/README.md new file mode 100644 index 0000000..34885b2 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/README.md @@ -0,0 +1,2 @@ +**file2_tnb_frame_manim.py** <br> +![file2_tnb_frame_manim.py](https://github.com/saarthdeshpande/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.gif) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_TNB_frame.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame.gif Binary files differindex 097652f..097652f 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_TNB_frame.gif +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.gif Binary files differnew file mode 100644 index 0000000..784b6a6 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.py new file mode 100644 index 0000000..ee5e717 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/tnb-frame-and-serret-frenet-formulae/file2_tnb_frame_manim.py @@ -0,0 +1,125 @@ +from manimlib.imports import * + +class tnb(ThreeDScene): + def construct(self): + self.set_camera_orientation(phi = 75*DEGREES, theta=45*DEGREES) + + t = TextMobject(r'T', color = YELLOW) + n = TextMobject(r'N', color = BLUE).next_to(t, RIGHT, buff=0) + b = TextMobject(r'B', color = GREEN_E).next_to(n, RIGHT, buff=0) + frame = TextMobject(r'Frame').next_to(b, RIGHT, buff=0.2) + + text = VGroup(*[t,n,b,frame]).move_to(ORIGIN).shift(3*UP) + + helix1 = ParametricFunction( + lambda t: np.array([ + np.cos(TAU*t), + np.sin(TAU*t), + 0.4*t + ]), t_min = -2*np.pi/3, t_max = -1.638*np.pi/3, color = WHITE + ) + + helix2 = ParametricFunction( + lambda t: np.array([ + np.cos(TAU*t), + np.sin(TAU*t), + 0.4*t + ]), t_min = -1.638*np.pi/3, t_max = -1.33*np.pi/3, color = WHITE + ) + + helix3 = ParametricFunction( + lambda t: np.array([ + np.cos(TAU*t), + np.sin(TAU*t), + 0.4*t + ]), t_min = -1.33*np.pi/3, t_max = -np.pi/3, color = WHITE + ) + + helix4 = ParametricFunction( + lambda t: np.array([ + np.cos(TAU*t), + np.sin(TAU*t), + 0.4*t + ]), t_min = -np.pi/3, t_max = -1.3*np.pi/6, color = WHITE + ) + + helix5 = ParametricFunction( + lambda t: np.array([ + np.cos(TAU*t), + np.sin(TAU*t), + 0.4*t + ]), t_min = -1.3*np.pi/6, t_max = 0, color = WHITE + ) + + helix_dot = Dot(radius = 0.16, color = RED) + + dot0 = Dot(np.array([np.cos(-2*np.pi/3), np.sin(-2*np.pi/3), -0.8*np.pi/3]), radius = 0.16, color=RED).shift(np.array([4.65,0,-0.8])) + tgt0 = Arrow((0,0,0), (1,2,0), color = YELLOW).shift(dot0.get_center() - np.array([0.04,0.2,0])) + nm0 = Arrow((0,0,0), (-2,1,0), color = BLUE).shift(dot0.get_center() + np.array([0.3,0,0])) + bnm0 = Arrow((0,0,0), (0,2,0), color = GREEN_E).shift(6.1*LEFT + 3*DOWN) + plane0 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(dot0.get_center() + np.array([-0.35, 0.85, 0])).scale(1.2).rotate(65*DEGREES) + point0 = VGroup(*[dot0, tgt0, nm0, bnm0, plane0]).scale(0.8).shift(np.array([1,0,0])) + + dot1 = Dot(np.array([np.cos(-np.pi/3), np.sin(-np.pi/3), -0.4*np.pi/3]) + np.array([0,0.2,0]), radius = 0.16, color=RED) + tgt1 = Arrow((0,0,0), (-2,-0.55,0), color = YELLOW).shift(dot1.get_center() + np.array([0.18,0.04,0])) + nm1 = Arrow((0,0,0), (0.4,-2,0), color = BLUE).shift(dot1.get_center() + np.array([0,0.26,0])) + bnm1 = Arrow((0,0,0), (0,2,0), color=GREEN_E).shift(3.68*RIGHT+2.48*DOWN) + plane1 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(dot1.get_center() + np.array([-0.4, -0.6, 0])).rotate(13*DEGREES).scale(1.2) + point1 = VGroup(*[dot1, tgt1, nm1, plane1]).scale(0.8).shift(np.array([1,6.25,0])) + + dot2 = Dot(np.array([np.cos(-np.pi/6), np.sin(-np.pi/6), -0.2*np.pi/3]) - np.array([1.9,0,0]), radius=0.16,color=RED) + tgt2 = Arrow((0,0,0), (1,-2,0), color = YELLOW).shift(dot2.get_center() + np.array([-0.2,0.2,0])) + nm2 = Arrow((0,0,0), (2,1,0), color = BLUE).shift(dot2.get_center() + np.array([-0.2,-0.06,0])) + bnm2 = Arrow((0,0,0), (0,2,0), color=GREEN_E).shift(0.4*RIGHT + 0.16*DOWN) + plane2 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(dot2.get_center() + np.array([0.92, -0.5, 0])).rotate(23*DEGREES).scale(1.2) + point2 = VGroup(*[dot2, tgt2, nm2, bnm2, plane2]) + + helix = VGroup(*[helix1, helix2, helix3, helix4, helix5]) + self.add_fixed_in_frame_mobjects(text) + self.play(FadeIn(helix), FadeIn(text)) + self.play(ApplyMethod(helix.scale, 4)) + self.add_fixed_in_frame_mobjects(bnm0) + self.play(FadeIn(point0), MoveAlongPath(helix_dot, helix1, run_time=5)) + + self.add_fixed_in_frame_mobjects(bnm1) + self.play(ApplyMethod(point0.set_color, GRAY), FadeIn(point1)) + self.play(MoveAlongPath(helix_dot, helix2, run_time = 5)) + + self.add_fixed_in_frame_mobjects(bnm2) + self.play(ApplyMethod(point1.set_color, GRAY), ApplyMethod(bnm1.set_color, GRAY), FadeIn(point2)) + self.play(MoveAlongPath(helix_dot, helix3, run_time=5)) + + dot3 = Dot(np.array([np.cos(-np.pi/3), np.sin(-np.pi/3), -0.4*np.pi/3]) + np.array([3.3,-0.25,0]), radius = 0.16, color=RED) + tgt3 = Arrow((0,0,0), (0,2,0), color = YELLOW).shift(helix_dot.get_center() - np.array([-0.05,0.2,0])) + nm3 = Arrow((0,0,0), (-2,0,0), color = BLUE).shift(helix_dot.get_center() + np.array([0.25,0,0])) + bnm3 = Arrow((0,0,0), (0,2,0), color = GREEN_E).shift(3.87*LEFT + 1.24*DOWN) + plane3 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(helix_dot.get_center() + np.array([-0.5, 0.62, 0])) + point3 = VGroup(*[dot3, tgt3, nm3, bnm3, plane3]).shift(np.array([0,0,0])) + + dot4 = Dot(np.array([np.cos(-np.pi/12), np.sin(-np.pi/12), -0.1*np.pi/3]) + np.array([-3.4,3.4,0]), radius = 0.16, color=RED) + tgt4 = Arrow((0,0,0), (-2,-0.85,0), color = YELLOW).shift(dot4.get_center() - np.array([-0.05,0,0])) + nm4 = Arrow((0,0,0), (0.8,-2,0), color = BLUE).shift(dot4.get_center() + np.array([-0.1,0.25,0])) + bnm4 = Arrow((0,0,0), (0,2,0), color = GREEN_E).shift(4.03*RIGHT + 0.5*DOWN) + plane4 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(dot4.get_center() + np.array([-0.4,-1,0])).rotate(22*DEGREES).scale(1.2) + point4 = VGroup(*[dot4, tgt4, nm4, bnm4, plane4]) + + dot5 = Dot((1,0,0) + np.array([2.3,-1,1])) + tgt5 = Arrow((0,0,0), (0,2,0), color = YELLOW).shift(dot5.get_center() - np.array([-0.05,0.2,0])) + nm5 = Arrow((0,0,0), (-2,0,0), color = BLUE).shift(dot5.get_center() + np.array([0.25,0,0])) + bnm5 = Arrow((0,0,0), (0,2,0), color = GREEN_E).shift(3.34*LEFT+0.3*UP) + plane5 = Square(color = DARK_BROWN, fill_color = WHITE, fill_opacity=0.3).shift(dot5.get_center() + np.array([-0.5,0.5,0])) + point5 = VGroup(*[tgt5, nm5, bnm5, plane5]) + + self.add_fixed_in_frame_mobjects(bnm3) + self.play(ApplyMethod(point2.set_color, GRAY), FadeIn(point3)) + self.play(MoveAlongPath(helix_dot, helix4, run_time=5)) + + self.add_fixed_in_frame_mobjects(bnm4) + self.play(ApplyMethod(point3.set_color, GRAY), FadeIn(point4)) + self.play(MoveAlongPath(helix_dot, helix5, run_time=5)) + + self.add_fixed_in_frame_mobjects(bnm5) + self.play(ApplyMethod(point4.set_color, GRAY), FadeIn(point5)) + self.wait(2) + + self.play(FadeOut(VGroup(*[helix, bnm1, point0, point1, point2, point3, point4, point5, helix_dot]))) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/README.md b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/README.md index 8092cf7..bc571c6 100644 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/README.md +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/README.md @@ -1,5 +1,2 @@ -**file1_smooth_curves.gif** -![file1_smooth_curves.gif](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/file1_smooth_curves.gif) - -**file2_tangent_space_curve.py** +**file2_tangent_space_curve.py** <br> ![file2_tangent_space_curve.py](https://raw.githubusercontent.com/saarthdeshpande/FSF-mathematics-python-code-archive/master/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/velocity-and-differentiability/file2_tangent_space_curve.gif) 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 Binary files differnew file mode 100644 index 0000000..27dcac8 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file5_surface.gif 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######### + + |