From edf9724bbed86eb8909999a3ef704d346b7231ea Mon Sep 17 00:00:00 2001 From: panditsomnath10016git Date: Sun, 17 May 2020 01:55:32 +0530 Subject: Add files via upload --- .../y_limit_dependent_on_x.py | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py (limited to 'FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py') diff --git a/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py new file mode 100644 index 0000000..931ffd6 --- /dev/null +++ b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py @@ -0,0 +1,112 @@ +from manimlib.imports import * + +class AreaUnderCurve(GraphScene): + CONFIG = { + "x_min" : 0, + "x_max" : 1, + "y_min" : 0, + "y_max" : 2, + "x_tick_frequency" : 1, + "y_tick_frequency" : 1, + "x_labeled_nums": list(np.arange(0,2)), + "y_labeled_nums": list(np.arange(0 ,3)), + "x_axis_width": 3.5, + "y_axis_height": 6, + "graph_origin": ORIGIN+2.5*LEFT+3*DOWN, + } + + 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.setup_axes(animate=False) + + line= self.get_graph( + lambda x : 2-2*x , + x_min = 0, + x_max = 1, + color = RED) + line_eqn=TextMobject("2x+y=0").move_to(self.graph_origin+.8*X+Y).rotate(np.arctan(-2)) + self.line=line + + caption=TextMobject(r"See the value of $y$ \\ is changing with $x$").move_to(self.graph_origin+1.2*X+1.8*Y) + self.play(ShowCreation(line),Write(line_eqn)) + # self.show_area() + self.show_rects() + self.play(Write(caption)) + self.show_y_values_at_different_x() + + self.wait(2) + + ################### + def show_area(self): + area = self.get_riemann_rectangles( + self.line, + x_min = 0, + x_max = 1, + dx =.0001, + start_color = BLUE, + end_color = BLUE, + fill_opacity = 1, + stroke_width = 0, + ) + self.play(ShowCreation(area)) + # self.transform_between_riemann_rects(self.rects,area) + self.area = area + + def show_rects(self): + rects = self.get_riemann_rectangles( + self.line, + x_min = 0, + x_max = 1, + dx =.02, + start_color = BLUE, + end_color = BLUE, + fill_opacity = 0.75, + stroke_width = 0, + ) + # self.play(ShowCreation(rects)) + # self.transform_between_riemann_rects(self.area,rects) + self.rects=rects + + def show_y_values_at_different_x(self): + rects=self.rects + rect = rects[len(rects)*1//10] + dx_brace = Brace(rect, DOWN, buff = 0) + dx_label = dx_brace.get_text("$dx$", buff = SMALL_BUFF) + dx_brace_group = VGroup(dx_brace,dx_label) + rp=int(len(rects)/10) + rects_subset = self.rects[3*rp:5*rp] + + last_rect = None + for rect in rects_subset: + brace = Brace(rect, LEFT, buff = 0) + y = TexMobject("y=2-2x") + y.next_to(brace, LEFT, SMALL_BUFF) + anims = [ + rect.set_fill, YELLOW, 1, + dx_brace_group.next_to, rect, DOWN, SMALL_BUFF + ] + if last_rect is not None: + anims += [ + last_rect.set_fill, None, 0, + # last_rect.set_fill, BLUE, .75, + ReplacementTransform(last_brace, brace), + ReplacementTransform(last_y, y), + ] + else: + anims += [ + GrowFromCenter(brace), + Write(y) + ] + self.play(*anims) + # self.wait(.2) + + last_rect = rect + last_brace = brace + last_y = y + + y = last_y + y_brace = last_brace + + -- cgit From f3685beb51d24878be9bcd80a0bbbc51ae45f97c Mon Sep 17 00:00:00 2001 From: panditsomnath10016git Date: Sun, 17 May 2020 01:58:10 +0530 Subject: Update y_limit_dependent_on_x.py --- FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py | 1 + 1 file changed, 1 insertion(+) (limited to 'FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py') diff --git a/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py index 931ffd6..27fe23c 100644 --- a/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py +++ b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py @@ -110,3 +110,4 @@ class AreaUnderCurve(GraphScene): y_brace = last_brace +#uploaded by Somnath Pandit.FSF2020_Double_Integral -- cgit From 8088f5ff7693e9a6d02f74876b39f9729737024f Mon Sep 17 00:00:00 2001 From: panditsomnath10016git Date: Tue, 19 May 2020 20:22:43 +0530 Subject: Update y_limit_dependent_on_x.py --- .../y_limit_dependent_on_x.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py') diff --git a/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py index 27fe23c..4894ebf 100644 --- a/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py +++ b/FSF-2020/integrals-of-multivariable-functions/y_limit_dependent_on_x.py @@ -1,6 +1,6 @@ from manimlib.imports import * -class AreaUnderCurve(GraphScene): +class YlimitXdependent(GraphScene): CONFIG = { "x_min" : 0, "x_max" : 1, @@ -26,7 +26,7 @@ class AreaUnderCurve(GraphScene): x_min = 0, x_max = 1, color = RED) - line_eqn=TextMobject("2x+y=0").move_to(self.graph_origin+.8*X+Y).rotate(np.arctan(-2)) + line_eqn=TextMobject("2x+y=2").move_to(self.graph_origin+.8*X+Y).rotate(np.arctan(-2)) self.line=line caption=TextMobject(r"See the value of $y$ \\ is changing with $x$").move_to(self.graph_origin+1.2*X+1.8*Y) @@ -36,7 +36,7 @@ class AreaUnderCurve(GraphScene): self.play(Write(caption)) self.show_y_values_at_different_x() - self.wait(2) + self.wait(.5) ################### def show_area(self): @@ -59,10 +59,10 @@ class AreaUnderCurve(GraphScene): self.line, x_min = 0, x_max = 1, - dx =.02, + dx =.01, start_color = BLUE, end_color = BLUE, - fill_opacity = 0.75, + fill_opacity =1, stroke_width = 0, ) # self.play(ShowCreation(rects)) @@ -81,10 +81,10 @@ class AreaUnderCurve(GraphScene): last_rect = None for rect in rects_subset: brace = Brace(rect, LEFT, buff = 0) - y = TexMobject("y=2-2x") + y = TexMobject("y=2-2x")#.rotate(PI/2) y.next_to(brace, LEFT, SMALL_BUFF) anims = [ - rect.set_fill, YELLOW, 1, + rect.set_fill, BLUE_E, 1, dx_brace_group.next_to, rect, DOWN, SMALL_BUFF ] if last_rect is not None: @@ -109,5 +109,5 @@ class AreaUnderCurve(GraphScene): y = last_y y_brace = last_brace - + #uploaded by Somnath Pandit.FSF2020_Double_Integral -- cgit