diff options
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves')
9 files changed, 258 insertions, 0 deletions
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 new file mode 100644 index 0000000..18516b7 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/README.md @@ -0,0 +1,11 @@ +**file1_parametric_ellipse.py** +![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](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> +![file3_circletosphere.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/file3_circletosphere.gif) + +**file4_cone.py** <br> +![file4_cone.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/file4_cone.gif) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.gif Binary files differnew file mode 100644 index 0000000..90c0349 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.py new file mode 100644 index 0000000..1ce29d7 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file1_parametric_ellipse.py @@ -0,0 +1,78 @@ +from manimlib.imports import * + +class parametricEllipse(ThreeDScene, GraphScene): + def construct(self): + self.x_min = -5 + self.y_min = -5 + self.graph_origin = ORIGIN + self.x_max = 5 + self.y_max = 5 + self.x_axis_label = "" + self.y_axis_label = "" + self.x_axis_width = 10 + self.y_axis_height = 10 + + axes = [] + + self.setup_axes() + self.axes.scale(0.5).shift(3*LEFT) + axes.append(self.axes) + self.setup_axes() + self.axes.scale(0.3).shift(3*RIGHT + 2*UP) + axes.append(self.axes) + self.setup_axes() + self.axes.scale(0.3).shift(3*RIGHT + 2*DOWN) + axes.append(self.axes) + + axes = VGroup(*axes) + t_value = ValueTracker(-3.14) + t_tex = DecimalNumber(t_value.get_value()).add_updater(lambda v: v.set_value(t_value.get_value())) + t_label = TexMobject("t = ") + group = VGroup(t_tex,t_label).shift(3*DOWN) + t_label.next_to(t_tex,LEFT, buff=0.2,aligned_edge=t_label.get_bottom()) + + asint_text = TextMobject(r'$x = a\sin{t}$').scale(0.7).shift(4*RIGHT + 3*UP) + xlabel1 = TextMobject(r'$x$').shift(3.3*RIGHT + 3.7*UP).scale(0.7) + tlabel1 = TextMobject(r'$t$').shift(4.8*RIGHT + 2*UP).scale(0.7) + up_text = VGroup(*[asint_text, xlabel1, tlabel1]) + asint = ParametricFunction( + lambda t: np.array([ + t, + np.sin(t), + 0 + ]), t_min = -np.pi, t_max = np.pi, color = GREEN_E + ).shift(3*RIGHT + 2*UP).scale(0.4) + + bcost_text = TextMobject(r'$y = b\cos{t}$').scale(0.7).shift(4*RIGHT + DOWN) + ylabel1 = TextMobject(r'$y$').shift(3.3*RIGHT+0.3*DOWN).scale(0.7) + tlabel2 = TextMobject(r'$t$').shift(4.8*RIGHT + 2*DOWN).scale(0.7) + down_text = VGroup(*[bcost_text, ylabel1, tlabel2]) + bcost = ParametricFunction( + lambda t: np.array([ + t, + 1.5*np.cos(t), + 0 + ]), t_min = -np.pi, t_max = np.pi, color = BLUE + ).shift(3*RIGHT + 2*DOWN).scale(0.4) + + up_dot = Dot(color = RED) + down_dot = Dot(color = RED) + ellipse_dot = Dot(color = RED) + + ylabel2 = TextMobject(r'$y$').scale(0.7).shift(3*UP + 3*LEFT) + xlabel2 = TextMobject(r'$x$').scale(0.7) + ellipse_text = TextMobject(r'$x = a\sin{t}$ \\ $y = b\cos{t}$').scale(0.7).shift(2*UP + 1.3*LEFT) + main_text = VGroup(*[xlabel2, ylabel2, ellipse_text]) + ellipse = ParametricFunction( + lambda t: np.array([ + 1.5*np.cos(t), + np.sin(t), + 0 + ]), t_min = -np.pi, t_max = np.pi, color = WHITE + ).shift(3*LEFT) + self.play(FadeIn(axes), FadeIn(asint), FadeIn(bcost), FadeIn(ellipse), FadeIn(up_text), FadeIn(down_text), FadeIn(main_text), FadeIn(group)) + self.wait(1) + self.play(MoveAlongPath(up_dot, asint, run_time = 7), MoveAlongPath(down_dot, bcost, run_time = 7), MoveAlongPath(ellipse_dot, ellipse, run_time = 7), t_value.set_value,3.14, rate_func=linear, run_time=7) + self.wait(1) + self.play(FadeOut(VGroup(*[axes, asint, bcost, ellipse, up_text, down_text, main_text, up_dot, down_dot, ellipse_dot, group]))) + self.wait(1) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.gif Binary files differnew file mode 100644 index 0000000..4f349b1 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.py new file mode 100644 index 0000000..3791752 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file2_parametric_helix.py @@ -0,0 +1,91 @@ +from manimlib.imports import * + +class parametricHelix(ThreeDScene, GraphScene): + def construct(self): + self.x_min = -5 + self.y_min = -4 + self.graph_origin = ORIGIN + self.x_max = 5 + self.y_max = 4 + self.x_axis_label = "" + self.y_axis_label = "" + self.x_axis_width = 10 + self.y_axis_height = 7.5 + ax1 = ThreeDAxes().scale(0.65).shift(2.6*RIGHT+DOWN+np.array([0,0,0.5])) + axes_group = [] + + self.setup_axes() + self.axes.shift(3*RIGHT + 2*UP).scale(0.3) + axes_group.append(self.axes) + + self.setup_axes() + self.axes.shift(3*RIGHT + 2*DOWN).scale(0.3) + axes_group.append(self.axes) + + axes_group = VGroup(*axes_group) + + asint_text = TextMobject(r'$x = a\sin{t}$').scale(0.7).shift(4*RIGHT + 3*UP) + xlabel1 = TextMobject(r'$x$').shift(3.3*RIGHT + 3.7*UP).scale(0.7) + tlabel1 = TextMobject(r'$t$').shift(5*RIGHT + 2*UP).scale(0.7) + up_text = VGroup(*[asint_text, xlabel1, tlabel1]) + asint = ParametricFunction( + lambda t: np.array([ + t, + np.sin(t), + 0 + ]), t_min = -4*np.pi, t_max = 4*np.pi, color = GREEN_E + ).shift(3*RIGHT + 2*UP).scale(0.12) + + acost_text = TextMobject(r'$y = a\cos{t}$').scale(0.7).shift(4*RIGHT + DOWN) + ylabel1 = TextMobject(r'$y$').shift(3.3*RIGHT+0.3*DOWN).scale(0.7) + tlabel2 = TextMobject(r'$t$').shift(5*RIGHT + 2*DOWN).scale(0.7) + down_text = VGroup(*[acost_text, ylabel1, tlabel2]) + acost = ParametricFunction( + lambda t: np.array([ + t, + np.cos(t), + 0 + ]), t_min = -4*np.pi, t_max = 4*np.pi, color = BLUE + ).shift(3*RIGHT + 2*DOWN).scale(0.12) + + up_dot = Dot(color = RED).scale(0.6) + down_dot = Dot(color = RED).scale(0.6) + helix_dot = Dot(radius = 0.16, color = RED) + + zlabel = TextMobject(r'$z$').scale(0.7).shift(3*UP + 2.8*LEFT) + ylabel2 = TextMobject(r'$y$').scale(0.7).shift(0.3*DOWN+0.15*RIGHT) + xlabel2 = TextMobject(r'$x$').scale(0.7).shift(0.5*DOWN + 6.4*LEFT) + helix_text = TextMobject(r'$x = a\sin{t}$ \\ $y = a\cos{t}$ \\ $z = ct$').scale(0.7).shift(2.3*UP + 1.3*LEFT) + main_text = VGroup(*[xlabel2, ylabel2, zlabel, helix_text]) + helix = 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.8*np.pi/3, color = WHITE + ).shift(ax1.get_center()) + + self.set_camera_orientation(phi = 75*DEGREES, theta=45*DEGREES) + + t_tracker = ValueTracker(-12.56) + t=t_tracker.get_value + + t_label = TexMobject( + "t = ",color=WHITE + ).next_to(helix_text,DOWN, buff=0.2).scale(0.6) + + t_text = always_redraw( + lambda: DecimalNumber( + t(), + color=WHITE, + ).next_to(t_label, RIGHT, buff=0.2) + ).scale(0.6) + + group = VGroup(t_text,t_label).scale(1.5).move_to(ORIGIN).shift(2*DOWN) + self.add_fixed_in_frame_mobjects(axes_group, main_text, up_text, down_text, acost, asint) + self.play(FadeIn(ax1), FadeIn(axes_group), FadeIn(asint), FadeIn(acost), FadeIn(helix), FadeIn(up_text), FadeIn(down_text), FadeIn(main_text)) + #self.begin_ambient_camera_rotation(rate = 0.06) + self.add_fixed_in_frame_mobjects(up_dot, down_dot, group) + self.play(MoveAlongPath(up_dot, asint, run_time = 8), MoveAlongPath(down_dot, acost, run_time = 8), MoveAlongPath(helix_dot, helix, run_time = 8), t_tracker.set_value,12.56, rate_func=linear, run_time=8) + self.play(FadeOut(VGroup(*[ax1, axes_group, asint, acost, helix, up_text, down_text, main_text, up_dot, down_dot, helix_dot, group]))) + self.wait(1) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.gif Binary files differnew file mode 100644 index 0000000..d6a8afc --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.py new file mode 100644 index 0000000..6c0e810 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file3_circletosphere.py @@ -0,0 +1,45 @@ +from manimlib.imports import * + +class sphere(GraphScene, ThreeDScene): + CONFIG = { + 'x_min': -10, + 'x_max': 10, + 'y_min': -10, + 'y_max': 10, + 'graph_origin': ORIGIN, + "x_axis_width": 10, + "y_axis_height": 10, + } + def construct(self): + XTD = self.x_axis_width/(self.x_max- self.x_min) + YTD = self.y_axis_height/(self.y_max- self.y_min) + circleeqn = TextMobject(r'Hence, $x^{2} + y^{2} = 2(r^{2} - u^{2})$') + plottext = TextMobject(r'$x = \sqrt{r^{2} - u^{2}}cos\theta$ \\ $y = \sqrt{r^{2} - u^{2}}sin\theta$').shift(2*UP + 3*RIGHT) + + + self.setup_axes() + self.play(FadeIn(self.axes), FadeIn(plottext)) + + dots = [] + for t in range(19): + dot = Dot().shift((3*XTD*np.cos(t), 3*YTD*np.sin(t),0)) + dots.append(dot) + self.play(FadeIn(dot), run_time = 0.2) + dots = VGroup(*dots) + circle = Circle(radius = 3*XTD).set_color(WHITE).set_stroke(width = 10) + self.play(FadeIn(circle), FadeOut(dots), FadeOut(plottext)) + self.wait(2) + + + axes = ThreeDAxes(**self.CONFIG) + sph = Sphere(radius = 3).scale(0.5) + text2 = TextMobject(r'Setting $u = 3$,\\$z = u$').shift(4*YTD*UP + 5*XTD*RIGHT) + + self.play(Transform(self.axes,axes), ReplacementTransform(circle, sph)) + self.add(text2) + self.wait(2) + self.remove(text2) + self.move_camera(phi = 60*DEGREES, theta=45*DEGREES,run_time=5) + self.begin_ambient_camera_rotation(rate=0.03) + self.play(FadeOut(axes), FadeOut(sph), FadeOut(self.axes)) + self.wait(1) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.gif Binary files differnew file mode 100644 index 0000000..b126d20 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.gif diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.py new file mode 100644 index 0000000..e6ae1c6 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.py @@ -0,0 +1,33 @@ +from manimlib.imports import * + +class cone(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + eqn = TextMobject(r'$z^{2} = x^{2} + y^{2}$') + + conecurve = ParametricFunction( + lambda t: np.array([ + t*np.cos(TAU*t), + t*np.sin(TAU*t), + t + ]), t_min = -2.6, t_max = 2.6 + ).scale(0.85) + + conesurface = ParametricSurface( + lambda u,v: np.array([ + 3*np.sin(u)*np.cos(TAU*v), + 3*np.sin(u)*np.sin(TAU*v), + 2.7*u + ]), u_min = -1 + ).scale(0.85) + + self.play(FadeIn(eqn)) + self.wait(2) + self.play(FadeOut(eqn)) + self.set_camera_orientation(phi = 75*DEGREES, theta=50*DEGREES) + self.play(FadeIn(axes), ShowCreation(conecurve, run_time = 3)) + self.play(FadeOut(conecurve), FadeIn(conesurface)) + self.begin_ambient_camera_rotation(rate=0.03) + self.wait(2) + self.play(FadeOut(axes), FadeOut(conesurface)) + self.wait(2) |