From 8096534204aeb06ea8e4b7a25c5bf4f7f1d52ffb Mon Sep 17 00:00:00 2001 From: Saarth Deshpande Date: Wed, 1 Jul 2020 18:49:14 +0530 Subject: arc length video --- .../arc-length-and-curvature/file1_arc_length.gif | Bin 0 -> 822369 bytes .../arc-length-and-curvature/file1_arc_length.py | 325 +++++++++++++++++++++ .../file1_simple_visualization.gif | Bin 675451 -> 0 bytes .../file1_simple_visualization.py | 69 ----- .../file2_circle_curvature.gif | Bin 346667 -> 0 bytes .../file2_circle_curvature.py | 27 -- .../file2_simple_visualization.gif | Bin 0 -> 675451 bytes .../file2_simple_visualization.py | 69 +++++ .../file3_circle_curvature.gif | Bin 0 -> 346667 bytes .../file3_circle_curvature.py | 27 ++ .../file3_curvature_interpretation.gif | Bin 700862 -> 0 bytes .../file3_curvature_interpretation.py | 42 --- .../file4_curvature_interpretation.gif | Bin 0 -> 700862 bytes .../file4_curvature_interpretation.py | 42 +++ .../file4_different_curvature_single_curve.gif | Bin 243868 -> 0 bytes .../file4_different_curvature_single_curve.py | 78 ----- .../file5_different_curvature_single_curve.gif | Bin 0 -> 243868 bytes .../file5_different_curvature_single_curve.py | 76 +++++ 18 files changed, 539 insertions(+), 216 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.gif create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.py delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.gif delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.py delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.gif delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.py create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.gif create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.py create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.gif create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.py delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.gif delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.py create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.gif create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.py delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.gif delete mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.py create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.gif create mode 100644 FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.gif new file mode 100644 index 0000000..bbad112 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.gif differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.py new file mode 100644 index 0000000..75c19aa --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_arc_length.py @@ -0,0 +1,325 @@ +# Contribution creidts: Somnath Pandit + +from manimlib.imports import * + + +class LineIntegrationAsSum(GraphScene): + CONFIG = { + "x_min" : 0, + "x_max" : 10, + "y_min" : 0, + "y_max" : 6, + "graph_origin": ORIGIN+5*LEFT+3*DOWN, + "x_axis_width": 10, + "y_axis_height": 6 , + "x_tick_frequency": 2, + "y_tick_frequency": 2, + "Func":lambda x : 1+x**1.3*np.exp(-.12*(x-2)**2)*np.sin(x/4), + "a": 1 ,"b": 9, "n": 15, + } + + def construct(self): + X = RIGHT*self.x_axis_width/(self.x_max- self.x_min) + Y = UP*self.y_axis_height/(self.y_max- self.y_min) + self.X=X ;self.Y=Y + + self.setup_axes(animate=False) + + + curve=self.get_graph( + self.Func, + x_min=self.a, + x_max=self.b, + ) + curve.set_color([BLACK,BLUE,BLUE,BLUE,BLACK]) + curve_label= self.get_graph_label( + curve, + label="\\text{Curve for integration:}", + x_val=4, + direction=UR, + buff=.6, + color=BLUE + ) + self.curve=curve + self.curve_label=curve_label + + self.get_vector_field() + + + self.play(ShowCreation(VGroup(curve,curve_label))) + self.wait(.6) + self.break_in_arcs() + self.show_the_sum() + + self.wait(2) + + + def get_vector_field(self): + func = lambda v: np.array([ + v[0], # x + -v[1], # y + 0 # z + ]) + vector_field= VectorField( + func, + delta_x=1, + delta_y=1, + colors=[GREEN_A,GREEN_C], + length_func= lambda norm: .8*sigmoid(norm), + vector_config={ + "stroke_width": 2 + } + ) + + self.vector_field= vector_field + + + def break_in_arcs(self): + + self.write_about_breaking() + + dl=0.8 + self.get_breakers(dl) + self.wait(2) + self.play(FadeOut(self.upto_break_text)) + self.dl=dl + + def write_about_breaking(self): + breaking_text=TextMobject("\\texttt{is broken}"," into small ", "subarcs") + breaking_text.set_color_by_tex_to_color_map({ + "broken":RED,"subarcs": BLUE + }) + breaking_text.next_to(self.curve_label,DOWN) + breaking_text.align_to(self.curve_label,LEFT) + self.play( + Write(breaking_text) + ) + + self.upto_break_text=VGroup( + self.curve_label, + breaking_text, + ) + + def get_breakers(self,dl): + point=self.a + points=[] + while point<(self.b-dl) : + start=point + end=point+dl + points += [end] + breaker=Line( + self.input_to_graph_point(start,self.curve), + self.input_to_graph_point(end,self.curve), + stroke_width=2, + color=RED, + ) + breaker.rotate(PI/2).scale(.5) + + point=end + self.play(FadeIn(breaker),run_time=.2) + # self.add(breaker) + + del points[-1] + self.points=points + + + def show_the_sum(self): + at_any_points_text=TextMobject("At an arbitrary ","point", " in each ", "subarc") + at_any_points_text.set_color_by_tex_to_color_map({ + "point":YELLOW , "subarc": BLUE + }) + at_any_points_text.to_edge(TOP,buff=SMALL_BUFF) + + evaluate_text=TextMobject("$\\vec F(x,y)$ ", "is evaluated").next_to(at_any_points_text,DOWN) + evaluate_text.set_color_by_tex("$\\vec F(x,y)$",ORANGE) + + multiply_text=TextMobject("...is multiplied with ","$\\Delta s_i$") + multiply_text.set_color_by_tex("\\Delta s_i", BLUE) + multiply_text.next_to(at_any_points_text,DOWN) + + + + self.at_any_points_text=at_any_points_text + self.evaluate_text=evaluate_text + self.multiply_text=multiply_text + + dots=[] + for point in self.points: + + dot=Dot( + point=self.input_to_graph_point(point,self.curve), + radius= .7*DEFAULT_DOT_RADIUS, + stroke_width= 0, + fill_opacity= 1.0, + color= YELLOW, + ) + dots+=[dot] + + self.play( + Write(at_any_points_text), + FadeIn(VGroup(*dots)),run_time=1.5 + ) + self.dots=dots + + self.wait() + self.show_the_dot_product() + self.multiply_with_ds() + self.construct_equation() + + + def show_the_dot_product(self): + index=-(len(self.points)//3) + self.index=index + + dot=self.dots[index] + + + dot_prod_text=TextMobject("Dot product of ", "$\\vec F(x_i,y_i)$", " and ","$\\vec T(x_i,y_i)$") + dot_prod_text.set_color_by_tex_to_color_map({ + "\\vec F(x_i,y_i)":ORANGE , + "\\vec T(x_i,y_i)": "#DC75CD" , + }) + dot_prod_text.to_edge(TOP,buff=SMALL_BUFF) + + + point_coord=TextMobject("$(x_i,y_i)$",color=YELLOW) + point_coord.next_to(dot,DL,buff=.01).scale(.8) + + func_val=TextMobject("$\\vec F(x_i,y_i)$",color=ORANGE) + func_val.next_to(dot,UR).scale(.8) + + self.dot_prod_text=dot_prod_text + self.func_val=func_val + + dot.set_color(ORANGE).scale(1.2) + + + self.play(FadeIn(VGroup(point_coord,dot))) + self.play(Write(self.evaluate_text)) + self.wait(1) + self.play(FadeOut(self.vector_field)) + self.get_vector_and_tangent() + self.dot_product() + + + self.wait(2) + self.remove(point_coord) + + + def get_vector_and_tangent(self): + dot=self.dots[self.index] + self.show_specific_vectors(dot) + self.play(Write(self.func_val)) + self.wait(1) + self.show_tangent(dot) + self.play(FadeIn(VGroup(*[ + dot.set_color(ORANGE).scale(1.4) + for dot in self.dots ] + ))) + + + def show_specific_vectors(self,dots): + for dot in dots: + vector=self.vector_field.get_vector(dot.get_center()) + vector.set_color(ORANGE) + + self.play(Write(vector),run_time=.2) + + + def show_tangent(self,dot): + tangent_sym=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD").scale(.8) + x=dot.get_center() + angle=self.angle_of_tangent( + self.point_to_coords(x)[0], + self.curve, + dx=0.01 + ) + vect = Vector().rotate(angle,about_point=x) + vect.set_color("#DC75CD") + tangent=vect.next_to(x,DR,buff=0) + tangent_sym.next_to(tangent,DOWN,buff=.1) + self.play(Write(VGroup(tangent,tangent_sym))) + + self.tangent_sym=tangent_sym + + def dot_product(self): + + dot_sym=Dot().next_to(self.func_val,RIGHT) + + self.play(FadeOut(VGroup( + self.at_any_points_text, + self.evaluate_text + ))) + self.play(Write(self.dot_prod_text)) + self.play( + FadeIn(dot_sym), + ApplyMethod( + self.tangent_sym.next_to, + dot_sym, RIGHT + )) + + self.dot_sym=dot_sym + + def multiply_with_ds(self): + self.get_ds() + + self.play(GrowFromCenter(self.ds_brace_group)) + self.wait(2) + self.play(Write(self.multiply_text)) + self.play(ApplyMethod( + self.ds_brace_label.next_to, + self.tangent_sym, RIGHT,buff=.15 + )) + + + + def get_ds(self): + p1= self.dots[self.index] + p2= self.dots[self.index+1] + ds_brace=Brace(VGroup(p1,p2),DL) + ds_brace.move_to(p1,UR) + ds_brace_label=ds_brace.get_text("$\Delta s_i$", buff = .05) + ds_brace_label.set_color(BLUE) + self.ds_brace=ds_brace + self.ds_brace_label=ds_brace_label + self.ds_brace_group=VGroup(ds_brace,ds_brace_label) + + + def construct_equation(self): + sum_up_text=TextMobject("and"," summed ", "for all `i's") + sum_up_text.set_color_by_tex("summed",PURPLE_A) + sum_up_text.next_to(self.multiply_text,DOWN,buff=MED_SMALL_BUFF) + sum_up_text.shift(LEFT) + + sum_eqn=TextMobject("$$\\sum_i^{ } $$").set_color(PURPLE_A) + sum_eqn.move_to(self.graph_origin+6.5*self.X+4*self.Y) + + line_integral_text=TextMobject("The"," line ","integral's value is: ").to_edge(TOP,buff=MED_SMALL_BUFF) + line_integral_text.set_color_by_tex("line",BLUE_C) + approx=TextMobject("$\\approx$",color=RED).next_to(sum_eqn,LEFT) + multipled=VGroup( + self.func_val, + self.dot_sym, + self.tangent_sym, + self.ds_brace_label + ) + + + self.play(Write(sum_up_text)) + self.show_specific_vectors(self.dots) + self.play(FadeIn(sum_eqn)) + self.play(ApplyMethod( + multipled.next_to,sum_eqn,RIGHT + )) + self.wait() + self.play(FadeOut(VGroup( + self.dot_prod_text, + self.multiply_text, + sum_up_text + ))) + self.play(Write(line_integral_text)) + self.play(FadeIn(approx)) + + + +#uploaded by Somnath Pandit.FSF2020_Line Integrals diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.gif deleted file mode 100644 index 3f7ecd1..0000000 Binary files a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.py deleted file mode 100644 index 45058d7..0000000 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file1_simple_visualization.py +++ /dev/null @@ -1,69 +0,0 @@ -from manimlib.imports import * - -class randomcurve(GraphScene): - CONFIG = { - "x_min": -4, - "x_max": 6, - "y_min": -6, - "y_max": 10, - "graph_origin": ORIGIN - } - def construct(self): - intro = TextMobject('Consider the following curve.') - mid = TextMobject(r'Notice how the direction of the unit tangent vectors\\changes with respect to the arc length.') - outro = TextMobject(r'The rate of change of unit tangents with \\ respect to the arc length $ds$ is called curvature.\\Mathematically, curvature $ = k = \left|{\frac{dT}{ds}}\right|$') - - XTD = self.x_axis_width/(self.x_max- self.x_min) - YTD = self.y_axis_height/(self.y_max- self.y_min) - - tgt1 = Arrow((-2.2*XTD,-0.5*YTD,0),(-1*XTD,1,0)) - tgt2 = Arrow((-1.2*XTD, 1.93*YTD,0),(0*XTD,1.6,0)).scale(1.2) - tgt3 = Arrow((-0.3*XTD,3*YTD, 0), (1.5*XTD, 3*YTD,0)) - tgt4 = Arrow((1.4*XTD, 2*YTD,0),(2.4*XTD, 1*YTD,0)).scale(2.8) - tgt5 = Arrow((2.4*XTD, 0, 0), (3.8*XTD,-2*YTD, 0)).scale(1.2).shift(0.26*RIGHT) - tgt6 = Arrow((3.8*XTD,-1*YTD, 0), (4.8*XTD, -1*YTD, 0)).scale(2.8).shift(0.26*RIGHT) - tgt7 = Arrow((5.3*XTD, 0, 0),(6.3*XTD,1,0)).shift(0.35*LEFT+0.1*DOWN).scale(1.3) - - dot1 = Dot(tgt1.get_start(), color = RED) - dot2 = Dot(tgt2.get_start(), color = RED) - dot3 = Dot(tgt3.get_start(), color = RED) - dot4 = Dot(tgt4.get_start(), color = RED) - dot5 = Dot(tgt5.get_start(), color = RED) - dot6 = Dot(tgt6.get_start(), color = RED) - dot7 = Dot(tgt7.get_start(), color = RED) - - arc = ArcBetweenPoints(dot1.get_center(), dot2.get_center(), color = GREEN_SCREEN, angle = 10*DEGREES).rotate(180*DEGREES) - - dots = VGroup(*[dot1, dot2, dot3, dot4, dot5, dot6, dot7]) - - ds = CurvedArrow((-4, 2, 0), (tgt1.get_start() + tgt2.get_start()) / 2, color = YELLOW) - ds_text = TextMobject(r'$ds$').next_to(ds, UP, buff = 0.1).shift(1.3*LEFT) - - self.setup_axes(hideaxes=True) - graphobj = self.get_graph(self.curve) - self.play(FadeIn(intro)) - self.wait(2) - self.play(FadeOut(intro)) - self.setup_axes(hideaxes=False) - self.play(ShowCreation(graphobj), FadeIn(dots), FadeIn(ds), FadeIn(ds_text), FadeIn(arc)) - self.wait(1) - self.play(FadeOut(self.axes), FadeOut(arc), FadeOut(graphobj),FadeIn(mid), FadeOut(dots), FadeOut(ds), FadeOut(ds_text)) - self.wait(3) - self.play(FadeOut(mid)) - self.play(FadeIn(self.axes), FadeIn(graphobj), FadeIn(dots)) - - tangents = [tgt1, tgt2, tgt3, tgt4, tgt5, tgt6, tgt7] - for tangent in tangents: - self.play(ShowCreation(tangent), run_time = 0.2) - self.wait(1) - tangents = VGroup(*tangents) - self.play(FadeOut(self.axes), FadeOut(graphobj), FadeOut(tangents), FadeOut(dots)) - self.wait(1) - self.play(FadeIn(outro)) - self.wait(3) - self.play(FadeOut(outro)) - self.wait(1) - - - def curve(self, x): - return 3 - (3653*x**2)/5292 + (2477*x**3)/31752 + (13*x**4)/784 - (17*x**5)/5292 + (17*x**6)/63504 diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.gif deleted file mode 100644 index 989a3b7..0000000 Binary files a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.py deleted file mode 100644 index 232ac41..0000000 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_circle_curvature.py +++ /dev/null @@ -1,27 +0,0 @@ -from manimlib.imports import * - -class circleC(GraphScene): - CONFIG = { - "x_min": -6, - "x_max": 6, - "y_min": -6, - "y_max": 6, - "graph_origin": ORIGIN, - "x_axis_width": 12, - "y_axis_height": 12 - } - def construct(self): - epiphany = TextMobject(r'Driving a vehicle on which of \\ the two paths would be easier?').scale(0.6).shift(3.5*LEFT + 3*UP) - outro = TextMobject(r'The larger path, due to its \\ smaller curvature, since $k = \frac{1}{R}$.').scale(0.6).shift(3.7*LEFT + 3*UP) - XTD = self.x_axis_width/(self.x_max- self.x_min) - YTD = self.y_axis_height/(self.y_max- self.y_min) - - circle = Circle(radius = 2, color = BLUE) - circle2 = Circle(radius = 3, color = GREEN_E) - - self.setup_axes(hideaxes=True) - self.play(FadeIn(self.axes), Write(circle, run_time = 2), FadeIn(epiphany)) - self.play(Write(circle2, run_time = 3)) - self.play(ReplacementTransform(epiphany, outro)) - self.wait(2) - self.play(FadeOut(VGroup(*[self.axes, circle, circle2, epiphany, outro]))) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.gif new file mode 100644 index 0000000..3f7ecd1 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.gif differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.py new file mode 100644 index 0000000..45058d7 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file2_simple_visualization.py @@ -0,0 +1,69 @@ +from manimlib.imports import * + +class randomcurve(GraphScene): + CONFIG = { + "x_min": -4, + "x_max": 6, + "y_min": -6, + "y_max": 10, + "graph_origin": ORIGIN + } + def construct(self): + intro = TextMobject('Consider the following curve.') + mid = TextMobject(r'Notice how the direction of the unit tangent vectors\\changes with respect to the arc length.') + outro = TextMobject(r'The rate of change of unit tangents with \\ respect to the arc length $ds$ is called curvature.\\Mathematically, curvature $ = k = \left|{\frac{dT}{ds}}\right|$') + + XTD = self.x_axis_width/(self.x_max- self.x_min) + YTD = self.y_axis_height/(self.y_max- self.y_min) + + tgt1 = Arrow((-2.2*XTD,-0.5*YTD,0),(-1*XTD,1,0)) + tgt2 = Arrow((-1.2*XTD, 1.93*YTD,0),(0*XTD,1.6,0)).scale(1.2) + tgt3 = Arrow((-0.3*XTD,3*YTD, 0), (1.5*XTD, 3*YTD,0)) + tgt4 = Arrow((1.4*XTD, 2*YTD,0),(2.4*XTD, 1*YTD,0)).scale(2.8) + tgt5 = Arrow((2.4*XTD, 0, 0), (3.8*XTD,-2*YTD, 0)).scale(1.2).shift(0.26*RIGHT) + tgt6 = Arrow((3.8*XTD,-1*YTD, 0), (4.8*XTD, -1*YTD, 0)).scale(2.8).shift(0.26*RIGHT) + tgt7 = Arrow((5.3*XTD, 0, 0),(6.3*XTD,1,0)).shift(0.35*LEFT+0.1*DOWN).scale(1.3) + + dot1 = Dot(tgt1.get_start(), color = RED) + dot2 = Dot(tgt2.get_start(), color = RED) + dot3 = Dot(tgt3.get_start(), color = RED) + dot4 = Dot(tgt4.get_start(), color = RED) + dot5 = Dot(tgt5.get_start(), color = RED) + dot6 = Dot(tgt6.get_start(), color = RED) + dot7 = Dot(tgt7.get_start(), color = RED) + + arc = ArcBetweenPoints(dot1.get_center(), dot2.get_center(), color = GREEN_SCREEN, angle = 10*DEGREES).rotate(180*DEGREES) + + dots = VGroup(*[dot1, dot2, dot3, dot4, dot5, dot6, dot7]) + + ds = CurvedArrow((-4, 2, 0), (tgt1.get_start() + tgt2.get_start()) / 2, color = YELLOW) + ds_text = TextMobject(r'$ds$').next_to(ds, UP, buff = 0.1).shift(1.3*LEFT) + + self.setup_axes(hideaxes=True) + graphobj = self.get_graph(self.curve) + self.play(FadeIn(intro)) + self.wait(2) + self.play(FadeOut(intro)) + self.setup_axes(hideaxes=False) + self.play(ShowCreation(graphobj), FadeIn(dots), FadeIn(ds), FadeIn(ds_text), FadeIn(arc)) + self.wait(1) + self.play(FadeOut(self.axes), FadeOut(arc), FadeOut(graphobj),FadeIn(mid), FadeOut(dots), FadeOut(ds), FadeOut(ds_text)) + self.wait(3) + self.play(FadeOut(mid)) + self.play(FadeIn(self.axes), FadeIn(graphobj), FadeIn(dots)) + + tangents = [tgt1, tgt2, tgt3, tgt4, tgt5, tgt6, tgt7] + for tangent in tangents: + self.play(ShowCreation(tangent), run_time = 0.2) + self.wait(1) + tangents = VGroup(*tangents) + self.play(FadeOut(self.axes), FadeOut(graphobj), FadeOut(tangents), FadeOut(dots)) + self.wait(1) + self.play(FadeIn(outro)) + self.wait(3) + self.play(FadeOut(outro)) + self.wait(1) + + + def curve(self, x): + return 3 - (3653*x**2)/5292 + (2477*x**3)/31752 + (13*x**4)/784 - (17*x**5)/5292 + (17*x**6)/63504 diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.gif new file mode 100644 index 0000000..989a3b7 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.gif differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.py new file mode 100644 index 0000000..232ac41 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_circle_curvature.py @@ -0,0 +1,27 @@ +from manimlib.imports import * + +class circleC(GraphScene): + CONFIG = { + "x_min": -6, + "x_max": 6, + "y_min": -6, + "y_max": 6, + "graph_origin": ORIGIN, + "x_axis_width": 12, + "y_axis_height": 12 + } + def construct(self): + epiphany = TextMobject(r'Driving a vehicle on which of \\ the two paths would be easier?').scale(0.6).shift(3.5*LEFT + 3*UP) + outro = TextMobject(r'The larger path, due to its \\ smaller curvature, since $k = \frac{1}{R}$.').scale(0.6).shift(3.7*LEFT + 3*UP) + XTD = self.x_axis_width/(self.x_max- self.x_min) + YTD = self.y_axis_height/(self.y_max- self.y_min) + + circle = Circle(radius = 2, color = BLUE) + circle2 = Circle(radius = 3, color = GREEN_E) + + self.setup_axes(hideaxes=True) + self.play(FadeIn(self.axes), Write(circle, run_time = 2), FadeIn(epiphany)) + self.play(Write(circle2, run_time = 3)) + self.play(ReplacementTransform(epiphany, outro)) + self.wait(2) + self.play(FadeOut(VGroup(*[self.axes, circle, circle2, epiphany, outro]))) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.gif deleted file mode 100644 index 22a450a..0000000 Binary files a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.py deleted file mode 100644 index d8dd0a4..0000000 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file3_curvature_interpretation.py +++ /dev/null @@ -1,42 +0,0 @@ -from manimlib.imports import * - -class interpretation(Scene): - def construct(self): - tgt = Vector((1, 2, 0), color = YELLOW) - tgtText = TextMobject(r'$r\prime (t)$').next_to(tgt, UP, buff = 0).scale(0.7) - tgt2 = DashedLine((0,0,0),(1, 2, 0), color = GRAY).shift(DOWN + 2*RIGHT) - - nm = Vector((2, -1, 0), color = BLUE) - nmText = TextMobject(r'$r\prime\prime (t)$').next_to(nm, DOWN+RIGHT, buff = 0).scale(0.7) - nm2 = DashedLine((0,0,0),(2, -1, 0), color = GRAY).shift(2*UP + RIGHT) - square = Square(fill_color = WHITE, fill_opacity = 0.2).rotate(63*DEGREES).shift(0.5*UP +1.5*RIGHT).scale(1.1) - square.set_stroke(width = 0.1) - arrow = CurvedArrow(square.get_center() + np.array([2,1,0]), square.get_center() + np.array([0.5,0,0])) - arrowText = TextMobject(r'$r\prime (t)\times r\prime\prime (t)$').next_to(arrow.get_start(), DOWN+1*RIGHT, buff = 0).scale(0.7) - - text1 = TextMobject(r'$\left|\frac{dT}{ds}\right| = \frac{\left|\frac{dT}{dt}\right|}{\left|\frac{ds}{dt}\right|}$').shift(UP+3*LEFT) - text2 = TextMobject(r'$\left|\frac{dT}{ds}\right| = \frac{\frac{r\prime\prime (t)}{\left| r\prime (t)\right|}\times\frac{r\prime (t)}{\left| r\prime (t)\right|}}{\left|r\prime (t)\right|}$').next_to(text1, DOWN, buff = 0.1) - unit = VGroup(*[tgt, tgt2, nm, nm2]) - - # self.play(FadeIn(VGroup(*[tgt, tgt2, nm, nm2, nmText, tgtText, square, arrow, arrowText]))) - tgt2text = TextMobject(r'$\frac{r\prime (t)}{\left| r\prime (t)\right|}$').shift(1.1*UP).scale(0.7).rotate(63*DEGREES ) - nm2text = TextMobject(r'$\frac{r\prime\prime (t)}{\left| r\prime (t)\right|}$').scale(0.7).shift(0.7*RIGHT+0.8*DOWN).rotate(-25*DEGREES) - unit2 = unit.copy().scale(0.5).shift(0.75*LEFT+0.25*DOWN) - - self.play(FadeIn(VGroup(*[tgt, tgtText]))) - self.wait(1) - self.play(FadeIn(VGroup(*[nm, nmText]))) - self.wait(1) - self.play(FadeIn(VGroup(*[tgt2, nm2]))) - self.wait(1) - self.play(FadeIn(VGroup(*[square, arrow, arrowText]))) - self.wait(1) - self.play(FadeIn(unit2)) - self.wait(1) - self.play(FadeIn(VGroup(*[tgt2text, nm2text]))) - self.wait(1) - self.play(FadeIn(text1)) - self.wait(1) - self.play(FadeIn(text2)) - self.wait(2) - self.play(FadeOut(VGroup(*[tgt2text, nm2text, text1, text2, tgt, tgtText,nm, nmText,tgt2, nm2,square, arrow, arrowText,unit2]))) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.gif new file mode 100644 index 0000000..22a450a Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.gif differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.py new file mode 100644 index 0000000..d8dd0a4 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_curvature_interpretation.py @@ -0,0 +1,42 @@ +from manimlib.imports import * + +class interpretation(Scene): + def construct(self): + tgt = Vector((1, 2, 0), color = YELLOW) + tgtText = TextMobject(r'$r\prime (t)$').next_to(tgt, UP, buff = 0).scale(0.7) + tgt2 = DashedLine((0,0,0),(1, 2, 0), color = GRAY).shift(DOWN + 2*RIGHT) + + nm = Vector((2, -1, 0), color = BLUE) + nmText = TextMobject(r'$r\prime\prime (t)$').next_to(nm, DOWN+RIGHT, buff = 0).scale(0.7) + nm2 = DashedLine((0,0,0),(2, -1, 0), color = GRAY).shift(2*UP + RIGHT) + square = Square(fill_color = WHITE, fill_opacity = 0.2).rotate(63*DEGREES).shift(0.5*UP +1.5*RIGHT).scale(1.1) + square.set_stroke(width = 0.1) + arrow = CurvedArrow(square.get_center() + np.array([2,1,0]), square.get_center() + np.array([0.5,0,0])) + arrowText = TextMobject(r'$r\prime (t)\times r\prime\prime (t)$').next_to(arrow.get_start(), DOWN+1*RIGHT, buff = 0).scale(0.7) + + text1 = TextMobject(r'$\left|\frac{dT}{ds}\right| = \frac{\left|\frac{dT}{dt}\right|}{\left|\frac{ds}{dt}\right|}$').shift(UP+3*LEFT) + text2 = TextMobject(r'$\left|\frac{dT}{ds}\right| = \frac{\frac{r\prime\prime (t)}{\left| r\prime (t)\right|}\times\frac{r\prime (t)}{\left| r\prime (t)\right|}}{\left|r\prime (t)\right|}$').next_to(text1, DOWN, buff = 0.1) + unit = VGroup(*[tgt, tgt2, nm, nm2]) + + # self.play(FadeIn(VGroup(*[tgt, tgt2, nm, nm2, nmText, tgtText, square, arrow, arrowText]))) + tgt2text = TextMobject(r'$\frac{r\prime (t)}{\left| r\prime (t)\right|}$').shift(1.1*UP).scale(0.7).rotate(63*DEGREES ) + nm2text = TextMobject(r'$\frac{r\prime\prime (t)}{\left| r\prime (t)\right|}$').scale(0.7).shift(0.7*RIGHT+0.8*DOWN).rotate(-25*DEGREES) + unit2 = unit.copy().scale(0.5).shift(0.75*LEFT+0.25*DOWN) + + self.play(FadeIn(VGroup(*[tgt, tgtText]))) + self.wait(1) + self.play(FadeIn(VGroup(*[nm, nmText]))) + self.wait(1) + self.play(FadeIn(VGroup(*[tgt2, nm2]))) + self.wait(1) + self.play(FadeIn(VGroup(*[square, arrow, arrowText]))) + self.wait(1) + self.play(FadeIn(unit2)) + self.wait(1) + self.play(FadeIn(VGroup(*[tgt2text, nm2text]))) + self.wait(1) + self.play(FadeIn(text1)) + self.wait(1) + self.play(FadeIn(text2)) + self.wait(2) + self.play(FadeOut(VGroup(*[tgt2text, nm2text, text1, text2, tgt, tgtText,nm, nmText,tgt2, nm2,square, arrow, arrowText,unit2]))) diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.gif deleted file mode 100644 index 3b78b5f..0000000 Binary files a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.py deleted file mode 100644 index 56b7fbb..0000000 --- a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file4_different_curvature_single_curve.py +++ /dev/null @@ -1,78 +0,0 @@ -from manimlib.imports import * - -class GR(GraphScene): - CONFIG = { - "x_axis_label": "", - "y_axis_label": "", - "x_min": -4, - "x_max": 6, - "y_min": -6, - "y_max": 10, - "graph_origin": ORIGIN, - 'x_tick_frequency': 20, - 'y_tick_frequency': 20 - } - - def construct(self): - - self.setup_axes() - def curve(x): - return 3 - (3653*x**2)/5292 + (2477*x**3)/31752 + (13*x**4)/784 - (17*x**5)/5292 + (17*x**6)/63504 - - graph = FunctionGraph(curve, x_min=-3, x_max=6, stroke_width = 2, color = BLUE) - - tracker = ValueTracker(-3) - - text = TextMobject(r'$\because R_{1} > R_{2}$, the curvature at \\ point $P_{1}$ is less than that \\ at point $P_{2}$ as $\kappa = \frac{1}{R}$').shift(3.2*RIGHT+3*UP).scale(0.6) - - dot1 = Dot((0,3,0), color = YELLOW) - dot1label = TextMobject(r'$P_{1}$').next_to(dot1, UP+RIGHT, buff = 0.1) - dot2 = Dot((4,-1, 0), color = YELLOW) - dot2label = TextMobject(r'$P_{2}$').next_to(dot2, DOWN, buff = 0.1) - dots = VGroup(*[dot1, dot2, dot1label, dot2label]) - - def get_tangent_line(): - line = Line( - ORIGIN, 2 * RIGHT, - color=RED, - stroke_width=4, - ) - dx = 0.0001 - - x = tracker.get_value() - p0 = np.array([x-dx,curve(x-dx),0]) - p1 = np.array([x, curve(x), 0]) - p2 = np.array([x + dx, curve(x + dx), 0]) - - angle = angle_of_vector(p2 - p1) - line.rotate(angle) - line.move_to(p0) - return line - - circle1 = Circle(radius = 0.8, color = GREY, opacity = 0.2).shift(2.2*UP) - tgt1 = Line((-2,3,0), (2,3,0), color = GREY, opacity = 0.2).scale(0.4) - - r1 = Line(circle1.get_center(), circle1.get_center() + np.array([0,0.8,0]), color=GREEN_SCREEN) - r1label = TextMobject(r'$R_{1}$',color=WHITE).next_to(r1, RIGHT, buff = 0.1).scale(0.6) - - curvature1 = VGroup(*[circle1, tgt1, r1, r1label]) - - circle2 = Circle(radius = 0.6, color = GREY, opacity = 0.2).shift(0.4*DOWN + 4*RIGHT) - tgt2 = Line((4,-2,0), (6, -2, 0), color = GREY, opacity = 0.2).scale(0.5).shift(LEFT + UP) - - r2 = Line(circle2.get_center(), circle2.get_center() + np.array([0,-0.6,0]), color=GREEN_SCREEN) - r2label = TextMobject(r'$R_{2}$', color=WHITE).next_to(r2, 0.9*RIGHT, buff = 0).scale(0.6) - - curvature2 = VGroup(*[circle2, tgt2, r2, r2label]) - - line = always_redraw(get_tangent_line) - - self.add(graph,line, dots, text) - self.wait(1.2) - self.play(tracker.set_value, 0, rate_func=smooth, run_time=5) - self.play(FadeIn(curvature1)) - self.play(tracker.set_value, 4, rate_func=smooth, run_time=5) - self.play(FadeIn(curvature2)) - self.play(tracker.set_value, 6, rate_func=smooth, run_time=3) - self.play(FadeOut(VGroup(*[curvature1, curvature2, graph, self.axes, line, dots, text]))) - self.wait() diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.gif b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.gif new file mode 100644 index 0000000..3b78b5f Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.gif differ diff --git a/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.py b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.py new file mode 100644 index 0000000..0dc06bb --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/arc-length-and-curvature/file5_different_curvature_single_curve.py @@ -0,0 +1,76 @@ +from manimlib.imports import * + +class GR(GraphScene): + CONFIG = { + "x_axis_label": "", + "y_axis_label": "", + "x_min": -4, + "x_max": 6, + "y_min": -6, + "y_max": 10, + "graph_origin": ORIGIN, + 'x_tick_frequency': 20, + 'y_tick_frequency': 20 + } + + def construct(self): + + self.setup_axes() + def curve(x): + return 3 - (3653*x**2)/5292 + (277*x**3)/31752 + (13*x**4)/784 - (17*x**5)/5292 + (170*x**6)/63504 + + graph = FunctionGraph(curve, x_min=-2, x_max=6, stroke_width = 2, color = BLUE) + + tracker = ValueTracker(-2) + + text = TextMobject(r'$\because R_{1} > R_{2}$, the curvature at \\ point $P_{1}$ is less than that \\ at point $P_{2}$ as $\kappa = \frac{1}{R}$').shift(3.2*LEFT+3*UP).scale(0.6) + + dot1 = Dot((0,3,0), color = YELLOW) + dot1label = TextMobject(r'$P_{1}$').next_to(dot1, UP+RIGHT, buff = 0.1) + dot2 = Dot((2.9,-0.47, 0), color = YELLOW) + dot2label = TextMobject(r'$P_{2}$').next_to(dot2, DOWN, buff = 0.1) + dots = VGroup(*[dot1, dot2, dot1label, dot2label]) + + def get_tangent_line(): + line = Line( + ORIGIN, 2 * RIGHT, + color=RED, + stroke_width=4, + ) + dx = 0.0001 + + x = tracker.get_value() + p0 = np.array([x-dx,curve(x-dx),0]) + p1 = np.array([x, curve(x), 0]) + p2 = np.array([x + dx, curve(x + dx), 0]) + + angle = angle_of_vector(p2 - p1) + line.rotate(angle) + line.move_to(p0) + return line + + circle1 = Circle(radius = 0.8, color = GREY, opacity = 0.2).shift(2.2*UP) + tgt1 = Line((-2,3,0), (2,3,0), color = GREY, opacity = 0.2).scale(0.4) + + r1 = Line(circle1.get_center(), circle1.get_center() + np.array([0,0.8,0]), color=GREEN_SCREEN) + r1label = TextMobject(r'$R_{1}$',color=WHITE).next_to(r1, RIGHT, buff = 0.1).scale(0.6) + + curvature1 = VGroup(*[circle1, tgt1, r1, r1label]) + + circle2 = Circle(radius = 0.2, color = GREY, opacity = 0.2).shift(0.3*DOWN + 2.9*RIGHT) + tgt2 = Line((4,-2,0), (6, -2, 0), color = GREY, opacity = 0.2).scale(0.5).shift(2.1*LEFT + 1.5*UP) + + r2 = Line(circle2.get_center(), circle2.get_center() - np.array([0,0.2,0]), color=GREEN_SCREEN) + r2label = TextMobject(r'$R_{2}$', color=WHITE).next_to(r2.get_start(), np.array([0,0,0]), buff = 0).scale(0.4) + + curvature2 = VGroup(*[circle2, tgt2, r2, r2label]) + + line = always_redraw(get_tangent_line) + + self.add(graph, line, dots, text) + self.wait(1.2) + self.play(tracker.set_value, 4, rate_func=smooth, run_time=10) + self.play(FadeIn(curvature1), FadeIn(curvature2)) + self.wait(2) + self.play(FadeOut(VGroup(*[curvature1, curvature2, graph, self.axes, line, dots, text]))) + self.wait() -- cgit