diff options
Diffstat (limited to 'FSF-2020/calculus/intro-to-calculus')
3 files changed, 166 insertions, 0 deletions
diff --git a/FSF-2020/calculus/intro-to-calculus/limit/limit3.py b/FSF-2020/calculus/intro-to-calculus/limit/limit3.py new file mode 100644 index 0000000..a4f07d7 --- /dev/null +++ b/FSF-2020/calculus/intro-to-calculus/limit/limit3.py @@ -0,0 +1,95 @@ +from manimlib.imports import * +class limit3(GraphScene, MovingCameraScene): + def setup(self): + GraphScene.setup(self) + MovingCameraScene.setup(self) + CONFIG = { + "y_max" : 10, + "y_min" : 0, + "x_max" : 100, + "x_min" : 0, + "y_tick_frequency" : 1, + "x_tick_frequency" : 10, + "axes_color" : WHITE, + "num_graph_anchor_points": 3000, #this is the number of points that graph manim + "graph_origin" : ORIGIN+3*DOWN+4*LEFT, + "x_labeled_nums": list(range(0,101))[::10], + "y_labeled_nums": list(range(0,11)), + "x_axis_label":"$x$", + "y_axis_label":"$f(x)$", + "x_axis_width": 10, + "y_axis_height": 5, + } + 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) + sqr1 = Square(side_length = 15).move_to(np.array([1,0.5,0])) + sqr2 = Square(side_length = 15).move_to(np.array([-4,-3,0])) + + textdef = TextMobject("") + text20 = TextMobject("f(x) is not defined at x=50").move_to(np.array([1,0.3,0])).scale(0.2) + text21 = TexMobject(r"\text {f(x) is not defined in interval }",r" (-\infty ,\quad 1]").move_to(np.array([-4,-3.2,0])).scale(0.18) + text22 = TextMobject("1").move_to(np.array([-3.9,-3.05,0])).scale(0.2) + text1 = TexMobject(r"\text {Let }" ,r"f\left( x \right) =\begin{cases} \sqrt { x-1 } ,x\in \quad (1,\infty )-50 \end{cases}") + text2 = TextMobject("Graph of f(x) is ") + text3 = TextMobject("Right hand neighbour of 50 will approximately be 50.000001").move_to(np.array([1,0.3,0])).scale(0.15) + text4 = TextMobject("Left hand neighbour of 50 will approximately be 49.999999").move_to(np.array([1,0.3,0])).scale(0.15) + text5 = TexMobject(r"\text {Hence R.H.L }", r"=\lim _{ x\rightarrow { 50 }^{ + } }{ \sqrt { 50.000001 - 1 } } \approx 7.000000071").move_to(np.array([1,0.3,0])).scale(0.13) + text6 = TexMobject(r"\text{Hence L.H.L }", r" = \lim _{ x\rightarrow { 50 }^{ - } }{ \sqrt { 49.999999-1 } }\approx 6.999999929").move_to(np.array([1,0.3,0])).scale(0.13) + text7 = TextMobject("7.000000071").move_to(np.array([1.9,0.25,0])).scale(0.1) + text8 = TextMobject("6.999999929").move_to(np.array([0.1,0.25,0])).scale(0.1) + text9 = TexMobject(r"6.999999929\quad \approx \quad 7.000000071 \quad \approx 7").move_to(np.array([1,0.25,0])).scale(0.2) + text10 = TexMobject(r"\text{Because LHL }" ,r"\approx" ,r"\text{ RHL, Limit exists at x=50 and equals 7").move_to(np.array([1,0.25,0])).scale(0.13) + text11 = TextMobject("There is no Left hand neighbour of x=1").move_to(np.array([-4,-3.2,0])).scale(0.22) + text12 = TexMobject(r"\therefore\quad \lim _{ x\rightarrow 0 }{ f(x) } \quad =\quad \lim _{ x\rightarrow { 0 }^{ + } }{ f(x) } ").move_to(np.array([-4,-3.2,0])).scale(0.25) + text13 = TexMobject(r"\text {R.H.L =}",r" \lim _{ x\rightarrow { 0 }^{ + } }{ \sqrt { 1.000000000001-1 } } \quad \approx 0").move_to(np.array([-4,-3.2,0])).scale(0.13) + text14 = TexMobject(r"\therefore \quad \lim _{ x\rightarrow 0 }{ f(x)\quad =\quad 0 }").move_to(np.array([-4,-3.2,0])).scale(0.13) + self.camera_frame.save_state() + self.play(ShowCreation(text1)) + self.wait(3) + self.play(ReplacementTransform(text1, text2)) + self.wait() + self.play(ReplacementTransform(text2, textdef)) + self.setup_axes() + self.setup() + graph_1 = self.get_graph(lambda x : (x-1)**(1/2),color = PINK, x_min = 1, x_max = 49.9) + graph_2 = self.get_graph(lambda x : (x-1)**(1/2),color = PINK, x_min = 50.1, x_max = 100) + graph_3 = self.get_graph(lambda x : (x-1)**(1/2),color = PINK, x_min = 1.05, x_max = 1.001) + dot1 = SmallDot(color = PURPLE_A) + cir = Circle(radius = 0.01, color = GREEN_SCREEN).move_to(np.array([1,0.5,0])) + grp1 = VGroup(graph_1, graph_2, cir) + grp2 = VGroup(text7, text8) + self.play(ShowCreation(grp1)) + self.wait(2) + self.play(self.camera_frame.set_width,2.25,self.camera_frame.move_to,sqr1,run_time = 2) + self.wait(1) + self.play(ShowCreation(text20)) + self.wait(2) + self.play(ReplacementTransform(text20, text3)) + self.wait(3) + self.play(ReplacementTransform(text3, text5)) + self.wait(3) + self.play(ReplacementTransform(text5, text7), ShowCreation(text4)) + self.wait(4) + self.play(ReplacementTransform(text4, text6)) + self.wait(3) + self.play(ReplacementTransform(text6, text8)) + self.wait(1.5) + self.play(ReplacementTransform(grp2, text9)) + self.wait(1.5) + self.play(ReplacementTransform(text9, text10)) + self.wait(3) + self.play(self.camera_frame.set_width,2.25,self.camera_frame.move_to,sqr2,run_time = 2) + self.play(ShowCreation(text21), ShowCreation(text22)) + self.play(MoveAlongPath(dot1, graph_3), run_time = 3) + self.wait(3) + self.play(ReplacementTransform(text21, text11)) + self.wait(3) + self.play(ReplacementTransform(text11, text12)) + self.wait(3) + self.play(ReplacementTransform(text12, text13)) + self.wait(2) + self.play(ReplacementTransform(text13, text14)) + self.wait(3) + self.play(ReplacementTransform(text14, textdef)) + self.wait(2) diff --git a/FSF-2020/calculus/intro-to-calculus/riemannintegrals/README.md b/FSF-2020/calculus/intro-to-calculus/riemannintegrals/README.md new file mode 100644 index 0000000..a9ad0bb --- /dev/null +++ b/FSF-2020/calculus/intro-to-calculus/riemannintegrals/README.md @@ -0,0 +1,18 @@ +rierect1.gif +![rierect1](https://user-images.githubusercontent.com/61246381/87141790-3ad90800-c2c1-11ea-86e4-af05cb93fa2d.gif) + + +rierect2.gif +![rierect2](https://user-images.githubusercontent.com/61246381/87141870-5ba15d80-c2c1-11ea-9307-40acc2884d77.gif) + + +rierect3.gif +![rierect3](https://user-images.githubusercontent.com/61246381/87141949-6e1b9700-c2c1-11ea-9433-4f6be752aa55.gif) + + +RiemannRectanglesAnimation. +![RiemannRectanglesAnimation](https://user-images.githubusercontent.com/61246381/87142531-4a0c8580-c2c2-11ea-8f5e-9e854eae6eec.gif) + + +mimi.gif +![mimi](https://user-images.githubusercontent.com/61246381/87142127-b3d85f80-c2c1-11ea-864e-627e41d87ea2.gif) diff --git a/FSF-2020/calculus/intro-to-calculus/riemannintegrals/mimi.py b/FSF-2020/calculus/intro-to-calculus/riemannintegrals/mimi.py new file mode 100644 index 0000000..2471c87 --- /dev/null +++ b/FSF-2020/calculus/intro-to-calculus/riemannintegrals/mimi.py @@ -0,0 +1,53 @@ +class mimi(GraphScene): + CONFIG = { + "y_max": 5, + "x_max": 6, + "x_min": 0, + "y_min": 0, + "x_axis_width": 5, + "y_axis_height": 5, + "init_dx":0.5, + "graph_origin": ORIGIN+2*DOWN+6*LEFT, + } + def construct(self): + self.setup_axes() + def func(x): + return 0.1*(x)*(x-3)*(x-7)+3 + + graph=self.get_graph(func,x_min=0,x_max=6) + kwargs = { + "x_min" : 1.5, + "x_max" : 5.5, + "fill_opacity" : 0.5, + "stroke_width" : 0.25, + } + flat_rectangles = self.get_riemann_rectangles(self.get_graph(lambda x : 0),dx=self.init_dx,**kwargs) + riemann_rectangles_list = self.get_riemann_rectangles_list(graph,8,max_dx=self.init_dx,power_base=2,start_color=PURPLE,end_color=ORANGE,**kwargs, input_sample_type = "right") + riemann_rectangles_list1 = self.get_riemann_rectangles_list(graph,8,max_dx=self.init_dx,power_base=2,start_color=PURPLE,end_color=ORANGE,**kwargs, input_sample_type = "left") + self.add(graph) + self.play(ReplacementTransform(flat_rectangles,riemann_rectangles_list[0]), ReplacementTransform(flat_rectangles,riemann_rectangles_list1[0])) + #self.play(ReplacementTransform(flat_rectangles,riemann_rectangles_list1[0])) + self.wait(2) + kwargs = { + "x_min" : 3, + "x_max" : 3.5, + "fill_opacity" : 0.5, + "stroke_width" : 0.25, + } + riemann_rectangles_list2 = self.get_riemann_rectangles_list(graph,8,max_dx=self.init_dx,power_base=2,start_color=PURPLE,end_color=ORANGE,**kwargs, input_sample_type = "right") + riemann_rectangles_list3 = self.get_riemann_rectangles_list(graph,8,max_dx=self.init_dx,power_base=2,start_color=PURPLE,end_color=ORANGE,**kwargs, input_sample_type = "left") + #self.play(FadeOut(riemann_rectangles_list[0]), FadeOut(riemann_rectangles_list1[0])) + self.play(ReplacementTransform(flat_rectangles,riemann_rectangles_list2[0]), ReplacementTransform(flat_rectangles,riemann_rectangles_list3[0]), FadeOut(riemann_rectangles_list[0]), FadeOut(riemann_rectangles_list1[0])) + minlim = self.get_vertical_line_to_graph(3,graph,DashedLine) + maxlim = self.get_vertical_line_to_graph(3.5,graph,DashedLine) + line2 = Line(self.graph_origin+2.5*RIGHT, self.graph_origin+2.9*RIGHT) + brace1 = Brace(minlim, LEFT) + brace2 = Brace(line2, DOWN) + brace3 = Brace(maxlim, RIGHT) + br1text = brace1.get_text(r"${M}_{i}$").next_to(brace1, LEFT) + br2text = brace2.get_text(r"$\Delta x$").next_to(brace2, DOWN) + br3text = brace3.get_text(r"${m}_{i}$").next_to(brace3, RIGHT) + text1 = TexMobject(r"\Delta x=(b-a)/n").shift(2*RIGHT) + grp3 = VGroup(br1text, br2text, br3text, brace1, brace2, brace3, text1) + self.play(ShowCreation(grp3)) + self.wait(5) |