diff --git a/source/calculus/manim/CaLAD1.py b/source/calculus/manim/CaLAD1.py new file mode 100644 index 000000000..7dd8fd76b --- /dev/null +++ b/source/calculus/manim/CaLAD1.py @@ -0,0 +1,335 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class FindTanLine(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the line tangent to } y=h(x) \text{ where }h(x)=2x^4+4x-6,\text{ at }(-2,18).", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"y=", r"m", r"(x-x_0)+y_0", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"h(x)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"2x^4+4x-6").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"h'(x)").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"8x^3+4").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"m", r"=h'(-2)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"8(-2)^3+4", r"=-60").scale(0.8).next_to(eq3, RIGHT) + + + lhs4 = MathTex(r"y").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"m(x-x_0)+y_0").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"-60(x-(-2))+18").scale(0.8).next_to(eq4, RIGHT) + rhs4b = MathTex(r"-60(x+2)+18").scale(0.8).next_to(eq4, RIGHT) + rhs4c = MathTex(r"-60x-102").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(caption1)) + self.wait(3) + self.play(caption1[1].animate.set_color(WHITE)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3[0])) + self.wait(2) + self.play(Write(lhs3[1])) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(2) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(lhs4), Write(eq4), Write(rhs4)) + self.wait(4) + self.play(Transform(rhs4, rhs4a)) + self.wait(4) + self.play(Transform(rhs4, rhs4b)) + self.wait(4) + self.play(Transform(rhs4, rhs4c)) + self.wait(5) + + + +class ShowTanLine(Scene): + def construct(self): + + title1 = MathTex(r"\text{Graph } y=2x^4+4x-6 \text{ and it's tangent line at }(-2,18).").scale(0.8) + title1.to_edge(UP) + title1.set_color(TEAL) + + + + axes = Axes(x_range=[-3,3,1], y_range=[-10, 25, 10], x_length=6, y_length=6,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + numberplane = NumberPlane(x_range=[-3,3,1], y_range=[-10, 25, 10], x_length=6, y_length=6, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( 2*x**4+4*x-6 ), + x_range=[-2.107, 1.853], + use_smoothing=True, + color=YELLOW) + + plotlabel = MathTex("h(x)=2x^4+4x-6").scale(0.5).next_to(plot1, RIGHT, buff=0.5).set_color(YELLOW) + + line1 = DashedLine( axes.c2p(-2.117, 25) , axes.c2p(-1.533, -10), color=PURPLE) + linelabel = MathTex("y=-60x-102").scale(0.5).next_to(line1, LEFT, buff=0.5).set_color(PURPLE) + + + P1=Dot(axes.coords_to_point(-2, 18), color=WHITE) + label1 = MathTex(r"(-2,18)", color=WHITE).scale(0.5).next_to(P1, RIGHT) + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), Write(plotlabel) ) + self.wait(2) + self.play(Create(P1), Write(label1),) + self.wait(5) + self.play(Create(line1), Write(linelabel),) + self.wait(5) + + + + +class FindPosition(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{A objects position in meters after } t \text{ seconds} ", color=TEAL).scale(0.8).to_edge(UP) + title2 = MathTex(r"\text{is measured by }s(t)=2t^3-3t^2-7t+4.", color=TEAL).scale(0.8).next_to(title1, DOWN) + title3 = MathTex(r"\text{Find the object's position, velocity and acceleration at } t=3 \text{ seconds.}", color=TEAL).scale(0.8).next_to(title2, DOWN) + + caption1 = MathTex(r"\text{When } t=3\text{ seconds, the position is 10 meters.}", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{When } t=3\text{ seconds, the velocity is 29 meters/second.}", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{When } t=3\text{ seconds, the acceleration is 30 meters/second}^2.", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*0.5+LEFT) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"s(t)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"2t^3-3t^2-7t+4").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"v(t)", r"=s'(t)").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"6t^2-6t-7").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"a(t)", r"=v'(t)", r"=s''(t)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"12t-6").scale(0.8).next_to(eq3, RIGHT) + + lhs1a = MathTex(r"s(3)").scale(0.8).next_to(eq1, LEFT) + rhs1a = MathTex(r"2(3)^3-3(3)^2-7(3)+4").scale(0.8).next_to(eq1, RIGHT) + + lhs2a = MathTex(r"v(3)", r"=s'(3)").scale(0.8).next_to(eq2, LEFT) + rhs2a = MathTex(r"6(3)^2-6(3)-7").scale(0.8).next_to(eq2, RIGHT) + + lhs3a = MathTex(r"a(3)", r"=v'(3)", r"=s''(3)").scale(0.8).next_to(eq3, LEFT) + rhs3a = MathTex(r"12(3)-6").scale(0.8).next_to(eq3, RIGHT) + + rhs1b = MathTex(r"=10.").scale(0.8).next_to(rhs1a, RIGHT) + rhs2b = MathTex(r"=29.").scale(0.8).next_to(rhs2a, RIGHT) + rhs3b = MathTex(r"=30.").scale(0.8).next_to(rhs3a, RIGHT) + + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1, title2, title3) + self.wait(5) + + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2[0])) + self.wait(2) + self.play(Write(lhs2[1])) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3[0])) + self.wait(2) + self.play(Write(lhs3[1])) + self.wait(2) + self.play(Write(lhs3[2])) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Transform(lhs1, lhs1a)) + self.wait(2) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(Write(rhs1b)) + self.wait(3) + self.play(Write(caption1)) + self.wait(5) + + self.play(Transform(lhs2, lhs2a)) + self.wait(2) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play(Write(rhs2b)) + self.wait(3) + self.play(Transform(caption1, caption2)) + self.wait(5) + + self.play(Transform(lhs3, lhs3a)) + self.wait(2) + self.play(Transform(rhs3, rhs3a)) + self.wait(3) + self.play(Write(rhs3b)) + self.wait(3) + self.play(Transform(caption1, caption3)) + self.wait(5) + +class FindMoney(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{A gizmo sells for \$47 each and}", color=TEAL).scale(0.8).to_edge(UP) + title2 = MathTex(r"\text{the cost to produce }x \text{ gizmos in dollars is } C(x)=x^3+2x^2+9x+8", color=TEAL).scale(0.8).next_to(title1, DOWN) + title3 = MathTex(r"\text{Find marginal revenue, cost and profit.}", color=TEAL).scale(0.8).next_to(title2, DOWN) + + caption1 = MathTex(r"\text{Marginal revenue is } R'(x)=47\text{ dollars per gizmo.}", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Marginal cost is } C'(x)=3x^2+4x+9\text{ dollars per gizmo.}", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Marginal profit is } P'(x)=38-3x^2-4x\text{ dollars per gizmo.}", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*0.5+LEFT*4) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*3) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*3) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*3) + + + + + lhs1 = MathTex(r"R(x)").scale(0.6).next_to(eq1, LEFT) + rhs1 = MathTex(r"47x").scale(0.6).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"R'(x)").scale(0.6).next_to(eq2, LEFT) + rhs2 = MathTex(r"47").scale(0.6).next_to(eq2, RIGHT) + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1, title2, title3) + self.wait(5) + + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(caption1)) + self.wait(5) + self.play(FadeOut(lhs2, eq2, rhs2, caption1)) + + lhs2 = MathTex(r"C(x)").scale(0.6).next_to(eq2, LEFT) + rhs2 = MathTex(r"x^3+2x^2+9x+8").scale(0.6).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"C'(x)").scale(0.6).next_to(eq3, LEFT) + rhs3 = MathTex(r"3x^2+4x+9").scale(0.6).next_to(eq3, RIGHT) + + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Write(caption2)) + self.wait(5) + self.play(FadeOut(lhs3, eq3, rhs3, caption2)) + + lhs3 = MathTex(r"P(x)").scale(0.6).next_to(eq3, LEFT) + rhs3 = MathTex(r"R(x)-C(x)", r"=47x-(x^3+2x^2+9x+8)", r"=-x^3-2x^2+38x-8").scale(0.6).next_to(eq3, RIGHT) + + lhs4 = MathTex(r"P'(x)").scale(0.6).next_to(eq4, LEFT) + rhs4 = MathTex(r"R'(x)-C'(x)", r"=47-(3x^2+4x+9)", r"=-3x^2-4x+38").scale(0.6).next_to(eq4, RIGHT) + + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(3) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(rhs3[2])) + self.wait(3) + self.play(Write(lhs4)) + self.wait(3) + self.play(Write(eq4), Write(rhs4[0])) + self.wait(3) + self.play(Write(rhs4[1])) + self.wait(3) + self.play(Write(rhs4[2])) + self.wait(3) + self.play(Write(caption3)) + self.wait(10) + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLAD2.py b/source/calculus/manim/CaLAD2.py new file mode 100644 index 000000000..48c867d1b --- /dev/null +++ b/source/calculus/manim/CaLAD2.py @@ -0,0 +1,226 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class FindLinear(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Suppose } p(6)=17, p'(6)=2, p''(6)<0.", color=TEAL).scale(0.8).to_edge(UP) + title2 = MathTex(r"\text{Find the linearization of }p(x)\text{ when }x=6.", color=TEAL).scale(0.8).next_to(title1, DOWN) + + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*1+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*3) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*3) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*3) + + + + + lhs1 = MathTex(r"p(6)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"17").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"p'(2)").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"2").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"L(x)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r" m(x-x_0)+y_0", r"=2(x-6)+17", r"=2x+5").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(title2)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(2) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(rhs3[2])) + self.wait(5) + self.play(FadeOut(lhs1, eq1, rhs1, lhs2, eq2, rhs2, lhs3, eq3, rhs3, )) + + title2a = MathTex(r"\text{Find the differential }dy\text{ when }x=6.", color=TEAL).scale(0.8).next_to(title1, DOWN) + + lhs1 = MathTex(r"\frac{dy}{dx}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"p'(x)").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"dy").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"p'(x)dx").scale(0.8).next_to(eq2, RIGHT) + rhs2a = MathTex(r"p'(6)dx").scale(0.8).next_to(eq2, RIGHT) + rhs2b = MathTex(r"2dx").scale(0.8).next_to(eq2, RIGHT) + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Transform(title2, title2a)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play(Transform(rhs2, rhs2b)) + self.wait(5) + self.play(FadeOut(lhs1, eq1, rhs1, lhs2, eq2, rhs2, )) + + title2b = MathTex(r"\text{Estimate } p(5.97).", color=TEAL).scale(0.8).next_to(title1, DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*1+LEFT*2) + eq2 = MathTex(r"\approx").scale(0.8).next_to(eq1, DOWN*3) + eq3 = MathTex(r"\approx").scale(0.8).next_to(eq2, DOWN*3) + eq4 = MathTex(r"\approx").scale(0.8).next_to(eq3, DOWN*3) + + lhs1 = MathTex(r"dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"5.97-6=-0.03").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"dy").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"2dx", r"=2(-0.03)", r"=-0.06").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"p(5.97)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"p(6)+dy", r"=17-0.06", r"=16.94").scale(0.8).next_to(eq3, RIGHT) + + lhs4 = MathTex(r"p(5.97)").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"L(5.97)", r"=2(5.97)+5", r"=16.94").scale(0.8).next_to(eq4, RIGHT) + + caption1 = MathTex(r"p(5.97)\approx16.94\text{ is an overestimate since } p''(6)<0.", color=YELLOW).scale(0.8).to_edge(DOWN) + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Transform(title2, title2b)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(3) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(rhs3[2])) + self.wait(3) + self.play(Write(lhs4)) + self.wait(3) + self.play(Write(eq4), Write(rhs4[0])) + self.wait(3) + self.play(Write(rhs4[1])) + self.wait(3) + self.play(Write(rhs4[2])) + self.wait(3) + self.wait(5) + self.play(Write(caption1)) + self.wait(5) + + + + + + +class ShowTanLine(Scene): + def construct(self): + + title1 = MathTex(r"\text{The linearization of } p(x) \text{ at }(6,17).").scale(0.8) + title1.to_edge(UP) + title1.set_color(TEAL) + + + + axes = Axes(x_range=[5.95,6.05,0.05], y_range=[16.85, 17.1, 0.1], x_length=6, y_length=6,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + numberplane = NumberPlane(x_range=[5.95,6.05,0.05], y_range=[16.85, 17.1, 0.1], x_length=6, y_length=6, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( -8*(x-6)**2+2*x+5 ), + x_range=[5.95, 6.05], + use_smoothing=True, + color=YELLOW) + + plotlabel = MathTex("y=p(x)").scale(0.5).next_to(plot1, RIGHT, buff=0.5).set_color(YELLOW) + + line1 = DashedLine( axes.c2p(5.95,16.9) , axes.c2p(6.05, 17.1), color=PURPLE) + linelabel = MathTex("y=2(x-6)+17").scale(0.5).next_to(line1, LEFT, buff=0.5).set_color(PURPLE) + + + P1=Dot(axes.coords_to_point(6, 17), color=WHITE) + label1 = MathTex(r"(6,17)", color=WHITE).scale(0.5).next_to(P1, RIGHT) + + P2=Dot(axes.coords_to_point(5.97, 16.94), color=RED) + label2 = MathTex(r"(5.97, 16.94)", color=RED).scale(0.5).next_to(P2, UP) + + P3=Dot(axes.coords_to_point(5.97, 16.9328), color=BLUE) + label3 = MathTex(r"(5.97, p(5.97))", color=BLUE).scale(0.5).next_to(P3, RIGHT) + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + self.play(Create(P1), Write(label1),) + self.wait(5) + self.play(Create(line1), Write(linelabel),) + self.wait(5) + #self.play(Create(L1)) + self.play(Create(plot1), Write(plotlabel) ) + self.play(Create(P2), Write(label2),) + self.play(Create(P3), Write(label3),) + + self.wait(20) + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLD7.py b/source/calculus/manim/CaLD7.py new file mode 100644 index 000000000..a8906273a --- /dev/null +++ b/source/calculus/manim/CaLD7.py @@ -0,0 +1,157 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find }y'\text{ given } 4y^5+4x^3-2\sin(y)=3", color=TEAL).scale(0.8) + title1.to_edge(UP) + + #caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"\frac{d}{dx}\Big[", r"4y^5+4x^3-2\sin(y)", r"\Big]", color="RED").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{d}{dx}\Big[", r"3", r"\Big]", color="RED").scale(0.8).next_to(eq1, RIGHT) + + lhs1[1].set_color(WHITE) + rhs1[1].set_color(WHITE) + + lhs2 = MathTex(r"20y^4", r"y'", "+12x^2-2\cos(y)", r"y'").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"0").scale(0.8).next_to(eq2, RIGHT) + lhs2[1].set_color(RED) + lhs2[3].set_color(RED) + + lhs3 = MathTex(r"y'", r"(20y^4-2\cos(y))").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"-12x^2").scale(0.8).next_to(eq3, RIGHT) + lhs3[0].set_color(RED) + #lhs2[3].set_color(WHITE) + + lhs4 = MathTex(r"y'", color="RED").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"\frac{-12x^2}{20y^4-2\cos(y)}").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"\frac{6x^2}{\cos(y)-10y^4}").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1[1]),Write(eq1), Write(rhs1[1])) + self.wait(5) + self.play(Write(lhs1[0]), Write(lhs1[2]), Write(rhs1[0]), Write(rhs1[2])) + self.wait(3) + + self.play(Write(lhs2),Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(lhs3),Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(lhs4),Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find }y'\text{ given } 4x\cos(y)=e^x", color=TEAL).scale(0.8) + title1.to_edge(UP) + + #caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"\frac{d}{dx}\Big[", r"4x\cos(y)", r"\Big]", color="RED").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{d}{dx}\Big[", r"e^x", r"\Big]", color="RED").scale(0.8).next_to(eq1, RIGHT) + + lhs1[1].set_color(WHITE) + rhs1[1].set_color(WHITE) + + lhs2 = MathTex(r"4x\frac{d}{x}[\cos(y)] + \cos(y)\frac{d}{dx}[4x]").scale(0.8).next_to(eq2, LEFT) + lhs2a = MathTex(r"4x(-\sin(y))", r"y'", r" + \cos(y)4").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"e^x").scale(0.8).next_to(eq2, RIGHT) + lhs2a[1].set_color(RED) + #lhs2[3].set_color(RED) + + lhs3 = MathTex(r"-4x\sin(y)", r"y'").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"e^x-4\cos(y)").scale(0.8).next_to(eq3, RIGHT) + lhs3[1].set_color(RED) + #lhs2[3].set_color(WHITE) + + lhs4 = MathTex(r"y'", color="RED").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"\frac{e^x-4\cos(y)}{-4x\sin(y)}").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"\frac{4\cos(y)-e^x}{4x\sin(y)}").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1[1]),Write(eq1), Write(rhs1[1])) + self.wait(5) + self.play(Write(lhs1[0]), Write(lhs1[2]), Write(rhs1[0]), Write(rhs1[2])) + self.wait(5) + + self.play(Write(lhs2),Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Transform(lhs2, lhs2a)) + self.wait(5) + + self.play(Write(lhs3),Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(lhs4),Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLDF5.py b/source/calculus/manim/CaLDF5.py new file mode 100644 index 000000000..3ff15dc0f --- /dev/null +++ b/source/calculus/manim/CaLDF5.py @@ -0,0 +1,266 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } k(t)=8\cos(t)^\frac{7}{5}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"k(t)").scale(0.8).next_to(eq1, LEFT) + lhs2 = MathTex(r"k'(t)").scale(0.8).next_to(eq2, LEFT) + + rhs1 = MathTex(r"8\cos(t)^\frac{7}{5}").scale(0.8).next_to(eq1, RIGHT) + rhs1a = MathTex(r"8\Big(", r" \cos(t) ", r"\Big)^\frac{7}{5}" ).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"8\frac{7}{5}\Big(\cos(t)\Big)^\frac{2}{5}", r"\frac{d}{dt}[\cos(t)]").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"8\frac{7}{5}\Big(\cos(t)\Big)^\frac{2}{5}", r"(-\sin(t))").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs3a = MathTex(r"-\frac{56}{5}\Big(\cos(t)\Big)^\frac{2}{5}\sin(t)").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } f(t)=8\cos\Big(t^\frac{7}{5}\Big)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"f(t)").scale(0.8).next_to(eq1, LEFT) + lhs2 = MathTex(r"f'(t)").scale(0.8).next_to(eq2, LEFT) + + rhs1 = MathTex(r"8\cos\Big(", r"t^\frac{7}{5}", r"\Big)").scale(0.8).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"8\Big(", r" \cos(t) ", r"\Big)^\frac{7}{5}" ).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"-8\sin\Big(t^\frac{7}{5}\Big)", r"\frac{d}{dt}\Big[t^{\frac{7}{5}}\Big]").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"-8\sin\Big(t^\frac{7}{5}\Big)", r"\Big(\frac{7}{5}t^{\frac{2}{5}}\Big)").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs3a = MathTex(r"-\frac{56}{5}\sin\Big(t^\frac{7}{5}\Big)t^{\frac{2}{5}}").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + + +class Part3(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } h(x)=\sin\Big(-2x^2+5x-3e^x\Big)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"h(x)").scale(0.8).next_to(eq1, LEFT) + lhs2 = MathTex(r"h'(x)").scale(0.8).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\sin\Big(", r"-2x^2+5x-3e^x", r"\Big)").scale(0.8).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"8\Big(", r" \cos(t) ", r"\Big)^\frac{7}{5}" ).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\cos\Big(-2x^2+5x-3e^x\Big)", r"\frac{d}{dx}\Big[-2x^2+5x-3e^x\Big]").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"\cos\Big(-2x^2+5x-3e^x\Big)", r"\Big(-4x+5-3e^x\Big)").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs3a = MathTex(r"\cos\Big(-2x^2+5x-3e^x\Big)\Big(-4x+5-3e^x\Big)").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + + +class Part4(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } g(x)=\ln\Big(2\sqrt{x}+3x+7\Big)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"g(x)").scale(0.8).next_to(eq1, LEFT) + lhs2 = MathTex(r"g'(x)").scale(0.8).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\ln\Big(", r"2\sqrt{x}+3x+7", r"\Big)").scale(0.8).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\ln\Big(", r"2x^\frac{1}{2}+3x+7", r"\Big)").scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\frac{1}{2x^\frac{1}{2}+3x+7}", r"\frac{d}{dx}\Big[2x^\frac{1}{2}+3x+7\Big]").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"\frac{1}{2x^\frac{1}{2}+3x+7}", r"\Big(-x^{-\frac{1}{2}}+3\Big)").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs3a = MathTex(r"\frac{3-\frac{1}{\sqrt{x}}}{2\sqrt{x}+3x+7}").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(10) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLDF6.py b/source/calculus/manim/CaLDF6.py new file mode 100644 index 000000000..f9f53e08d --- /dev/null +++ b/source/calculus/manim/CaLDF6.py @@ -0,0 +1,231 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } f(y)=\Big( -\frac{5y^2+2}{4y^6+6} \Big)^4", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"f(y)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"f'(y)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\Big(", r"-\frac{5y^2+2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\frac{d}{dy}\Big[\frac{-5y^2-2}{4y^6+6}\Big]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{(4y^6+6)\frac{d}{dy}[-5y^2-2]-(-5y^2-2)\frac{d}{dy}[4y^6+6]}{(4y^6+6)^2}\Big)").scale(0.6).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs4 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{(4y^6+6)(-10y)-(-5y^2-2)(24y^5)}{(4y^6+6)^2}\Big)").scale(0.6).next_to(eq4, RIGHT) + rhs4[1].set_color(RED) + + rhs4a = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{20y^7+12y^5-15y }{4y^{12}+12y^6+9}\Big)").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption1)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption1), Write(caption3)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption3)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + + + + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } h(t)=\ln\Big( t^2+3t^4\Big)\cos(t)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"h(t)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"h'(t)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"\cos(t)").scale(0.6).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"\frac{d}{dt}[\cos(t)]", r"+\cos(t)", r"\frac{d}{dt}\Big[ \ln\Big( t^2+3t^4\Big)\Big]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(GREEN) + rhs2[3].set_color(BLUE) + + rhs3 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"(-\sin(t))", r"+\cos(t)", r"\frac{1}{t^2+3t^4}", r"\frac{d}{dt}[t^2+3t^4]").scale(0.6).next_to(eq3, RIGHT) + rhs3[4].set_color(RED) + + rhs4 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"(-\sin(t))", r"+\cos(t)", r"\frac{1}{t^2+3t^4}", r"(2t+12t^3)").scale(0.6).next_to(eq4, RIGHT) + rhs4[4].set_color(RED) + + rhs4a = MathTex(r"-\sin(t)\ln\Big( t^2+3t^4\Big)+\cos(t)\frac{2t+12t^3}{t^2+3t^4}").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[0].animate.set_color(BLUE)) + self.play(rhs1[1].animate.set_color(GREEN)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption2)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption2), Write(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + +class Part3(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } g(x)=\sqrt{\cos(3x^4+4x)}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"g(x)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"g'(x)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\sqrt{\cos(3x^4+4x)}").scale(0.6).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\Big(", r"\cos(3x^4+4x)", r"\Big)^\frac{1}{2}").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\frac{d}{dx}[\cos(3x^4+4x)]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\Big( -\sin(3x^4+4x)\Big)", r"\frac{d}{dx}[3x^4+4x]").scale(0.6).next_to(eq3, RIGHT) + rhs3[2].set_color(RED) + + rhs4 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\Big( -\sin(3x^4+4x)\Big)", r"(12x^3+4)").scale(0.6).next_to(eq4, RIGHT) + rhs4[2].set_color(RED) + + rhs4a = MathTex(r"\frac{-\sin(3x^4+4x)(12x^3+4)}{2\sqrt{\cos(3x^4+4x)}}").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption1)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption1), Write(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLDF68.py b/source/calculus/manim/CaLDF68.py new file mode 100644 index 000000000..f9f53e08d --- /dev/null +++ b/source/calculus/manim/CaLDF68.py @@ -0,0 +1,231 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } f(y)=\Big( -\frac{5y^2+2}{4y^6+6} \Big)^4", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"f(y)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"f'(y)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\Big(", r"-\frac{5y^2+2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\frac{d}{dy}\Big[\frac{-5y^2-2}{4y^6+6}\Big]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{(4y^6+6)\frac{d}{dy}[-5y^2-2]-(-5y^2-2)\frac{d}{dy}[4y^6+6]}{(4y^6+6)^2}\Big)").scale(0.6).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs4 = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{(4y^6+6)(-10y)-(-5y^2-2)(24y^5)}{(4y^6+6)^2}\Big)").scale(0.6).next_to(eq4, RIGHT) + rhs4[1].set_color(RED) + + rhs4a = MathTex(r"4\Big( \frac{-5y^2-2}{4y^6+6} \Big)^3", r"\Big(\frac{20y^7+12y^5-15y }{4y^{12}+12y^6+9}\Big)").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption1)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption1), Write(caption3)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption3)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + + + + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } h(t)=\ln\Big( t^2+3t^4\Big)\cos(t)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"h(t)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"h'(t)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"\cos(t)").scale(0.6).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"\frac{d}{dt}[\cos(t)]", r"+\cos(t)", r"\frac{d}{dt}\Big[ \ln\Big( t^2+3t^4\Big)\Big]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(GREEN) + rhs2[3].set_color(BLUE) + + rhs3 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"(-\sin(t))", r"+\cos(t)", r"\frac{1}{t^2+3t^4}", r"\frac{d}{dt}[t^2+3t^4]").scale(0.6).next_to(eq3, RIGHT) + rhs3[4].set_color(RED) + + rhs4 = MathTex(r"\ln\Big( t^2+3t^4\Big)", r"(-\sin(t))", r"+\cos(t)", r"\frac{1}{t^2+3t^4}", r"(2t+12t^3)").scale(0.6).next_to(eq4, RIGHT) + rhs4[4].set_color(RED) + + rhs4a = MathTex(r"-\sin(t)\ln\Big( t^2+3t^4\Big)+\cos(t)\frac{2t+12t^3}{t^2+3t^4}").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[0].animate.set_color(BLUE)) + self.play(rhs1[1].animate.set_color(GREEN)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption2)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption2), Write(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + +class Part3(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } g(x)=\sqrt{\cos(3x^4+4x)}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.6).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"g(x)").scale(0.6).next_to(eq1, LEFT) + lhs2 = MathTex(r"g'(x)").scale(0.6).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\sqrt{\cos(3x^4+4x)}").scale(0.6).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\Big(", r"\cos(3x^4+4x)", r"\Big)^\frac{1}{2}").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\frac{d}{dx}[\cos(3x^4+4x)]").scale(0.6).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs3 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\Big( -\sin(3x^4+4x)\Big)", r"\frac{d}{dx}[3x^4+4x]").scale(0.6).next_to(eq3, RIGHT) + rhs3[2].set_color(RED) + + rhs4 = MathTex(r"\frac{1}{2}\Big(\cos(3x^4+4x)\Big)^{-\frac{1}{2}}", r"\Big( -\sin(3x^4+4x)\Big)", r"(12x^3+4)").scale(0.6).next_to(eq4, RIGHT) + rhs4[2].set_color(RED) + + rhs4a = MathTex(r"\frac{-\sin(3x^4+4x)(12x^3+4)}{2\sqrt{\cos(3x^4+4x)}}").scale(0.6).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption1)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption1), Write(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLDF7.py b/source/calculus/manim/CaLDF7.py new file mode 100644 index 000000000..2cc988825 --- /dev/null +++ b/source/calculus/manim/CaLDF7.py @@ -0,0 +1,157 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find }y'\text{ given } 4y^5+4x^3-2\sin(y)=3", color=TEAL).scale(0.8) + title1.to_edge(UP) + + #caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"\frac{d}{dx}\Big[", r"4y^5+4x^3-2\sin(y)", r"\Big]", color="RED").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{d}{dx}\Big[", r"3", r"\Big]", color="RED").scale(0.8).next_to(eq1, RIGHT) + + lhs1[1].set_color(WHITE) + rhs1[1].set_color(WHITE) + + lhs2 = MathTex(r"20y^4", r"y'", "+12x^2-2\cos(y)", r"y'").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"0").scale(0.8).next_to(eq2, RIGHT) + lhs2[1].set_color(RED) + lhs2[3].set_color(RED) + + lhs3 = MathTex(r"y'", r"(20y^4-2\cos(y))").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"-12x^2").scale(0.8).next_to(eq3, RIGHT) + lhs3[0].set_color(RED) + #lhs2[3].set_color(WHITE) + + lhs4 = MathTex(r"y'", color="RED").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"\frac{-12x^2}{20y^4-2\cos(y)}").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"\frac{6x^2}{\cos(y)-10y^4}").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1[1]),Write(eq1), Write(rhs1[1])) + self.wait(5) + self.play(Write(lhs1[0]), Write(lhs1[2]), Write(rhs1[0]), Write(rhs1[2])) + self.wait(3) + + self.play(Write(lhs2),Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(lhs3),Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(lhs4),Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find }y'\text{ given } 4x\cos(y)=e^x", color=TEAL).scale(0.8) + title1.to_edge(UP) + + #caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + #caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"\frac{d}{dx}\Big[", r"4x\cos(y)", r"\Big]", color="RED").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{d}{dx}\Big[", r"e^x", r"\Big]", color="RED").scale(0.8).next_to(eq1, RIGHT) + + lhs1[1].set_color(WHITE) + rhs1[1].set_color(WHITE) + + lhs2 = MathTex(r"4x\frac{d}{dx}[\cos(y)] + \cos(y)\frac{d}{dx}[4x]").scale(0.8).next_to(eq2, LEFT) + lhs2a = MathTex(r"4x(-\sin(y))", r"y'", r" + \cos(y)4").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"e^x").scale(0.8).next_to(eq2, RIGHT) + lhs2a[1].set_color(RED) + #lhs2[3].set_color(RED) + + lhs3 = MathTex(r"-4x\sin(y)", r"y'").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"e^x-4\cos(y)").scale(0.8).next_to(eq3, RIGHT) + lhs3[1].set_color(RED) + #lhs2[3].set_color(WHITE) + + lhs4 = MathTex(r"y'", color="RED").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"\frac{e^x-4\cos(y)}{-4x\sin(y)}").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"\frac{4\cos(y)-e^x}{4x\sin(y)}").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1[1]),Write(eq1), Write(rhs1[1])) + self.wait(5) + self.play(Write(lhs1[0]), Write(lhs1[2]), Write(rhs1[0]), Write(rhs1[2])) + self.wait(5) + + self.play(Write(lhs2),Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Transform(lhs2, lhs2a)) + self.wait(5) + + self.play(Write(lhs3),Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(lhs4),Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLDF8.py b/source/calculus/manim/CaLDF8.py new file mode 100644 index 000000000..1ee19c405 --- /dev/null +++ b/source/calculus/manim/CaLDF8.py @@ -0,0 +1,300 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class Part1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } h(x)=\ln\Big( \arcsin(x) - 8\arctan(x) \Big)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.75).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.75).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.75).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.75).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"h(x)").scale(0.75).next_to(eq1, LEFT) + lhs2 = MathTex(r"h'(x)").scale(0.75).next_to(eq2, LEFT) + + rhs1 = MathTex(r"\ln\Big( ", r" \arcsin(x) - 8\arctan(x) ", r" \Big)").scale(0.75).next_to(eq1, RIGHT) + #rhs1[0].set_color(BLUE) + #rhs1[1].set_color(RED) + #rhs1[2].set_color(BLUE) + + rhs2 = MathTex(r"{1 \over", r" \arcsin(x) - 8\arctan(x)}", r"\frac{d}{dx}\left[ \arcsin(x) - 8\arctan(x) \right]").scale(0.75).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[1].set_color(RED) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"{1 \over", r" \arcsin(x) - 8\arctan(x)}", r"\left( \frac{1}{\sqrt{1-x^2}} - 8\frac{1}{1+x^2} \right)").scale(0.75).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[1].set_color(RED) + rhs3[2].set_color(RED) + + rhs3a = MathTex(r"{1 \over", r" \arcsin(x) - 8\arctan(x)}", r"\left( \frac{1}{\sqrt{1-x^2}} - \frac{8}{1+x^2} \right)").scale(0.75).next_to(eq3, RIGHT) + rhs3a[0].set_color(BLUE) + rhs3a[1].set_color(RED) + rhs3a[2].set_color(RED) + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(rhs1[1].animate.set_color(RED), rhs1[0].animate.set_color(BLUE), rhs1[2].animate.set_color(BLUE)) + self.wait(3) + + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption1)) + + self.wait(5) + self.play(Write(eq3), Write(rhs3), FadeOut(caption1)) + self.wait(5) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + + + + +class Part2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } g(t)=-3\arcsin(t)\ln\left(t^4+9 \right)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.75).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.75).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.75).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.75).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"g(t)").scale(0.75).next_to(eq1, LEFT) + lhs2 = MathTex(r"g'(t)").scale(0.75).next_to(eq2, LEFT) + + rhs1 = MathTex(r"-3\arcsin(t)",r" \ln\left(t^4+9 \right)").scale(0.75).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.75).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"-3\arcsin(t)", r"\frac{d}{dt}\left[ \ln\Big( ", r" t^4+9 ", r" \Big) \right]", r"+", r"\ln\left(t^4+9 \right)", r"\frac{d}{dt}\Big[ -3\arcsin(t) \Big]").scale(0.75).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[1].set_color(RED) + rhs2[2].set_color(RED) + rhs2[3].set_color(RED) + rhs2[5].set_color(RED) + rhs2[6].set_color(BLUE) + + rhs3 = MathTex(r"-3\arcsin(t)", r"\frac{1}{t^4+9}", r"\frac{d}{dt}\left[t^4+9 \right]", r"+", r"\ln\left(t^4+9 \right)", r"(-3)\frac{1}{\sqrt{1-x^2}}").scale(0.75).next_to(eq3, RIGHT) + rhs3[1].set_color(ORANGE) + rhs3[2].set_color(GREEN) + rhs3[5].set_color(BLUE) + + rhs4 = MathTex(r"-3\arcsin(t)", r"\frac{1}{t^4+9}", r"(4t^3)", r"+", r"\ln\left(t^4+9 \right)", r"(-3)\frac{1}{\sqrt{1-x^2}}").scale(0.75).next_to(eq4, RIGHT) + rhs4[2].set_color(GREEN) + + rhs4a = MathTex(r"-\frac{12t^3\arcsin(t)}{t^4+9} - \frac{3\ln\left(t^4+9 \right)}{\sqrt{1-x^2}}").scale(0.75).next_to(eq4, RIGHT) + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[0].animate.set_color(BLUE)) + self.play(rhs1[1].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption2)) + self.wait(5) + self.play(rhs2[1].animate.set_color(ORANGE), rhs2[2].animate.set_color(GREEN), rhs2[3].animate.set_color(ORANGE), ) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption2), Write(caption1)) + self.wait(5) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + + + + +class Part3(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the derivative of } f(u) = \frac{\arctan(u)}{\ln(-2u)}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + caption1 = MathTex(r"\text{Chain Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption2 = MathTex(r"\text{Product Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + caption3 = MathTex(r"\text{Quotient Rule!} ", color=YELLOW).scale(0.8).to_edge(DOWN) + + eq1 = MathTex(r"=").scale(0.75).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.75).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.75).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.75).next_to(eq3, DOWN*5) + + + + + lhs1 = MathTex(r"f(u)").scale(0.75).next_to(eq1, LEFT) + lhs2 = MathTex(r"f'(u)").scale(0.75).next_to(eq2, LEFT) + + rhs1 = MathTex(r"{\arctan(7u)", r" \over", r" \ln(-2u) }").scale(0.75).next_to(eq1, RIGHT) + #rhs1a = MathTex(r"\Big(", r"\frac{-5y^2-2}{4y^6+6}", r"\Big)^4").scale(0.75).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"{\ln(-2u)", r"\frac{d}{du}\Bigl[ \arctan{}(", r"7u ", r") \Bigr]", r"-", r"\arctan(7u)", r"\frac{d}{du}\left[ \ln(-2u)\right]", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq2, RIGHT) + rhs2[0].set_color(RED) + rhs2[1].set_color(BLUE) + rhs2[2].set_color(BLUE) + rhs2[3].set_color(BLUE) + rhs2[5].set_color(BLUE) + rhs2[6].set_color(RED) + rhs2[8].set_color(RED) + + rhs2a = MathTex(r"{\ln(-2u)", r"\frac{d}{du}\Bigl[ \arctan{}(", r"7u ", r") \Bigr]", r"-", r"\arctan(7u)", r"\frac{d}{du}\left[ \ln(-2) + \ln(u)\right]", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq2, RIGHT) + rhs2a[0].set_color(RED) + rhs2a[1].set_color(ORANGE) + rhs2a[2].set_color(GREEN) + rhs2a[3].set_color(ORANGE) + rhs2a[5].set_color(BLUE) + rhs2a[6].set_color(RED) + rhs2a[8].set_color(RED) + + + + + + rhs3 = MathTex(r"{\ln(-2u)", r"\frac{1}{1+(7u)^2}", r"\frac{d}{du}\left[ 7u \right]", r"-", r"\arctan(7u)", r"\frac{1}{u}", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq3, RIGHT) + rhs3[1].set_color(ORANGE) + rhs3[2].set_color(GREEN) + rhs3[5].set_color(RED) + + rhs4 = MathTex(r"{\ln(-2u)", r"\frac{1}{1+(7u)^2}", r"7", r"-", r"\arctan(7u)", r"\frac{1}{u}", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq4, RIGHT) + rhs4[2].set_color(GREEN) + + rhs4a = MathTex(r"\frac{ \frac{7\ln(-2u)}{1+49t^2} - \frac{\arctan(7u)}{u} }{ \ln(-2u)^2}").scale(0.75).next_to(eq4, RIGHT) + + rhs4b = MathTex(r" \frac{7}{(1+49t^2)\ln(-2u)} - \frac{\arctan(7u)}{u\ln(-2u)^2} ").scale(0.75).next_to(eq4, RIGHT) + + rhs4c = MathTex(r"{\ln(-2u)", r"\frac{1}{1+(7u)^2}", r"7", r"-", r"\arctan(7u)", r"\frac{1}{u}", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq4, RIGHT) + rhs4c[2].set_color(GREEN) + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + #self.play(Transform(rhs1, rhs1a)) + #self.wait(3) + self.play(rhs1[0].animate.set_color(BLUE)) + self.play(rhs1[2].animate.set_color(RED)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2), Write(caption3)) + self.wait(5) + self.play(rhs2[1].animate.set_color(ORANGE), rhs2[2].animate.set_color(GREEN), + rhs2[3].animate.set_color(ORANGE) ) + self.wait(5) + self.play(Transform(rhs2, rhs2a)) + + self.wait(3) + self.play(Write(eq3), Write(rhs3), FadeOut(caption3), Write(caption1)) + self.wait(5) + self.play(Write(eq4), Write(rhs4), FadeOut(caption1)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + self.play(Transform(rhs4, rhs4b)) + self.wait(10) + + + #rhs2s = MathTex(r"{\ln(-2u)", r"\frac{d}{du}\Bigl[ \arctan{}(", r"7u ", r")\Bigr]", r"-", r"\arctan(7u)", r"\frac{d}{du}[ \ln(", r"-2u ", r")]", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq2, RIGHT) + #rhs2s[0].set_color(RED) + #rhs2s[1].set_color(ORANGE) + #rhs2s[2].set_color(GREEN) + #rhs2s[3].set_color(ORANGE) + #rhs2s[5].set_color(BLUE) + #rhs2s[6].set_color(ORANGE) + #rhs2s[7].set_color(GREEN) + #rhs2s[8].set_color(ORANGE) + #rhs2s[10].set_color(RED) + + #rhs3s = MathTex(r"{\ln(-2u)", r"\frac{1}{1+(7u)^2}", r"\frac{d}{du}\left[ 7u \right]", r"-", r"\arctan(7u)", r"\frac{1}{-2u}", r"(-2)", r"\over", r"\ln(-2u)^2 }").scale(0.75).next_to(eq3, RIGHT) + #rhs3s[1].set_color(ORANGE) + #rhs3s[2].set_color(GREEN) + #rhs3s[5].set_color(ORANGE) + #rhs3s[6].set_color(GREEN) + + #self.play(FadeOut(eq4, rhs4, eq3, rhs3, rhs2)) + #self.play(Write(rhs2s)) + ##self.wait(3) + #self.play(Write(eq3), Write(rhs3s), Write(caption1)) + #self.wait(5) + #self.play(Transform(rhs3s, rhs3)) + + #self.wait(5) + #self.play(Write(eq4), Write(rhs4c), FadeOut(caption1)) + #self.wait(5) + #self.play(Transform(rhs4c, rhs4a)) + #self.wait(5) + #self.play(Transform(rhs4c, rhs4b)) + #self.wait(5) + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT1.py b/source/calculus/manim/CaLT1.py new file mode 100644 index 000000000..f8350bb74 --- /dev/null +++ b/source/calculus/manim/CaLT1.py @@ -0,0 +1,343 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class ShowFunction(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Sketch }y=g(x)\text{ such that:}").scale(0.8) + title1.to_edge(UP) + + text1 = MathTex(r"\displaystyle \lim_{x\to 1^-}g(x) \text{ finite, }\lim_{x\to 1^+}g(x)=\infty.}", color=RED).scale(0.8).shift(RIGHT*3+UP*2) + text2 = MathTex(r"\displaystyle \lim_{x\to -3}g(x)\neq g(-3) \text{, both exist.}", color=BLUE).scale(0.8).next_to(text1, DOWN*2) + text3 = MathTex(r"\displaystyle \lim_{x\to -4}\neq 0, \lim_{x\to -4^+}g(x)=0.", color=YELLOW).scale(0.8).next_to(text2, DOWN*2) + + + + + axes = Axes(x_range=[-5.1,3.1,1], y_range=[-4.1,4.1,1], x_length=4.2, y_length=4.2,).shift(LEFT*3) + axes_labels = axes.get_axis_labels() + numberplane = NumberPlane(x_range=[-5.1,3.1,2], + y_range=[-4.1,4.1,2], + x_length=4.2, + y_length=4.2, + ).add_coordinates().shift(LEFT*3) + + + + + d1 = DashedLine(axes.coords_to_point(1, -4), axes.coords_to_point(1, 4), color=RED) + d2 = DashedLine(axes.coords_to_point(-3, -4), axes.coords_to_point(-3, 4), color=BLUE) + d3 = DashedLine(axes.coords_to_point(-4, -4), axes.coords_to_point(-4, 4), color=YELLOW) + + + #First x + + tracker11=ValueTracker(0.5) + tracker12=ValueTracker(0.5) + tracker13=ValueTracker(0.5) + + + curve11 = axes.plot(lambda x: 0.5, + x_range=[-1, 0.99], + use_smoothing=False) + + + def update11(mob): + mob.become( + axes.plot(lambda x: tracker11.get_value(), + x_range=[-1, 0.99], + use_smoothing=False) + + ) + + + curve11.add_updater(update11) + + curve12 = axes.plot(lambda x: (x-1)**(-1/2)+0.5, + x_range=[1.0816, 3], + use_smoothing=False) + + + def update12(mob): + mob.become( + axes.plot(lambda x: (x-1)**(-1/2)+tracker12.get_value(), + x_range=[1/(4-tracker12.get_value())**(2)+1, 3], + use_smoothing=False) + + ) + + + curve12.add_updater(update12) + + p1 = Point(axes.coords_to_point(1, 0.5), color=WHITE) + + def update13(mob): + mob.become( + Point(axes.coords_to_point(1, tracker13.get_value()), color=WHITE) + + ) + + + p1.add_updater(update13) + + + + + #Second x + + tracker21=ValueTracker(0.5) + tracker22=ValueTracker(-1) + + curve21 = axes.plot(lambda x: 0.5, + x_range=[-3.5, -3.05], + use_smoothing=False) + + + def update21(mob): + mob.become( + axes.plot(lambda x: tracker21.get_value(), + x_range=[-3.5, -3.05], + use_smoothing=False) + + ) + + + curve21.add_updater(update21) + + curve22 = axes.plot(lambda x: 0*(x+1)+0.5, + x_range=[-2.95, -1], + use_smoothing=False) + + + def update22(mob): + mob.become( + axes.plot(lambda x: ((0.5-tracker21.get_value())/2)*(x+1)+0.5, + x_range=[-2.95, -1], + use_smoothing=False) + + ) + + + curve22.add_updater(update22) + + p2 = Point(axes.coords_to_point(-3, -1), color=WHITE) + + def update23(mob): + mob.become( + Point(axes.coords_to_point(-3, tracker22.get_value()), color=WHITE) + + ) + + + p2.add_updater(update23) + + + tracker31=ValueTracker(0.5) + tracker32=ValueTracker(0.5) + + + curve31 = axes.plot(lambda x: 0.5, + x_range=[-5, -4.05], + use_smoothing=False) + + + def update31(mob): + mob.become( + axes.plot(lambda x: tracker31.get_value(), + x_range=[-5, -4.05], + use_smoothing=False) + + ) + + + curve31.add_updater(update31) + + p3 = Point(axes.coords_to_point(-4, 0.5), color=WHITE) + + def update32(mob): + mob.become( + Point(axes.coords_to_point(-4, tracker32.get_value()), color=WHITE) + + ) + + p3.add_updater(update32) + + + + + + curve32 = axes.plot(lambda x: (x+4), + x_range=[-3.95, -3.5], + use_smoothing=False) + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(axes, axes_labels, numberplane, title1) + self.play(Write(text1), Write(text2), Write(text3)) + self.wait(1) + self.play(text1.animate.scale(1.5)) + self.play(text1.animate.scale(2/3)) + self.wait(1) + self.play(Create(d1)) + self.wait(3) + self.play(Create(curve11), Create(curve12), ) + self.wait(2) + + self.play(tracker11.animate.set_value(-3.5), run_time=3) + self.play(tracker11.animate.set_value(3.5), run_time=3) + self.play(tracker11.animate.set_value(0.5), run_time=3) + + self.play(tracker12.animate.set_value(-3.5), run_time=3) + self.play(tracker12.animate.set_value(3), run_time=3) + self.play(tracker12.animate.set_value(0.5), run_time=3) + + self.play(Create(p1)) + + self.play(tracker13.animate.set_value(-3.5), run_time=3) + self.play(tracker13.animate.set_value(3), run_time=3) + self.play(tracker13.animate.set_value(0.5), run_time=3) + + self.play(FadeOut(p1)) + + self.play(FadeOut(d1)) + self.wait(3) + + self.play(text2.animate.scale(1.5)) + self.play(text2.animate.scale(2/3)) + self.wait(1) + self.play(Create(d2)) + self.wait(3) + self.play(Create(curve21), Create(curve22), Create(p2)) + self.wait(2) + + self.play(tracker21.animate.set_value(-3.5), run_time=3) + self.play(tracker21.animate.set_value(3.5), run_time=3) + self.play(tracker21.animate.set_value(0.5), run_time=3) + + self.play(tracker22.animate.set_value(-3.5), run_time=3) + self.play(tracker22.animate.set_value(3.5), run_time=3) + self.play(tracker22.animate.set_value(-1), run_time=3) + + self.play(FadeOut(d2)) + self.wait(3) + + self.play(text3.animate.scale(1.5)) + self.play(text3.animate.scale(2/3)) + self.wait(1) + self.play(Create(d3)) + self.wait(1) + self.play(Create(curve31), Create(curve32), Create(p3)) + self.wait(2) + + self.play(tracker31.animate.set_value(-3.5), run_time=3) + self.play(tracker31.animate.set_value(3.5), run_time=3) + self.play(tracker31.animate.set_value(0.5), run_time=3) + + self.wait(2) + + self.play(tracker32.animate.set_value(-3.5), run_time=3) + self.play(tracker32.animate.set_value(3.5), run_time=3) + self.play(tracker32.animate.set_value(0.5), run_time=3) + + self.play(FadeOut(d3)) + self.wait(10) + + + """ + + eq1 = MathTex(r"=").shift(RIGHT*2, UP) + eq2 = MathTex(r"=").next_to(eq1, DOWN*3) + eq3 = MathTex(r"=").next_to(eq2, DOWN*3) + + lhs1 = MathTex(r"f(K, R)", color=BLUE).scale(0.7).next_to(eq1, LEFT) + rhs1 = MathTex(r"65K^{\frac{4}{5}}R^{\frac{1}{5}}}", color=BLUE).scale(0.7).next_to(eq1, RIGHT) + + + lhs2 = MathTex(r"\nabla f(K, R)", color=BLUE).scale(0.7).next_to(eq2, LEFT) + rhs2 = MathTex(r"\left\langle 52 K^{-\frac{1}{5}} R^{\frac{1}{5}}, 13K^{\frac{4}{5}}R^{-\frac{4}{5}} \right\rangle", color=BLUE).scale(0.7).next_to(eq2, RIGHT) + + + lhs3 = MathTex(r"g(K, R)", color=YELLOW).scale(0.7).next_to(eq2, LEFT) + rhs3 = MathTex(r"K+R", color=YELLOW).scale(0.7).next_to(eq2, RIGHT) + + lhs4 = MathTex(r"\nabla g(K, R)", color=YELLOW).scale(0.7).next_to(eq3, LEFT) + rhs4 = MathTex(r"\left\langle 1 , 1 \right\rangle",color=YELLOW).scale(0.7).next_to(eq3, RIGHT) + + rhs5 = MathTex(r"\nabla f(K, R)", color=BLUE).scale(0.7).next_to(eq3, RIGHT) + lhs5 = MathTex(r"\lambda", r"\nabla g(K, R)",color=YELLOW).scale(0.7).next_to(eq3, LEFT) + lhs5[0].set_color(WHITE) + + rhs6 = MathTex(r"\left\langle 52 K^{-\frac{1}{5}}R^{\frac{1}{5}}, 13K^{\frac{4}{5}}R^{-\frac{4}{5}} \right\rangle", color=BLUE).scale(0.7).next_to(eq3, RIGHT) + lhs6 = MathTex(r"\lambda", r"\left\langle 1 , 1 \right\rangle",color=YELLOW).scale(0.7).next_to(eq3, LEFT) + lhs6[0].set_color(WHITE) + + lhs7 = MathTex(r"\left\langle \lambda , \lambda \right\rangle",color=YELLOW).scale(0.7).next_to(eq3, LEFT) + + + self.wait(4) + self.play(Write(lhs1)) + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(4) + self.play(Write(lhs2)) + self.wait(2) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(FadeOut(lhs1, rhs1), rhs2.animate.next_to(eq1, RIGHT), lhs2.animate.next_to(eq1, LEFT)) + self.play(Write(lhs3), Write(rhs3)) + self.wait(4) + self.play(Write(lhs4)) + self.wait(2) + self.play(Write(eq3), Write(rhs4)) + self.wait(4) + self.play(FadeOut(lhs3, rhs3), rhs4.animate.next_to(eq2, RIGHT), lhs4.animate.next_to(eq2, LEFT)) + self.wait(3) + self.play(Write(lhs5), Write(rhs5)) + self.wait(3) + self.play(Transform(lhs5, lhs6), Transform(rhs5, rhs6)) + self.wait(3) + self.play(Transform(lhs5, lhs7)) + + """ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT2.py b/source/calculus/manim/CaLT2.py new file mode 100644 index 000000000..37282547c --- /dev/null +++ b/source/calculus/manim/CaLT2.py @@ -0,0 +1,136 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class EstimateLimit(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Estimate }\displaystyle \lim_{x\to 5} \frac{x^2+x-30}{x^2+10x-75}\text{ numerically.}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + table1 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.01 \\ \hline f(x) &&&&&&& \end{array}").scale(0.8) + + + text1 = MathTex(r"f(x)=\frac{x^2+x-30}{x^2+10x-75}.", color=YELLOW).scale(0.8).shift(DOWN*1.5) + + text2 = MathTex(r"f(5)=?\frac{5^2+5-30}{5^2+10(5)-75}",r"=?\frac{0}{0}", r"\text{ is undefined.}", color=YELLOW).scale(0.8).shift(DOWN*1.5) + text2[2].set_color(RED) + + table2 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) &&&& \text{UND} &&& \end{array}").scale(0.8) + + text3 = MathTex(r"f(4.9)=\frac{(4.9)^2+4.9-30}{(4.9)^2+10(4.9)-75}",r"\approx 0.5477", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table3 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477&&& \text{UND} &&& \end{array}").scale(0.8) + + text4 = MathTex(r"f(4.99)=\frac{(4.99)^2+4.99-30}{(4.99)^2+10(4.99)-75}",r"\approx 0.5498", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table4 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477& 0.5498 && \text{UND} &&& \end{array}").scale(0.8) + + text5 = MathTex(r"f(4.999)=\frac{(4.999)^2+4.999-30}{(4.999)^2+10(4.999)-75}",r"\approx 0.54998", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table5 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477& 0.5498 &0.54998& \text{UND} &&& \end{array}").scale(0.8) + + text6 = MathTex(r"f(5.1)=\frac{(5.1)^2+5.1-30}{(5.1)^2+10(5.1)-75}",r"\approx 0.5522", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table6 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477& 0.5498 &0.54998& \text{UND} &&& 0.5522\end{array}").scale(0.8) + + text7 = MathTex(r"f(5.01)=\frac{(5.01)^2+5.01-30}{(5.01)^2+10(5.01)-75}",r"\approx 0.5502", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table7 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477& 0.5498 &0.54998& \text{UND} &&0.5502& 0.5522\end{array}").scale(0.8) + + text8 = MathTex(r"f(5.001)=\frac{(5.001)^2+5.001-30}{(5.001)^2+10(5.001)-75}",r"\approx 0.55002", color=YELLOW).scale(0.8).shift(DOWN*1.5) + table8 = MathTex(r"\begin{array}{c|ccccccc}x & 4.9 & 4.99 & 4.999 & 5 & 5.001 & 5.01 & 5.1 \\ \hline f(x) & 0.5477& 0.5498 &0.54998& \text{UND} &0.55002&0.5502& 0.5522\end{array}").scale(0.8) + + text9 = MathTex(r"\lim_{x\to 5} \frac{x^2+x-30}{x^2+10x-75}", r"\approx" , r"0.55" ,color=YELLOW).scale(0.8).shift(DOWN*1.5) + text9[2].set_color(BLUE) + + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(8) + self.play(Write(table1)) + self.play(Write(text1)) + self.wait(5) + self.play(FadeOut(text1), Write(text2[0])) + self.wait(1) + self.play(Write(text2[1])) + self.wait(1) + self.play(Write(text2[2])) + self.play(Transform(table1, table2)) + self.wait(5) + self.play(FadeOut(text2), Write(text3[0])) + self.wait(1) + self.play(Write(text3[1])) + self.wait(1) + self.play(Transform(table1, table3)) + self.wait(5) + self.play(FadeOut(text3), Write(text4[0])) + self.wait(1) + self.play(Write(text4[1])) + self.wait(1) + self.play(Transform(table1, table4)) + self.wait(5) + self.play(FadeOut(text4), Write(text5[0])) + self.wait(1) + self.play(Write(text5[1])) + self.wait(1) + self.play(Transform(table1, table5)) + self.wait(5) + self.play(FadeOut(text5), Write(text6[0])) + self.wait(1) + self.play(Write(text6[1])) + self.wait(1) + self.play(Transform(table1, table6)) + self.wait(5) + self.play(FadeOut(text6), Write(text7[0])) + self.wait(1) + self.play(Write(text7[1])) + self.wait(1) + self.play(Transform(table1, table7)) + self.wait(5) + self.play(FadeOut(text7), Write(text8[0])) + self.wait(1) + self.play(Write(text8[1])) + self.wait(1) + self.play(Transform(table1, table8)) + self.wait(5) + self.play(FadeOut(text8), Write(text9[0])) + self.wait(1) + self.play(Write(text9[1])) + self.play(Write(text9[2])) + + + + self.wait(10) + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT3.py b/source/calculus/manim/CaLT3.py new file mode 100644 index 000000000..e20e97c2c --- /dev/null +++ b/source/calculus/manim/CaLT3.py @@ -0,0 +1,368 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class ComputeLimitRad(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute }\displaystyle \lim_{x\to 9} \frac{\sqrt{x+27}-6}{x-9}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq0 = MathTex(r"=?").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + + + + lhs0 = MathTex(r"\frac{\sqrt{9+27}-6}{9-9}").scale(0.8).next_to(eq0, LEFT) + rhs0 = MathTex(r"\frac{\sqrt{36}-6}{9-9}", r"=?\frac{0}{0}", r"\text{ is undefined.}").scale(0.8).next_to(eq0, RIGHT) + rhs0[2].set_color(RED) + + lhs1 = MathTex(r"\displaystyle \lim_{x\to 9}\frac{\sqrt{x+27}-6}{x-9}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \lim_{x\to 9} \frac{\sqrt{x+27}-6}{x-9}", r"\cdot \frac{\sqrt{x+27}+6}{\sqrt{x+27}+6}").scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(BLUE) + + rhs2 = MathTex(r"\displaystyle \lim_{x\to 9} \frac{(x+27)-6^2}{(x-9)(\sqrt{x+27}+6)}").scale(0.8).next_to(eq2, RIGHT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to 9} \frac{x+27-36}{(x-9)(\sqrt{x+27}+6)}").scale(0.8).next_to(eq2, RIGHT) + rhs4 = MathTex(r"\displaystyle \lim_{x\to 9} \frac{x-9}{(x-9)(\sqrt{x+27}+6)}").scale(0.8).next_to(eq2, RIGHT) + rhs5 = MathTex(r"\displaystyle \lim_{x\to 9} \frac{1}{\sqrt{x+27}+6}").scale(0.8).next_to(eq2, RIGHT) + rhs6 = MathTex(r"\displaystyle \frac{1}{\sqrt{9+27}+6}").scale(0.8).next_to(eq2, RIGHT) + rhs7 = MathTex(r"\displaystyle \frac{1}{\sqrt{36}+6}").scale(0.8).next_to(eq2, RIGHT) + rhs8 = MathTex(r"\displaystyle \frac{1}{6+6}", r"=\frac{1}{12}.").scale(0.8).next_to(eq1, RIGHT) + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs0)) + self.wait(3) + self.play(Write(eq0), Write(rhs0[0])) + self.wait(1) + self.play(Write(rhs0[1])) + self.wait(3) + self.play(Write(rhs0[2])) + self.wait(3) + self.play(FadeOut(eq0, lhs0, rhs0)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1[0])) + self.wait(1) + self.play(Write(rhs1[1])) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(FadeOut(rhs1), rhs2.animate.next_to(eq1, RIGHT), Write(rhs3)) + self.wait(3) + self.play(FadeOut(rhs2), rhs3.animate.next_to(eq1, RIGHT), Write(rhs4)) + self.wait(3) + self.play(FadeOut(rhs3), rhs4.animate.next_to(eq1, RIGHT), Write(rhs5)) + self.wait(3) + self.play(FadeOut(rhs4), rhs5.animate.next_to(eq1, RIGHT), Write(rhs6)) + self.wait(3) + self.play(FadeOut(rhs5), rhs6.animate.next_to(eq1, RIGHT), Write(rhs7)) + self.wait(3) + self.play(FadeOut(rhs6), rhs7.animate.next_to(eq1, RIGHT), FadeOut(eq2)) + self.wait(3) + self.play(FadeOut(rhs7), Write(rhs8[0])) + self.wait(3) + self.play(Write(rhs8[1])) + + self.wait(10) + + + +class ComputeLimitRat(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute }\displaystyle \lim_{x\to 3} \frac{\frac{1}{x-6}+\frac{1}{3}}{x-3}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq0 = MathTex(r"=?").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + + + + lhs0 = MathTex(r"\frac{\frac{1}{3-6}+\frac{1}{3}}{3-3}").scale(0.8).next_to(eq0, LEFT) + rhs0 = MathTex(r"\frac{-\frac{1}{3}+\frac{1}{3}}{3-3}", r"=?\frac{0}{0}", r"\text{ is undefined.}").scale(0.8).next_to(eq0, RIGHT) + rhs0[2].set_color(RED) + + lhs1 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{\frac{1}{x-6}+\frac{1}{3}}{x-3}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{3\frac{1}{x-6}+\frac{1}{3}\frac{x-6}{x-6}}{x-3}").scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{\frac{3}{3(x-6)}+\frac{x-6}{3(x-6)}}{x-3}").scale(0.8).next_to(eq2, RIGHT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{\frac{3+x-6}{3x-18}}{x-3}").scale(0.8).next_to(eq2, RIGHT) + rhs4 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{\frac{x-3}{3x-18}}{x-3}").scale(0.8).next_to(eq2, RIGHT) + rhs5 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{\frac{1}{3x-18}}{1}").scale(0.8).next_to(eq2, RIGHT) + rhs6 = MathTex(r"\displaystyle \lim_{x\to 3} \frac{1}{3x-18}").scale(0.8).next_to(eq2, RIGHT) + rhs7 = MathTex(r"\displaystyle \frac{1}{9-18}", r"=-\frac{1}{9}").scale(0.8).next_to(eq1, RIGHT) + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs0)) + self.wait(3) + self.play(Write(eq0), Write(rhs0[0])) + self.wait(1) + self.play(Write(rhs0[1])) + self.wait(3) + self.play(Write(rhs0[2])) + self.wait(3) + self.play(FadeOut(eq0, lhs0, rhs0)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(FadeOut(rhs1), rhs2.animate.next_to(eq1, RIGHT), Write(rhs3)) + self.wait(3) + self.play(FadeOut(rhs2), rhs3.animate.next_to(eq1, RIGHT), Write(rhs4)) + self.wait(3) + self.play(FadeOut(rhs3), rhs4.animate.next_to(eq1, RIGHT), Write(rhs5)) + self.wait(3) + self.play(FadeOut(rhs4), rhs5.animate.next_to(eq1, RIGHT), Write(rhs6)) + self.wait(3) + self.play(FadeOut(rhs5), rhs6.animate.next_to(eq1, RIGHT), FadeOut(eq2)) + self.wait(3) + self.play(FadeOut(rhs6), Write(rhs7[0])) + self.wait(3) + self.play(Write(rhs7[1])) + + + + + + + self.wait(10) + + +class ComputeLimit(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute }\displaystyle \lim_{x\to 6} \frac{x^2-7x+6}{x^2-10x+24}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq0 = MathTex(r"=?").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + + + + lhs0 = MathTex(r"\displaystyle \frac{6^2-7(6)+6}{6^2-10(6)+24}").scale(0.8).next_to(eq0, LEFT) + rhs0 = MathTex(r"\displaystyle \frac{36-42+6}{36-60+24}", r"=?\frac{0}{0}", r"\text{ is undefined.}").scale(0.8).next_to(eq0, RIGHT) + rhs0[2].set_color(RED) + + lhs1 = MathTex(r"\displaystyle \lim_{x\to 6} \frac{x^2-7x+6}{x^2-10x+24}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \lim_{x\to 6} \frac{(x-1)(x-6)}{(x-4)(x-6)}").scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"\displaystyle \lim_{x\to 6} \frac{x-1}{x-4}").scale(0.8).next_to(eq2, RIGHT) + rhs3 = MathTex(r"\displaystyle \frac{6-1}{6-4}", r"=\frac{5}{2}.").scale(0.8).next_to(eq1, RIGHT) + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs0)) + self.wait(3) + self.play(Write(eq0), Write(rhs0[0])) + self.wait(1) + self.play(Write(rhs0[1])) + self.wait(3) + self.play(Write(rhs0[2])) + self.wait(3) + self.play(FadeOut(eq0, lhs0, rhs0)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(FadeOut(rhs1), rhs2.animate.next_to(eq1, RIGHT), FadeOut(eq2)) + self.wait(3) + self.play(FadeOut(rhs2), Write(rhs3[0])) + self.wait(3) + self.play(Write(rhs3[1])) + + + + + + + self.wait(10) + +class ComputeLimitEZ(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute }\displaystyle \lim_{x\to 5} \frac{x^2-7x+12}{x^2+3x+2}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP) + eq0 = MathTex(r"=?").shift(UP) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + + + + lhs0 = MathTex(r"\displaystyle \lim_{x\to 5} \frac{x^2-7x+12}{x^2+3x+2}=",r"\displaystyle \frac{5^2-7(5)+12}{5^2+3(5)+2}").scale(0.8).next_to(eq0, LEFT) + rhs0 = MathTex(r"\displaystyle \frac{25-35+12}{25+15+2}", r"=\frac{2}{42}", r"=\frac{1}{21}.}").scale(0.8).next_to(eq0, RIGHT) + + + #lhs1 = MathTex(r"\displaystyle \lim_{x\to 6} \frac{x^2-7x+6}{x^2-10x+24}").scale(0.8).next_to(eq1, LEFT) + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs0[1])) + self.wait(3) + self.play(Write(eq0), Write(rhs0[0])) + self.wait(1) + self.play(Write(rhs0[1])) + self.wait(3) + self.play(Write(rhs0[2])) + self.wait(3) + self.play(Write(lhs0[0]), Transform(eq0, eq1)) + + + + + + + self.wait(10) + + + +class ComputeLimitAbs(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute }\displaystyle \lim_{x\to -1} \frac{x^2+3x+2}{|x+1|}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT*1.75) + eq0 = MathTex(r"=?").shift(UP+LEFT*1.75) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + lhs0 = MathTex(r"\displaystyle \frac{(-1)^2+3(-1)+2}{|-1+1|}").scale(0.8).next_to(eq0, LEFT) + rhs0 = MathTex(r"\displaystyle \frac{1-3+2}{|-1+1|}", r"=?\frac{0}{0}", r"\text{ is undefined.}").scale(0.8).next_to(eq0, RIGHT) + rhs0[2].set_color(RED) + + lhs1 = MathTex(r"\displaystyle \lim_{x\to -1} \frac{x^2+3x+2}{|x+1|}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \lim_{x\to -1} \frac{(x+2)(x+1)}{|x+1|}", r"\text{ is undefined.}").scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(RED) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to -1^+} \frac{x^2+3x+2}{|x+1|}").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\displaystyle \lim_{x\to -1^+} \frac{(x+2)(x+1)}{x+1}", r"=\displaystyle \lim_{x\to -1^+} x+2", r"=1.").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"\displaystyle \lim_{x\to -1^-} \frac{x^2+3x+2}{|x+1|}").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to -1^-} \frac{(x+2)(x+1)}{-(x+1)}", r"=\displaystyle \lim_{x\to -1^-} -(x+2)", r"=-1.").scale(0.8).next_to(eq3, RIGHT) + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs0)) + self.wait(3) + self.play(Write(eq0), Write(rhs0[0])) + self.wait(1) + self.play(Write(rhs0[1])) + self.wait(3) + self.play(Write(rhs0[2])) + self.wait(3) + self.play(FadeOut(eq0, lhs0, rhs0)) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1[0])) + self.wait(3) + + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(3) + self.play(Write(rhs2[1])) + self.wait(3) + self.play(Write(rhs2[2])) + self.wait(3) + + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(3) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(rhs3[2])) + self.wait(3) + + self.play(Write(rhs1[1])) + + + + + + + self.wait(10) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT4.py b/source/calculus/manim/CaLT4.py new file mode 100644 index 000000000..9156e15ed --- /dev/null +++ b/source/calculus/manim/CaLT4.py @@ -0,0 +1,342 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class ComputeCont(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{What is } b \text{ so that } f(x) = \begin{cases} \frac{11}{2}x^{2} + b + 2x, & x < 2 \\ -x^{2} + 8x - 10, & x \geq 2 \end{cases} \text{ is continuous}?", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to 2^-}\frac{11}{2} x^2+b+2x").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"26+b").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to 2^+}-x^2+8x-10").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"2").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"\displaystyle \lim_{x\to 2^-}\frac{11}{2} x^2+b+2x").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to 2^+}-x^2+8x-10").scale(0.8).next_to(eq3, RIGHT) + lhs4 = MathTex(r"26+b").scale(0.8).next_to(eq3, LEFT) + rhs4 = MathTex(r"2").scale(0.8).next_to(eq3, RIGHT) + lhs5 = MathTex(r"b").scale(0.8).next_to(eq3, LEFT) + rhs5 = MathTex(r"-24").scale(0.8).next_to(eq3, RIGHT) + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(lhs3, lhs4)) + self.wait(3) + self.play(Transform(rhs3, rhs4)) + self.wait(3) + self.play(Transform(lhs3, lhs5), Transform(rhs3, rhs5)) + + + + self.wait(3) + self.play(FadeOut(eq1, eq2, eq3, rhs1, rhs2, rhs3, lhs1, lhs2, lhs3)) + + + axes = Axes(x_range=[-10.1,10.1,2], y_range=[-30.1,30.1,6], x_length=4.2, y_length=4.2,) + axes_labels = axes.get_axis_labels() + + + + + + tracker=ValueTracker(0) + + leftcurve = axes.plot(lambda x: (11/2)*x**2+2*x, + x_range=[-((664)**(1/2)-2)/11, 2], + use_smoothing=False, color=YELLOW) + + + + def update(mob): + mob.become( + axes.plot(lambda x: (11/2)*x**2+2*x + tracker.get_value(), + x_range=[-((664-22*tracker.get_value())**(1/2)-2)/11, 2], + use_smoothing=False, color=YELLOW) + + ) + + + leftcurve.add_updater(update) + + rightcurve = axes.plot(lambda x: (-1)*x**2+8*x-10, + x_range=[2, 10], + use_smoothing=False, color=YELLOW) + + + btext = MathTex(r"b=").scale(0.7).shift(DOWN*3) + + + number=DecimalNumber( + 0, + show_ellipsis=True, + num_decimal_places=0, + include_sign=True, + ).scale(0.7).next_to(btext, RIGHT) + def updateNum(mob): + mob.become(DecimalNumber( + tracker.get_value(), + show_ellipsis=True, + num_decimal_places=0, + include_sign=True, + )).scale(0.7).next_to(btext, RIGHT) + number.add_updater(updateNum) + + + self.play(Create(axes), Create(axes_labels)) + self.play(Write(btext), Write(number), Create(leftcurve), Create(rightcurve)) + self.wait(4) + self.play(tracker.animate.set_value(-29), run_time=5) + self.wait(4) + self.play(tracker.animate.set_value(-24), run_time=2) + + + self.wait(10) + + +class ComputeRemovable(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Identify the discontinuity: } g(x) = \begin{cases} -8 \, x + 30, & x < 4 \\ 3, & x = 4 \\ 2 \, x - 10, & x > 4 \\ \end{cases}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to 4^-}-8x+30").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"-2").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to 4^+}2x-10").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"-2").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"\displaystyle \lim_{x\to 4^-}-8x+30").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to 4^+}2x-10").scale(0.8).next_to(eq3, RIGHT) + + caption = MathTex(r"\text{Removable discontinuity}", color=BLUE).shift(DOWN*2.5) + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3), Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Write(caption)) + + + + + self.wait(3) + self.play(FadeOut(eq1, eq2, eq3, rhs1, rhs2, rhs3, lhs1, lhs2, lhs3)) + + + axes = Axes(x_range=[-0.1,8.1,2], y_range=[-10.1,10.1,2], x_length=4.2, y_length=4.2,) + axes_labels = axes.get_axis_labels() + + + + + + + leftcurve = axes.plot(lambda x: -8*x+30, + x_range=[2.5,3.95], + use_smoothing=False, color=YELLOW) + + + + rightcurve = axes.plot(lambda x: 2*x-10, + x_range=[4.05, 8], + use_smoothing=False, color=YELLOW) + + point = Point(axes.coords_to_point(4, 3), color=YELLOW).scale(1.5) + + Bound = DashedLine(axes.coords_to_point(4, -10), axes.coords_to_point(4, 10), color=RED) + + + + + + + + self.play(Create(axes), Create(axes_labels)) + self.play(Create(Bound), Create(leftcurve), Create(rightcurve)) + self.play(Create(point)) + self.wait(2) + self.play(FadeOut(Bound)) + + + + self.wait(10) + + +class ComputeJump(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Identify the discontinuity: } h(x) = \begin{cases} 4x + 3, & x < -2 \\ 5, & x = -2 \\ -6x-7, & x > -2 \\ \end{cases}.", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"\neq").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to -2^-}4x+3").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"-5").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to -2^+}-6x-7").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"-2").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"\displaystyle \lim_{x\to -2^-}4x+3").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"\displaystyle \lim_{x\to -2^+}-6x-7").scale(0.8).next_to(eq3, RIGHT) + + caption = MathTex(r"\text{Jump discontinuity}", color=BLUE).shift(DOWN*2.5) + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Write(lhs3), Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Write(caption)) + + + + + self.wait(3) + self.play(FadeOut(eq1, eq2, eq3, rhs1, rhs2, rhs3, lhs1, lhs2, lhs3)) + + + axes = Axes(x_range=[-4,4,2], y_range=[-10,10,2], x_length=4.2, y_length=4.2,) + axes_labels = axes.get_axis_labels() + + + point = Point(axes.coords_to_point(-2, 5), color=YELLOW).scale(1.5) + + + + leftcurve = axes.plot(lambda x: 4*x+3, + x_range=[-13/4,-2.05], + use_smoothing=False, color=YELLOW) + + + + rightcurve = axes.plot(lambda x: -6*x-7, + x_range=[-1.95, 0.5], + use_smoothing=False, color=YELLOW) + + + + Bound = DashedLine(axes.coords_to_point(-2, -10), axes.coords_to_point(-2, 10), color=RED) + + + + + + + + self.play(Create(axes), Create(axes_labels)) + self.play(Create(Bound), Create(leftcurve), Create(rightcurve)) + self.play(Create(point)) + self.wait(2) + self.play(FadeOut(Bound)) + + + + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT5.py b/source/calculus/manim/CaLT5.py new file mode 100644 index 000000000..3726a1629 --- /dev/null +++ b/source/calculus/manim/CaLT5.py @@ -0,0 +1,199 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class LimitInfinity(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute } \displaystyle \lim_{x\to -\infty} \frac{7x^2 - x^6 + 3}{5x + 3x^3 - 5}, \displaystyle \lim_{x\to \infty} \frac{7x^2 - x^6 + 3}{5x + 3x^3 - 5}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to -\infty}\frac{7x^2 - x^6 + 3}{5x + 3x^3 - 5}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\lim_{x\to -\infty}\frac{\frac{7x^2}{x^3} - \frac{x^6}{x^3} + \frac{3}{x^3} }{ \frac{5x}{x^3} + \frac{3x^3}{x^3} - \frac{5}{x^3} }").scale(0.8).next_to(eq1, RIGHT) + + + rhs1b = MathTex(r"\lim_{x\to -\infty}\frac{\frac{7}{x} - x^3 + \frac{3}{x^3} }{ \frac{5}{x^2} + 3 - \frac{5}{x^3} }").scale(0.8).next_to(eq1, RIGHT) + rhs1c = MathTex(r"\lim_{x\to -\infty}\frac{0 - x^3 + 0 }{ 0 + 3 - 0 }").scale(0.8).next_to(eq1, RIGHT) + rhs1d = MathTex(r"\lim_{x\to -\infty}-\frac{x^3}{3}=\infty").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to \infty}\frac{7x^2 - x^6 + 3}{5x + 3x^3 - 5}").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\lim_{x\to \infty}-\frac{x^3}{3}", r"=-\infty").scale(0.8).next_to(eq2, RIGHT) + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Transform(rhs1, rhs1b)) + self.wait(5) + self.play(Transform(rhs1, rhs1c)) + self.wait(5) + self.play(Transform(rhs1, rhs1d)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(5) + self.play(Write(rhs2[1])) + + + + + + self.wait(10) + + +class LimitConstant(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute } \displaystyle \lim_{x\to -\infty} \frac{8x^3 +3x^4 - 4}{5x^2 + 8x^4 - 9}, \displaystyle \lim_{x\to \infty} \frac{8x^3 +3x^4 - 4}{5x^2 + 8x^4 - 9}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to -\infty}\frac{8x^3 +3x^4 - 4}{5x^2 + 8x^4 - 9}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\lim_{x\to -\infty}\frac{\frac{8x^3}{x^4} + \frac{3x^4}{x^4} - \frac{4}{x^4} }{ \frac{5x^2}{x^4} + \frac{8x^4}{x^4} - \frac{9}{x^4} }").scale(0.8).next_to(eq1, RIGHT) + + + rhs1b = MathTex(r"\lim_{x\to -\infty}\frac{\frac{8}{x} + 3 - \frac{4}{x^4} }{ \frac{5}{x^2} + 8 - \frac{9}{x^4} }").scale(0.8).next_to(eq1, RIGHT) + rhs1c = MathTex(r"\frac{0 +3 - 0 }{ 0 + 8 - 0 }").scale(0.8).next_to(eq1, RIGHT) + rhs1d = MathTex(r"\frac{3}{8}").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to \infty}\frac{8x^3 +3x^4 - 4}{5x^2 + 8x^4 - 9}").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\lim_{x\to \infty}\frac{\frac{8}{x} + 3 - \frac{4}{x^4} }{ \frac{5}{x^2} + 8 - \frac{9}{x^4} }", r"=\frac{3}{8}").scale(0.8).next_to(eq2, RIGHT) + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Transform(rhs1, rhs1b)) + self.wait(5) + self.play(Transform(rhs1, rhs1c)) + self.wait(5) + self.play(Transform(rhs1, rhs1d)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(5) + self.play(Write(rhs2[1])) + + + + + + self.wait(10) + + +class LimitZero(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute } \displaystyle \lim_{x\to -\infty} \frac{2x^2 - x^3 +5}{2x^3 + 7x^5 - 2x}, \displaystyle \lim_{x\to \infty} \frac{2x^2 - x^3 +5}{2x^3 + 7x^5 - 2x}", color=TEAL).scale(0.8) + title1.to_edge(UP) + + + eq1 = MathTex(r"=").shift(UP+LEFT) + eq2 = MathTex(r"=").next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").next_to(eq2, DOWN*5) + + + + + lhs1 = MathTex(r"\displaystyle \lim_{x\to -\infty} \frac{2x^2 - x^3 +5}{2x^3 + 7x^5 - 2x}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\lim_{x\to -\infty} \frac{ \frac{2x^2}{x^3} - \frac{x^3}{x^3} + \frac{5}{x^3} }{ \frac{2x^3}{x^3} + \frac{7x^5}{x^3} - \frac{2x}{x^3} }").scale(0.8).next_to(eq1, RIGHT) + + + rhs1b = MathTex(r"\lim_{x\to -\infty} \frac{ \frac{2}{x} - 1 + \frac{5}{x^3} }{ 2 + 7x^2 - \frac{2}{x^2} }").scale(0.8).next_to(eq1, RIGHT) + rhs1c = MathTex(r"\lim_{x\to -\infty} \frac{0 -1 + 0 }{ 2 + 7x^2 - 0 }").scale(0.8).next_to(eq1, RIGHT) + rhs1d = MathTex(r"0").scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"\displaystyle \lim_{x\to \infty} \frac{2x^2 - x^3 +5}{2x^3 + 7x^5 - 2x}").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\lim_{x\to \infty} \frac{0 -1 + 0 }{ 2 + 7x^2 - 0 }", r"=0").scale(0.8).next_to(eq2, RIGHT) + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(title1) + self.wait(5) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Transform(rhs1, rhs1b)) + self.wait(5) + self.play(Transform(rhs1, rhs1c)) + self.wait(5) + self.play(Transform(rhs1, rhs1d)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(5) + self.play(Write(rhs2[1])) + + + + + + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CaLT6.py b/source/calculus/manim/CaLT6.py new file mode 100644 index 000000000..80aa8f7e4 --- /dev/null +++ b/source/calculus/manim/CaLT6.py @@ -0,0 +1,167 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + +class ComputeLimits(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Compute the left and right limits as } x \text{ approaches } -1, 2 \text{ of }\frac{(x-4)(x+2)}{(x-2)^2(x+1)}", color=TEAL).scale(0.7) + title1.to_edge(UP) + + + axes = Axes(x_range=[-5,5,2], y_range=[-10,10,2], x_length=4.2, y_length=4.2,) + axes_labels = axes.get_axis_labels() + + + + + + + + curve1 = axes.plot(lambda x: (x-4)*(x+2)/((x-2)**2*(x+1)), + x_range=[-5,-1.051], + use_smoothing=False, color=YELLOW) + + curve2 = axes.plot(lambda x: (x-4)*(x+2)/((x-2)**2*(x+1)), + x_range=[-0.932, 1.392], + use_smoothing=False, color=YELLOW) + + curve3 = axes.plot(lambda x: (x-4)*(x+2)/((x-2)**2*(x+1)), + x_range=[2.448, 5], + use_smoothing=False, color=YELLOW) + + zero1 = DashedLine(axes.coords_to_point(-2, -10), axes.coords_to_point(-2, 10), color=BLUE) + zero2 = DashedLine(axes.coords_to_point(4, -10), axes.coords_to_point(4, 10), color=BLUE) + + ass1 = DashedLine(axes.coords_to_point(-1, -10), axes.coords_to_point(-1, 10), color=PURPLE) + ass2 = DashedLine(axes.coords_to_point(2, -10), axes.coords_to_point(2, 10), color=PURPLE) + + + func = MathTex(r"\frac{(x-4)(x+2)}{(x-2)^2(x+1)}").scale(0.7).shift(LEFT*5) + + caption1 = MathTex("x<-2").scale(0.7).shift(DOWN*3) + sign1 = MathTex(r"\frac{(-)(-)}{(-)^2(-)}", color=YELLOW).scale(0.7).shift(RIGHT*5) + s1 = MathTex("-", color=RED).scale(0.5).move_to(axes.coords_to_point(-3.5, -9.5)) + + caption2 = MathTex("-20.", color=ORANGE).scale(0.6).next_to(text3, DOWN*2) + text5a = MathTex(r"f'(-3)=0.", color=PURPLE).scale(0.6).next_to(text4, DOWN*2) + + + + + axes = Axes(x_range=[-11,11,5], y_range=[-1,15,5], x_length=4.2, y_length=4.2,).shift(LEFT*4) + axes_labels = axes.get_axis_labels() + numberplane = NumberPlane(x_range=[-11,11,5], y_range=[-1,15,5], + x_length=4.2, + y_length=4.2, + ).add_coordinates().shift(LEFT*4) + + + + + d2 = DashedLine(axes.coords_to_point(-4, -1), axes.coords_to_point(-4, 15)) + d3 = DashedLine(axes.coords_to_point(-1, -1), axes.coords_to_point(-1, 15)) + d4 = DashedLine(axes.coords_to_point(1, -1), axes.coords_to_point(1, 15)) + d5 = DashedLine(axes.coords_to_point(-3, -1), axes.coords_to_point(-3, 15)) + + + + + + + #First x + + tracker1=ValueTracker(0) + + l2 = DashedLine(axes.coords_to_point(-11, 3), axes.coords_to_point(-1, -1), color=GREEN) + l5 = DashedLine(axes.coords_to_point(-11, 0), axes.coords_to_point(11, -0), color=PURPLE) + l4 = DashedLine(axes.coords_to_point(-8, -1), axes.coords_to_point(11, 2.8), color=ORANGE) + + def updatel2(mob): + mob.become( + DashedLine(axes.coords_to_point(-11, 3+tracker1.get_value()), + axes.coords_to_point(-1, -1+tracker1.get_value()), + color=GREEN) + + ) + + + l2.add_updater(updatel2) + + def updatel4(mob): + mob.become( + DashedLine(axes.coords_to_point(-8, -1+tracker1.get_value()), axes.coords_to_point(11, 2.8+tracker1.get_value()), color=ORANGE) + + ) + + + l4.add_updater(updatel4) + + + def updatel5(mob): + mob.become( + DashedLine(axes.coords_to_point(-11, 0+tracker1.get_value()), axes.coords_to_point(11, -0+tracker1.get_value()), color=PURPLE) + + ) + + + l5.add_updater(updatel5) + + + + + curve1 = axes.plot(lambda x: (x+3)**2/5, + x_range=[-10, -1], + use_smoothing=True, + color=YELLOW) + + + def updatecurve1(mob): + mob.become( + axes.plot(lambda x: (x+3)**2/5+tracker1.get_value(), + x_range=[-10, -1], + use_smoothing=True, + color=YELLOW) + + ) + + + curve1.add_updater(updatecurve1) + + + + + curve2 = axes.plot(lambda x: (x)**2/10+0.7, + x_range=[-1, 10], + use_smoothing=True, + color=YELLOW) + + + def updatecurve2(mob): + mob.become( + axes.plot(lambda x: (x)**2/10+0.7+tracker1.get_value(), + x_range=[-1, 10], + use_smoothing=True, + color=YELLOW) + + ) + + curve2.add_updater(updatecurve2) + + + + P2=Dot(axes.coords_to_point(-4, 0.2)) + def updateP2(mob): + mob.become( + Dot(axes.coords_to_point(-4, 0.2+tracker1.get_value())).scale(0.7) + + ) + P2.add_updater(updateP2) + + P3=Dot(axes.coords_to_point(-1, 0.8)) + def updateP3(mob): + mob.become( + Dot(axes.coords_to_point(-1, 0.8+tracker1.get_value())).scale(0.7) + + ) + P3.add_updater(updateP3) + + P4=Dot(axes.coords_to_point(1, 0.8)) + def updateP4(mob): + mob.become( + Dot(axes.coords_to_point(1, 0.8+tracker1.get_value())).scale(0.7) + + ) + P4.add_updater(updateP4) + + P5=Dot(axes.coords_to_point(-3, 0)) + def updateP5(mob): + mob.become( + Dot(axes.coords_to_point(-3, 0+tracker1.get_value())).scale(0.7) + + ) + P5.add_updater(updateP5) + + + + + + + + + + #self.add_fixed_in_frame_mobjects(title) + self.add(axes, axes_labels, numberplane, title1) + self.play(Write(text1), Write(text2), Write(text3), Write(text4), Write(text5), ) + self.wait(5) + self.play(Transform(text2, text2a)) + self.wait(5) + self.play(Transform(text4, text4a)) + self.wait(5) + self.play(Transform(text5, text5a)) + self.wait(5) + self.play(text2.animate.scale(1.5)) + self.play(text2.animate.scale(2/3)) + self.wait(1) + self.play(Create(d2), Create(l2), Create(P2)) + self.wait(3) + + self.play(text3.animate.scale(1.5)) + self.play(text3.animate.scale(2/3)) + self.wait(1) + self.play(Create(d3), Create(P3)) + self.wait(3) + + self.play(text4.animate.scale(1.5)) + self.play(text4.animate.scale(2/3)) + self.wait(1) + self.play(Create(d4), Create(l4), Create(P4)) + self.wait(3) + + self.play(text5.animate.scale(1.5)) + self.play(text5.animate.scale(2/3)) + self.wait(1) + self.play(Create(d5), Create(l5), Create(P5)) + self.wait(5) + self.play(Create(curve1)) + self.play(Create(curve2)) + self.play(FadeOut(d2, d3, d4, d5)) + self.wait(5) + + self.play(tracker1.animate.set_value(5), run_time=4) + self.play(tracker1.animate.set_value(0), run_time=4) + self.wait(5) + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalDF2.py b/source/calculus/manim/CalDF2.py new file mode 100644 index 000000000..46fc14bb1 --- /dev/null +++ b/source/calculus/manim/CalDF2.py @@ -0,0 +1,266 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindDquad(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } f(x)=x^2-3x+2 \text{ using the limit definition.}", color=BLUE).scale(0.8).to_edge(UP) + title1a = MathTex(r"\text{Find } f'(-5).", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"f'(x)=2x-3." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"f'(x)",).scale(0.8).next_to(eq1, LEFT) + + + rhs1 = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"f(x) ", "\over h }",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(GREEN) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"f(x) ", "\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(GREEN) + rhs2[3].set_color(RED) + + rhs2a = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"(x^2-3x+2) ", "\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2a[1].set_color(GREEN) + rhs2a[3].set_color(RED) + + rhs2b = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ ((x+h)^2-3(x+h)+2) ", r"- ", r"(x^2-3x+2) ", "\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2b[1].set_color(GREEN) + rhs2b[3].set_color(RED) + + + rhs3 = MathTex(r"\displaystyle \lim_{h\to 0}\frac{x^2+2xh+h^2-3x-3h+2-x^2+3x-2}{h}",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"\displaystyle \lim_{h\to 0}\frac{2xh+h^2-3h}{h}", r"=\displaystyle \lim_{h\to 0} 2x+h-3", r"=2x-3").scale(0.8).next_to(eq4, RIGHT) + + lhs1a = MathTex(r"f'(-5)",).scale(0.8).next_to(eq1, LEFT) + rhs1a = MathTex(r"2(-5)-3=-18.").scale(0.8).next_to(eq1, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play(Transform(rhs2, rhs2b)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4[0])) + self.wait(3) + self.play(Write(rhs4[1])) + self.wait(3) + self.play(Write(rhs4[2])) + self.wait(3) + self.play(Write(caption1)) + self.wait(5) + self.play(Transform(title1, title1a), + FadeOut( eq4, rhs4, eq3, rhs3, eq2, rhs2, eq1, rhs1), + Transform(lhs1, lhs1a)) + self.wait(5) + self.play(Write(eq1), Write(rhs1a)) + self.wait(5) + +class FindDrational(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } g(x)=\frac{2}{x^2} \text{ using the limit definition.}", color=BLUE).scale(0.8).to_edge(UP) + title1a = MathTex(r"\text{Find } g'(-0.5).", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"g'(x)=-\frac{4}{x^3}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"g'(x)",).scale(0.8).next_to(eq1, LEFT) + + + rhs1 = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"f(x) ", "\over h }",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(GREEN) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \lim_{h\to 0} \Biggl(", r" f(x+h) ", r"- ", r"f(x) ", r"\Biggr)\frac{1}{h}",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(GREEN) + rhs2[3].set_color(RED) + + rhs2a = MathTex(r"\displaystyle \lim_{h\to 0} \Biggl(", r" f(x+h) ", r"- ", r"\frac{2}{x^2} ", r"\Biggr)\frac{1}{h}",).scale(0.8).next_to(eq2, RIGHT) + rhs2a[1].set_color(GREEN) + rhs2a[3].set_color(RED) + + rhs2b = MathTex(r"\displaystyle \lim_{h\to 0} \Biggl(", r" \frac{2}{(x+h)^2} ", r"- ", r"\frac{2}{x^2} ", r"\Biggr)\frac{1}{h}",).scale(0.8).next_to(eq2, RIGHT) + rhs2b[1].set_color(GREEN) + rhs2b[3].set_color(RED) + + + rhs3 = MathTex(r"\displaystyle \lim_{h\to 0} \frac{2x^2-2x^2-4xh+4h^2}{x^2(x+h)^2} \frac{1}{h}",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"\displaystyle \lim_{h\to 0} \frac{(-4x+4h)h}{x^2(x+h)^2}\frac{1}{h}", r"=\displaystyle \lim_{h\to 0} \frac{-4x+4h}{x^2(x+h)^2}", r"=-\frac{4x}{x^4}=-\frac{4}{x^3}.").scale(0.8).next_to(eq4, RIGHT) + + lhs1a = MathTex(r"g'(-0.5)",).scale(0.8).next_to(eq1, LEFT) + rhs1a = MathTex(r"-\frac{4}{(-0.5)^3}=32.").scale(0.8).next_to(eq1, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play(Transform(rhs2, rhs2b)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4[0])) + self.wait(3) + self.play(Write(rhs4[1])) + self.wait(3) + self.play(Write(rhs4[2])) + self.wait(3) + self.play(Write(caption1)) + self.wait(5) + self.play(Transform(title1, title1a), + FadeOut( eq4, rhs4, eq3, rhs3, eq2, rhs2, eq1, rhs1), + Transform(lhs1, lhs1a)) + self.wait(5) + self.play(Write(eq1), Write(rhs1a)) + self.wait(5) + + + + + +class FindDradical(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } h(x)=\sqrt{x-5} \text{ using the limit definition.}", color=BLUE).scale(0.8).to_edge(UP) + title1a = MathTex(r"\text{Find } h'(9).", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"h'(x)=\frac{1}{2\sqrt{x-5}}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*5) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"h'(x)",).scale(0.8).next_to(eq1, LEFT) + + + rhs1 = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"f(x) ", r"\over h }",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(GREEN) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"f(x) ", r"\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(GREEN) + rhs2[3].set_color(RED) + + rhs2a = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ f(x+h) ", r"- ", r"\sqrt{x-5} ", r"\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2a[1].set_color(GREEN) + rhs2a[3].set_color(RED) + + rhs2b = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ \sqrt{(x+h)-5} ", r"- ", r"\sqrt{x-h} ", r"\over h }",).scale(0.8).next_to(eq2, RIGHT) + rhs2b[1].set_color(GREEN) + rhs2b[3].set_color(RED) + + rhs2c = MathTex(r"\displaystyle \lim_{h\to 0}", r"{ \sqrt{(x+h)-5} ", r"- ", r"\sqrt{x-h} ", r"\over h }", r"\frac{ \sqrt{x+h-5} + \sqrt{x-5} }{ \sqrt{x+h-5} + \sqrt{x-5} }").scale(0.8).next_to(eq2, RIGHT) + rhs2c[1].set_color(GREEN) + rhs2c[3].set_color(RED) + + + rhs3 = MathTex(r"\displaystyle \lim_{h\to 0}\frac{(x+h-5)-(x-5) }{\sqrt{x+h-5} + \sqrt{x-5}} \frac{1}{h}",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"\displaystyle \lim_{h\to 0}\frac{h}{h}\frac{1}{\sqrt{x+h-5} + \sqrt{x-5}}", r"=\frac{1}{\sqrt{x+0-5} + \sqrt{x-5}}=\frac{1}{2\sqrt{x-5}}").scale(0.8).next_to(eq4, RIGHT) + + lhs1a = MathTex(r"h'(9)",).scale(0.8).next_to(eq1, LEFT) + rhs1a = MathTex(r"\frac{1}{2\sqrt{9-5}}=\frac{1}{4}.").scale(0.8).next_to(eq1, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play(Transform(rhs2, rhs2b)) + self.wait(5) + self.play(Transform(rhs2, rhs2c)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4[0])) + self.wait(3) + self.play(Write(rhs4[1])) + self.wait(3) + self.play(Write(caption1)) + self.wait(5) + self.play(Transform(title1, title1a), + FadeOut( eq4, rhs4, eq3, rhs3, eq2, rhs2, eq1, rhs1), + Transform(lhs1, lhs1a)) + self.wait(5) + self.play(Write(eq1), Write(rhs1a)) + self.wait(5) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalDF3.py b/source/calculus/manim/CalDF3.py new file mode 100644 index 000000000..fa25895af --- /dev/null +++ b/source/calculus/manim/CalDF3.py @@ -0,0 +1,209 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindDtransc(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } h(t)=-3\cos(t)+2\ln(t).}", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"h'(t)=3\sin(t)+\frac{2}{t}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"h(t)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"-3\cos(t)+2\ln(t)",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"h'(t)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"-3", r"\frac{d}{dt} \bigl[", r" \cos(t)", r"\bigr] ", r" +2 ", r"\frac{d}{dt}\bigl[ ", r" \ln(t)", r"\bigr]").scale(0.8).next_to(eq2, RIGHT) + + rhs2[1].set_color(BLUE) + rhs2[3].set_color(BLUE) + rhs2[5].set_color(BLUE) + rhs2[7].set_color(BLUE) + + + + + rhs3 = MathTex(r"-3(-\sin(t))+2\frac{1}{t}",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"3\sin(t)+\frac{2}{t}.").scale(0.8).next_to(eq4, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.play(Write(caption1)) + self.wait(5) + + + + +class FindDpower(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } g(y)=\sqrt[3]{y^7}+\frac{7}{y^4}.}", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"g'(y)=\frac{7}{3}\sqrt[3]{y^4}-\frac{28}{y^5} ." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"g(y)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\sqrt[3]{y^7}+\frac{7}{y^4}",).scale(0.8).next_to(eq1, RIGHT) + rhs1a = MathTex(r"y^{\frac{7}{3}}+7y^{-4}",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"g'(y)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex( r"\frac{d}{dy} \bigl[", r" y^{\frac{7}{3}}", r"\bigr] ", r" +7 ", r"\frac{d}{dt}\bigl[ ", r"y^{-4}", r"\bigr]").scale(0.8).next_to(eq2, RIGHT) + + rhs2[0].set_color(BLUE) + rhs2[2].set_color(BLUE) + rhs2[4].set_color(BLUE) + rhs2[6].set_color(BLUE) + + + + + rhs3 = MathTex(r"\frac{7}{3}(y^{\frac{4}{3}})+7(-4)y^{-5}",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"\frac{7}{3}\sqrt[3]{y^4}-\frac{28}{y^5}.").scale(0.8).next_to(eq4, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.play(Write(caption1)) + self.wait(5) + + + + + + + + + +class FindDpoly(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } f(x)=8x^5+x^4-7x^2-3.}", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"f'(x)=40x^4+4x^3-14x'." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"f(x)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"8x^5+x^4-7x^2-3",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"f'(x)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"8", r"\frac{d}{dx} \bigl[", r" x^5", r"\bigr] ", r" + ", r"\frac{d}{dx}\bigl[ ", r" x^4", r"\bigr]", + r" -7 ", r"\frac{d}{dx}\bigl[ ", r" x^2", r"\bigr]", r" - ", + r"\frac{d}{dx}\bigl[ ", r" 3", r"\bigr]",).scale(0.8).next_to(eq2, RIGHT) + + rhs2[1].set_color(BLUE) + rhs2[3].set_color(BLUE) + rhs2[5].set_color(BLUE) + rhs2[7].set_color(BLUE) + rhs2[9].set_color(BLUE) + rhs2[11].set_color(BLUE) + rhs2[13].set_color(BLUE) + rhs2[15].set_color(BLUE) + + + + + rhs3 = MathTex(r"8(5)x^4+4x^3-7(2)x-0",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"40x^4+4x^3-14x.").scale(0.8).next_to(eq4, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.play(Write(caption1)) + self.wait(5) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalDF4.py b/source/calculus/manim/CalDF4.py new file mode 100644 index 000000000..b271cdaa8 --- /dev/null +++ b/source/calculus/manim/CalDF4.py @@ -0,0 +1,272 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindQuotient(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } h(t)=\frac{\sin(t)}{2t^2-5t+7}.}", color=TEAL).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{By the Quotient Rule}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"h(t)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{\sin(t)}{2t^2-5t+7}",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"h'(t)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\frac{d}{dt} \Biggl[", r"{\sin(t)", r"\over", r"2t^2-5t+7}", r"\Biggr]").scale(0.8).next_to(eq2, RIGHT) + + rhs2[1].set_color(BLUE) + rhs2[3].set_color(RED) + + + + + rhs3 = MathTex(r"{(t^2-5t+7)", r"\frac{d}{dt}[\sin(t)]", r"-", r"\sin(t)", r"\frac{d}{dt}[2t^2-5t+7]", r"\over", r"(2t^2-5t+7)^2}",).scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(RED) + rhs3[1].set_color(BLUE) + rhs3[3].set_color(BLUE) + rhs3[4].set_color(RED) + rhs3[6].set_color(RED) + + rhs4 = MathTex(r"{(t^2-5t+7)", r"\cos(t)", r"-", r"\sin(t)", r"(4t-5)", r"\over", r"(2t^2-5t+7)^2}", ).scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(RED) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + rhs4[4].set_color(RED) + rhs4[6].set_color(RED) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3), Write(caption1)) + self.wait(5) + self.play(FadeOut(caption1)) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(rhs4.animate.set_color(WHITE)) + + self.wait(5) + + + + +class FindProduct(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } g(x)=(3x^2-7x+4)e^x.}", color=TEAL).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{By the Product Rule}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"g(x)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"(3x^2-7x+4)e^x",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"g'(x)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\frac{d}{dt} \Biggl[", r"(3x^2-7x+4)", r"e^x", r"\Biggr]").scale(0.8).next_to(eq2, RIGHT) + + rhs2[1].set_color(BLUE) + rhs2[2].set_color(RED) + + + + + rhs3 = MathTex(r"(3x^2-7x+4)", r"\frac{d}{dx}[e^x]", r"+", r"e^x", r"\frac{d}{dx}[3x^2-7x+4]").scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[1].set_color(RED) + rhs3[3].set_color(RED) + rhs3[4].set_color(BLUE) + + rhs4 = MathTex(r"(3x^2-7x+4)", r"e^x", r"+", r"e^x", r"(6x-7)").scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(RED) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + rhs4[4].set_color(RED) + + rhs4a = MathTex(r"(3x^2-x-3)", r"e^x").scale(0.8).next_to(eq4, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3), Write(caption1)) + self.wait(5) + self.play(FadeOut(caption1)) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + + self.wait(5) + + + + +class FindPower(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative of } f(y)=\frac{y^2+3y-2}{\sqrt{y}}.}", color=TEAL).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{By the Quotient Rule}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"f(y)",).scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{y^2+3y-2}{\sqrt{y}}",).scale(0.8).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\frac{y^2+3y-2}{y^{\frac{1}{2}}}",).scale(0.8).next_to(eq1, RIGHT) + rhs1b = MathTex(r"y^{\frac{3}{2}} +3y^{\frac{1}{2}} -2y^{-\frac{1}{2}} ",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"f'(y)",).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\frac{3}{2}y^{\frac{1}{2}} +3\frac{1}{2}y^{-\frac{1}{2}} -2\left(-\frac{1}{2}\right)y^{-\frac{3}{2}}").scale(0.8).next_to(eq2, RIGHT) + + + + + rhs3 = MathTex(r"\frac{3}{2}\sqrt{y} +\frac{3}{2\sqrt{y}} +\frac{1}{y\sqrt{y}}").scale(0.8).next_to(eq3, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Transform(rhs1, rhs1b)) + self.wait(3) + self.play(Write(lhs2)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(FadeOut(rhs3, eq3, rhs2, eq2, lhs2, rhs1, eq1)) + self.wait(3) + self.play(Write(eq1), Write(rhs1a)) + self.wait(3) + + + + rhs2 = MathTex(r"\frac{d}{dy}\Biggl[", r"{y^2+3y-2", r"\over", r"y^{\frac{1}{2}} }", r"\Biggr]").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2[3].set_color(RED) + + rhs3 = MathTex(r"{y^\frac{1}{2}", r"\frac{d}{dy}[y^2+3y-2]", r"-", r"(y^2+3y-2)", r"\frac{d}{dy}[y^{\frac{1}{2}}]", r"\over", r"\left(y^\frac{1}{2}\right)^2} }",).scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(RED) + rhs3[1].set_color(BLUE) + rhs3[3].set_color(BLUE) + rhs3[4].set_color(RED) + rhs3[6].set_color(RED) + + rhs4 = MathTex(r"{y^\frac{1}{2}", r"(2y+3)", r"-", r"(y^2+3y-2)", r"\frac{1}{2}y^{-\frac{1}{2}}", r"\over", r"\left(y^\frac{1}{2}\right)^2} }",).scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(RED) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + rhs4[4].set_color(RED) + rhs4[6].set_color(RED) + + rhs4a = MathTex(r"{y^\frac{1}{2}", r"(2y+3)", r"-", r"(y^2+3y-2)", r"\frac{1}{2}y^{-\frac{1}{2}}", r"\over", r"y}",).scale(0.8).next_to(eq4, RIGHT) + rhs4a[0].set_color(RED) + rhs4a[1].set_color(BLUE) + rhs4a[3].set_color(BLUE) + rhs4a[4].set_color(RED) + rhs4a[6].set_color(RED) + + rhs4b = MathTex(r"y^{-\frac{1}{2}}", r"(2y+3)", r"-", r"(y^2+3y-2)", r"\frac{1}{2}y^{-\frac{3}{2}}").scale(0.8).next_to(eq4, RIGHT) + rhs4c = MathTex( r"2y^{\frac{1}{2}}+3y^{-\frac{1}{2}}", r"-", r"\frac{1}{2}y^{\frac{1}{2}} -\frac{3}{2}y^{-\frac{1}{2}}+y^{-\frac{3}{2}}").scale(0.8).next_to(eq4, RIGHT) + rhs4d = MathTex( r"\frac{3}{2}y^{\frac{1}{2}}+\frac{3}{2}y^{-\frac{1}{2}}+y^{-\frac{3}{2}}").scale(0.8).next_to(eq4, RIGHT) + rhs4e = MathTex(r"\frac{3}{2}\sqrt{y} +\frac{3}{2\sqrt{y}} +\frac{1}{y\sqrt{y}}").scale(0.8).next_to(eq4, RIGHT) + + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3), Write(caption1)) + self.wait(5) + self.play(FadeOut(caption1)) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + self.play(Transform(rhs4, rhs4b)) + self.wait(5) + self.play(Transform(rhs4, rhs4c)) + self.wait(5) + self.play(Transform(rhs4, rhs4d)) + self.wait(5) + self.play(Transform(rhs4, rhs4e)) + + self.wait(5) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN1.py b/source/calculus/manim/CalIN1.py new file mode 100644 index 000000000..2f54374ed --- /dev/null +++ b/source/calculus/manim/CalIN1.py @@ -0,0 +1,242 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + +class Part1(Scene): + def construct(self): + + #Domain + title1 = MathTex(r"\text{Find }\displaystyle \int_1^4(-3x+6)dx").scale(0.8).to_edge(UP).set_color(TEAL) + + + axes = Axes(x_range=[-2,6,2], y_range=[-8,4,4], x_length=5, y_length=5,).shift(3*RIGHT) + + axes_labels = axes.get_axis_labels(MathTex("x_1").scale(0.5), MathTex("x_2").scale(0.5)) + numberplane = NumberPlane(x_range=[-2,6,2], y_range=[-8,4,4], x_length=5, y_length=5,).add_coordinates().shift(3*RIGHT) + + + plot1 = axes.plot(lambda x:( -3*x+6 ), + x_range=[1, 4], + use_smoothing=True, + color=YELLOW) + + + area1 = axes.get_area(graph=plot1, x_range=[1,2], color=BLUE) + + area2 = axes.get_area(graph=plot1, x_range=[2,4], color=RED) + + P1=Dot(axes.coords_to_point(1, 3), color=WHITE) + label1 = MathTex(r"(1,3)", color=WHITE).scale(0.5).next_to(P1, RIGHT) + + P2=Dot(axes.coords_to_point(2, 0), color=WHITE) + label2 = MathTex(r"(2,0)", color=WHITE).scale(0.5).next_to(P2, UP/1.4+RIGHT/1.4) + + P3=Dot(axes.coords_to_point(4, -6), color=WHITE) + label3 = MathTex(r"(4,-6)", color=WHITE).scale(0.5).next_to(P3, RIGHT) + + + + + eq1 = MathTex(r"=").scale(0.6).shift(UP, LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*4) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*4) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*4) + + + + + + lhs1 = MathTex(r"\displaystyle \int_1^4(-3x+6)dx").scale(0.6).next_to(eq1, LEFT) + + rhs1 = MathTex(r"\displaystyle \frac{1}{2}(3\cdot 1) ", r" - ", r" \frac{1}{2}(6\cdot 2)").scale(0.6).next_to(eq1, RIGHT) + rhs1[0].set_color(BLUE) + rhs1[2].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \frac{3}{2} ", r" - ", r" 6").scale(0.6).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"\displaystyle -\frac{9}{2} ").scale(0.6).next_to(eq3, RIGHT) + + self.add(axes, axes_labels, title1, numberplane) + self.wait(5) + self.play(Create(plot1), Create(area1), Create(area2)) + self.wait(10) + self.play(Create(P1), Write(label1), Create(P2), Write(label2), Create(P3), Write(label3), ) + self.wait(5) + self.play(Write(lhs1)) + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(10) + + +class Part2(Scene): + def construct(self): + + #Domain + title1 = MathTex(r"\displaystyle \int_1^5", r"\left(-\sqrt{16 -{\left(x - 1\right)}^{2} }\right)", r"dx").scale(0.8).to_edge(UP).set_color(TEAL) + + + axes = Axes(x_range=[0, 6, 2], y_range=[-5,1,2], x_length=5, y_length=5,).shift(3*RIGHT) + + axes_labels = axes.get_axis_labels(MathTex("x_1").scale(0.5), MathTex("x_2").scale(0.5)) + numberplane = NumberPlane(x_range=[0, 6, 2], y_range=[-5,1,2], x_length=5, y_length=5,).add_coordinates().shift(3*RIGHT) + + + plot1 = axes.plot(lambda x:( -1*(-1*(x-1)**2+16)**(1/2) ), + x_range=[1, 5], + use_smoothing=True, + color=YELLOW) + + + area1 = axes.get_area(graph=plot1, x_range=[1,5], color=BLUE) + + #area2 = axes.get_area(graph=plot1, x_range=[2,4], color=RED) + + P1=Dot(axes.coords_to_point(1, -4), color=WHITE) + label1 = MathTex(r"(1,-4)", color=WHITE).scale(0.5).next_to(P1, UP) + + P2=Dot(axes.coords_to_point(1, 0), color=WHITE) + label2 = MathTex(r"(1,0)", color=WHITE).scale(0.5).next_to(P2, UP) + + P3=Dot(axes.coords_to_point(5, 0), color=WHITE) + label3 = MathTex(r"(5,0)", color=WHITE).scale(0.5).next_to(P3, UP) + + + + + eq1 = MathTex(r"=").scale(0.6).shift(UP, LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*4) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*4) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*4) + + + + + + lhs1 = MathTex(r"\displaystyle \int_1^5", r"\left(16 -\sqrt{-{\left(x - 1\right)}^{2} }\right)", r"dx").scale(0.6).next_to(eq1, LEFT) + + + + rhs1 = MathTex(r"-\displaystyle \frac{\pi\cdot 4^2}{4} ").scale(0.6).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"-\displaystyle 4\pi ").scale(0.6).next_to(eq2, RIGHT) + + self.add(axes, axes_labels, title1, numberplane) + self.wait(10) + self.play(Wiggle(title1[1])) + self.play(title1[1].animate.set_color(YELLOW)) + self.wait(10) + self.play(Create(plot1), Create(area1), ) + self.play(Create(P1), Write(label1), Create(P2), Write(label2), Create(P3), Write(label3), ) + self.wait(5) + self.play(Write(lhs1)) + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(10) + + + + + + +class Part3(Scene): + def construct(self): + + #Domain + title1 = MathTex(r"\text{Find }\displaystyle \int_2^4(-3x+6)dx").scale(0.8).to_edge(UP).set_color(TEAL) + + + axes = Axes(x_range=[-2,6,2], y_range=[-8,4,4], x_length=5, y_length=5,).shift(3*RIGHT) + + axes_labels = axes.get_axis_labels(MathTex("x_1").scale(0.5), MathTex("x_2").scale(0.5)) + numberplane = NumberPlane(x_range=[-2,6,2], y_range=[-8,4,4], x_length=5, y_length=5,).add_coordinates().shift(3*RIGHT) + + + plot1 = axes.plot(lambda x:( -3*x+6 ), + x_range=[2, 4], + use_smoothing=True, + color=YELLOW) + + + #area1 = axes.get_area(graph=plot1, x_range=[1,2], color=BLUE) + + area2 = axes.get_area(graph=plot1, x_range=[2,4], color=RED) + + #P1=Dot(axes.coords_to_point(1, 3), color=WHITE) + #label1 = MathTex(r"(1,3)", color=WHITE).scale(0.5).next_to(P1, RIGHT) + + P2=Dot(axes.coords_to_point(2, 0), color=WHITE) + label2 = MathTex(r"(2,0)", color=WHITE).scale(0.5).next_to(P2, UP/1.4+RIGHT/1.4) + + P3=Dot(axes.coords_to_point(4, -6), color=WHITE) + label3 = MathTex(r"(4,-6)", color=WHITE).scale(0.5).next_to(P3, RIGHT) + + + + + eq1 = MathTex(r"=").scale(0.6).shift(UP, LEFT*3) + eq2 = MathTex(r"=").scale(0.6).next_to(eq1, DOWN*4) + eq3 = MathTex(r"=").scale(0.6).next_to(eq2, DOWN*4) + eq4 = MathTex(r"=").scale(0.6).next_to(eq3, DOWN*4) + + + + + + lhs1 = MathTex(r"\displaystyle \int_1^4(-3x+6)dx").scale(0.6).next_to(eq1, LEFT) + + rhs1 = MathTex(r" \frac{1}{2}(-6\cdot 2)").scale(0.6).next_to(eq1, RIGHT) + rhs1.set_color(RED) + + rhs2 = MathTex(r"-6").scale(0.6).next_to(eq2, RIGHT) + rhs2.set_color(RED) + + + self.add(axes, axes_labels, title1, numberplane) + self.wait(3) + self.play(Create(plot1), Create(area2)) + self.play( Create(P2), Write(label2), Create(P3), Write(label3), ) + self.wait(10) + self.play(Write(lhs1)) + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + #self.wait(5) + #self.play(Write(eq3), Write(rhs3)) + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN2.py b/source/calculus/manim/CalIN2.py new file mode 100644 index 000000000..38cce0297 --- /dev/null +++ b/source/calculus/manim/CalIN2.py @@ -0,0 +1,445 @@ +#%%manim -ql LIPoly + +from manim import * + + + +class ShowPlot(Scene): + def construct(self): + + + title1 = MathTex(r"\text{Find } R_6, \text{for } f(x)=6x^3-9x^2+3 \text{ on } [0, 2].", color=TEAL).scale(0.8) + title1.to_edge(UP) + + axes = Axes(x_range=[0,2,0.5], y_range=[0,20,5], x_length=6, y_length=5,) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + numberplane = NumberPlane(x_range=[0,2,0.5], y_range=[0,20,5], + x_length=6, + y_length=5, + ).add_coordinates() + + + + + + theplot = axes.plot(lambda x: 6*x**3-9*x**2+3, + x_range=[0, 2], + use_smoothing=True, + color=YELLOW) + + plotlabel = MathTex("f(x)=6x^3-9x^2+3").scale(0.5).next_to(theplot, RIGHT, buff=0.5).set_color(YELLOW) + + rectangles = numberplane.get_riemann_rectangles(theplot, x_range= [0,2 ], dx=2/6, color=RED, fill_opacity=0.6, input_sample_type="right") + + self.add(axes, axes_labels, numberplane, title1) + self.wait(1) + self.play(Create(theplot), Write(plotlabel)) + self.wait(5) + self.play(Create(rectangles)) + self.wait(10) + + + + + + +class FindR6(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find } R_6, \text{for } f(x)=6x^3-9x^2+3 \text{ on }", " [0, 2].", color=TEAL).scale(0.8).to_edge(UP) + + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"R_6").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \sum_{i=1}^6 f(x_i)", "\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(RED) + rhs1a = MathTex(r"\displaystyle \sum_{i=1}^6 f(a+i", r"\Delta x", ")", r"\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1a[1].set_color(RED) + rhs1a[3].set_color(RED) + rhs1b = MathTex(r"\displaystyle \sum_{i=1}^6 f(0+i", r"\Delta x", r")", r"\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1b[1].set_color(RED) + rhs1b[3].set_color(RED) + rhs1c = MathTex(r"\displaystyle \sum_{i=1}^6 f\Biggl(0+i ", r" \frac{1}{3}", r"\Biggr)", r"\frac{1}{3}",).scale(0.8).next_to(eq1, RIGHT) + rhs1c[1].set_color(RED) + rhs1c[3].set_color(RED) + rhs1d = MathTex(r"\displaystyle \sum_{i=1}^6 f\Biggl(", r"\frac{1}{3}", r"i\Biggr)", r"\frac{1}{3}",).scale(0.8).next_to(eq1, RIGHT) + rhs1d[1].set_color(RED) + rhs1d[3].set_color(RED) + lhs2 = MathTex(r"\Delta x", color=RED).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"\frac{b-a}{n}", r"=\frac{2-0}{6}", r"=\frac{1}{3}", color=RED).scale(0.8).next_to(eq2, RIGHT) + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)), + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(2) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(3) + self.play(Wiggle(title1[1])) + self.play(Write(rhs2[1]), ) + self.wait(3) + self.play(Write(rhs2[2])) + self.wait(3) + self.play(Wiggle(title1[1])) + self.play(Transform(rhs1, rhs1b), ) + self.wait(4) + self.play(Transform(rhs1, rhs1c)) + self.wait(4) + self.play(Transform(rhs1, rhs1d)) + self.wait(5) + + + self.play( + FadeOut(rhs2,lhs2, eq2)) + + + rhs2 = MathTex(r"\frac{1}{3}\Biggl(", r"f\left(\frac{1}{3}\right)", r"+f\left(\frac{2}{3}\right)", r"+f\left(\frac{3}{3}\right)" , + r"+f\left(\frac{4}{3}\right)", r"+f\left(\frac{5}{3}\right)", r"+f\left(\frac{6}{3}\right)", r"\Biggr)").scale(0.8).next_to(eq2, RIGHT) + + #rhs3 = MathTex(r"\frac{1}{3}\Biggl(", + # r"6 \left(\frac{1}{3}\right)^3-9 \left(\frac{1}{3}\right)^2+3", + # r"+ 6 \left(\frac{2}{3}\right)^3-9 \left(\frac{2}{3}\right)^2+3", + # r"+ 6 \left(\frac{3}{3}3\right)^3-9 \left(\frac{3}{3}\right)^2+3" , + ## r"+ 6 \left(\frac{4}{3}1\right)^3-9 \left(\frac{4}{3}\right)^2+3", + # r"+ 6 \left(\frac{5}{3}1\right)^3-9 \left(\frac{5}{3}\right)^2+3", + # r"+ 6 \left(\frac{6}{3}1\right)^3-9 \left(\frac{6}{3}\right)^2+3", + # r"\Biggr)").scale(0.5).next_to(eq3, RIGHT) + + rhs3 = MathTex(r"\frac{1}{3}\Biggl(", + r"\frac{20}{9}", + r"+ \frac{7}{9}" , + r"+ 0", + r"+ \frac{11}{9}", + r"+ \frac{52}{9}", + r"+ \frac{135}{9}", + r"\Biggr)").scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"\frac{1}{3}(", + r"25", + r")").scale(0.8).next_to(eq4, RIGHT) + + rhs4a = MathTex(r"\frac{25}{3}",).scale(0.8).next_to(eq4, RIGHT) + + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3)) + for x in range(0, 8): + self.play(Write(rhs3[x])) + self.wait(2) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + #self.play(Transform(rhs4, rhs4b)) + + +class ShowPlot2(Scene): + def construct(self): + + + title1 = MathTex(r"\frac{1}{3}\Biggl(", + r"\frac{20}{9}", + r"+ \frac{7}{9}" , + r"+ 0", + r"+ \frac{11}{9}", + r"+ \frac{52}{9}", + r"+ \frac{135}{9}", + r"\Biggr)", color=TEAL).scale(0.8) + title1.to_edge(UP) + + axes = Axes(x_range=[0,2,0.5], y_range=[0,20,5], x_length=6, y_length=5,) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + numberplane = NumberPlane(x_range=[0,2,0.5], y_range=[0,20,5], + x_length=6, + y_length=5, + ).add_coordinates() + + + + + + theplot = axes.plot(lambda x: 6*x**3-9*x**2+3, + x_range=[0, 2], + use_smoothing=True, + color=YELLOW) + + plotlabel = MathTex("f(x)=6x^3-9x^2+3").scale(0.5).next_to(theplot, RIGHT, buff=0.5).set_color(YELLOW) + + rectangles = numberplane.get_riemann_rectangles(theplot, x_range= [0,2 ], dx=2/6, color=RED, fill_opacity=0.6, input_sample_type="right") + + self.add(axes, axes_labels, numberplane, title1) + self.play(Create(theplot), Write(plotlabel)) + self.play(Create(rectangles)) + self.wait(10) + + +class ShowPlot3(Scene): + def construct(self): + + + title1 = MathTex(r"R_n, \text{where } n=", color=TEAL).scale(0.8).to_edge(UP) + + caption1 = MathTex(r"R_n \approx", color=ORANGE).scale(0.8).to_edge(DOWN) + + axes = Axes(x_range=[0,2,0.5], y_range=[0,20,5], x_length=6, y_length=5,) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + numberplane = NumberPlane(x_range=[0,2,0.5], y_range=[0,20,5], + x_length=6, + y_length=5, + ).add_coordinates() + + + + + + theplot = axes.plot(lambda x: 6*x**3-9*x**2+3, + x_range=[0, 2], + use_smoothing=True, + color=YELLOW) + + rectangles = numberplane.get_riemann_rectangles(theplot, x_range= [0,2 ], dx=2/6, color=RED, fill_opacity=0.6, input_sample_type="right") + + tracker=ValueTracker(6) + + + + + + def update(mob): + mob.become( + numberplane.get_riemann_rectangles(theplot, + x_range= [0,2 ], + dx=2/np.floor(tracker.get_value()), + color=RED, fill_opacity=0.6, input_sample_type="right") + + ) + + + rectangles.add_updater(update) + + number=DecimalNumber( + 6, + show_ellipsis=False, + num_decimal_places=0, + include_sign=False, + color=TEAL, + ).scale(0.8).next_to(title1, RIGHT) + def updateNum(mob): + mob.become(DecimalNumber( + np.floor(tracker.get_value()), + show_ellipsis=False, + num_decimal_places=0, + include_sign=False, + color=TEAL, + )).scale(0.7).next_to(title1, RIGHT) + number.add_updater(updateNum) + + + number2=DecimalNumber( + 8.3333, + show_ellipsis=True, + num_decimal_places=4, + include_sign=False, + color=ORANGE + ).scale(0.8).next_to(caption1, RIGHT) + def updateNum2(mob): + mob.become(DecimalNumber( + 6*((tracker.get_value()**2+2*(tracker.get_value())+2 ))/((tracker.get_value())**2), + show_ellipsis=True, + num_decimal_places=4, + include_sign=False, + color=ORANGE + )).scale(0.7).next_to(caption1, RIGHT) + number2.add_updater(updateNum2) + + plotlabel = MathTex("f(x)=6x^3-9x^2+3").scale(0.5).next_to(theplot, RIGHT, buff=0.5).set_color(YELLOW) + + + + self.add(axes, axes_labels, numberplane, title1, rectangles, theplot, plotlabel, number, caption1, number2) + self.wait(5) + self.play(tracker.animate.set_value(20), run_time=5) + self.wait(3) + self.play(tracker.animate.set_value(500), run_time=5) + self.wait(3) + self.play(tracker.animate.set_value(1), run_time=5) + self.wait(3) + self.play(tracker.animate.set_value(6), run_time=2) + self.wait(5) + + + + +class FindRn(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find } R_n, \text{for } f(x)=6x^3-9x^2+3 \text{ on }", " [0, 2].", color=TEAL).scale(0.8).to_edge(UP) + + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*7) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*7) + + lhs1 = MathTex(r"R_n").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \sum_{i=1}^n f(x_i)", "\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(RED) + rhs1a = MathTex(r"\displaystyle \sum_{i=1}^n f(a+i", r"\Delta x", ")", r"\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1a[1].set_color(RED) + rhs1a[3].set_color(RED) + rhs1b = MathTex(r"\displaystyle \sum_{i=1}^n f(0+i", r"\Delta x", r")", r"\Delta x",).scale(0.8).next_to(eq1, RIGHT) + rhs1b[1].set_color(RED) + rhs1b[3].set_color(RED) + rhs1c = MathTex(r"\displaystyle \sum_{i=1}^n f\Biggl(0+i ", r" \frac{2}{n}", r"\Biggr)", r"\frac{2}{n}",).scale(0.8).next_to(eq1, RIGHT) + rhs1c[1].set_color(RED) + rhs1c[3].set_color(RED) + rhs1d = MathTex(r"\displaystyle \sum_{i=1}^n f\Biggl(", r"\frac{2}{n}", r"i\Biggr)", r"\frac{2}{n}",).scale(0.8).next_to(eq1, RIGHT) + rhs1d[1].set_color(RED) + rhs1d[3].set_color(RED) + rhs1e = MathTex(r"\displaystyle \sum_{i=1}^n \left( 6\left( \frac{2}{n} i\right)^3 - 9\left( \frac{2}{n}i\right)^2 +3 \right)\frac{2}{n}",).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\displaystyle \left( 6\sum_{i=1}^n \left( \frac{2}{n}i\right)^3 - 9\sum_{i=1}^n \left( \frac{2}{n}i\right)^2 + \sum_{i=1}^n 3 \right)\frac{2}{n}",).scale(0.8).next_to(eq2, RIGHT) + rhs3 = MathTex(r"\displaystyle \left( 6\sum_{i=1}^n \left( \frac{2}{n}i\right)^3 - 9\sum_{i=1}^n \left( \frac{2}{n}i\right)^2 + 3n \right)\frac{2}{n}",).scale(0.8).next_to(eq3, RIGHT) + rhs3a = MathTex(r"\displaystyle \left( 6\sum_{i=1}^n \left( \frac{2}{n}i\right)^3 - 9\frac{4}{n^2}\sum_{i=1}^n (i^2) + 3n \right)\frac{2}{n}",).scale(0.8).next_to(eq3, RIGHT) + rhs3b = MathTex(r"\displaystyle \left( 6\frac{8}{n^3}\sum_{i=1}^n (i^3) - 9\frac{4}{n^2}\sum_{i=1}^n (i^2) + 3n \right)\frac{2}{n}",).scale(0.8).next_to(eq3, RIGHT) + rhs3c = MathTex(r"\displaystyle 6\frac{8\cdot 2}{n^3\cdot n}\sum_{i=1}^n (i^3) - 9\frac{4\cdot 2}{n^2\cdot n}\sum_{i=1}^n (i^2) + 3n\frac{2}{n} ",).scale(0.8).next_to(eq3, RIGHT) + rhs3d = MathTex(r"\displaystyle \frac{96}{n^4}\sum_{i=1}^n (i^3) - \frac{72}{n^3}\sum_{i=1}^n (i^2) + 6 ",).scale(0.8).next_to(eq3, RIGHT) + rhs3e = MathTex(r"\displaystyle \frac{96}{n^4}\sum_{i=1}^n (i^3) - \frac{72}{n^3} \frac{n(n+1)(2n+1)}{6} + 6 ",).scale(0.8).next_to(eq3, RIGHT) + rhs3f = MathTex(r"\displaystyle \frac{96}{n^4}\frac{n^2(n+1)^2}{4} - \frac{72}{n^3} \frac{n(n+1)(2n+1)}{6} + 6 ",).scale(0.8).next_to(eq3, RIGHT) + rhs3g = MathTex(r"\displaystyle 24\frac{n^4+2n^3+n^2}{n^4} - 12 \frac{2n^3+3n^2+n}{n^3} + 6 ",).scale(0.8).next_to(eq3, RIGHT) + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)), + self.wait(2) + self.play(Write(eq1), Write(rhs1)) + self.wait(2) + self.play(Transform(rhs1, rhs1a)) + self.wait(3) + self.play(Wiggle(title1[1])) + self.play(Transform(rhs1, rhs1b), ) + self.wait(4) + self.play(Transform(rhs1, rhs1c)) + self.wait(4) + self.play(Transform(rhs1, rhs1d)) + self.wait(4) + self.play(Transform(rhs1, rhs1e)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(FadeOut(rhs2), rhs3.animate.next_to(eq2, RIGHT), Write(rhs3a)) + self.wait(5) + self.play(FadeOut(rhs3), rhs3a.animate.next_to(eq2, RIGHT), Write(rhs3b)) + self.wait(5) + self.play(FadeOut(rhs3a), rhs3b.animate.next_to(eq2, RIGHT), Write(rhs3c)) + self.wait(5) + self.play(FadeOut(rhs3b), rhs3c.animate.next_to(eq2, RIGHT), Write(rhs3d)) + self.wait(5) + self.play(FadeOut(rhs3c), rhs3d.animate.next_to(eq2, RIGHT), Write(rhs3e)) + self.wait(5) + self.play(FadeOut(rhs3d), rhs3e.animate.next_to(eq2, RIGHT), Write(rhs3f)) + self.wait(5) + self.play(FadeOut(rhs3e), rhs3f.animate.next_to(eq2, RIGHT), Write(rhs3g)) + self.wait(3) + self.play(FadeOut(rhs3f), rhs3g.animate.next_to(eq2, RIGHT), FadeOut(eq3)) + self.wait(5) + + +class FindArea(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the area bound by } y=6x^3-9x^2+3, y=0 \text{ on }", " [0, 2].", color=TEAL).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{The area is }6.", color=ORANGE).scale(0.8).to_edge(DOWN) + + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\displaystyle \int_0^2 6x^3-9x^2+3 dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \lim_{n\to \infty}R_n",).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\displaystyle \lim_{n\to \infty}\Biggl(24{", r" n^4", r"+2n^3+n^2 \over ", r" n^4 }", r" - 12 ", r"{2n^3 ", r"+3n^2+n \over ", r" n^3 ", r" } + 6 \Biggr)",).scale(0.8).next_to(eq2, RIGHT) + + rhs3 = MathTex(r"24(1)-12(2)+6",).scale(0.8).next_to(eq3, RIGHT) + rhs4 = MathTex(r"6.",).scale(0.8).next_to(eq4, RIGHT) + + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)), + self.wait(3) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Wiggle(rhs2[1]), Wiggle(rhs2[3]), ) + self.play(rhs2[1].animate.set_color(RED), rhs2[3].animate.set_color(RED)) + self.wait(2) + self.play(Wiggle(rhs2[5]), Wiggle(rhs2[7]),) + self.play( rhs2[5].animate.set_color(RED), rhs2[7].animate.set_color(RED)) + self.wait(2) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Write(caption1)) + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN3.py b/source/calculus/manim/CalIN3.py new file mode 100644 index 000000000..81cd382db --- /dev/null +++ b/source/calculus/manim/CalIN3.py @@ -0,0 +1,223 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindAD(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the general antiderivative for } \frac{10}{x}.", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{The anti-derivatives are }\ln(|x|)", r"+C," , r" \text{(sorta)}." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + caption1[1].set_color(BLUE) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*1) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*3) + eq3 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq2, DOWN*3) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*3) + + lhs1 = MathTex(r"f'(x)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{10}{x}",).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"10x^{-1}",).scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"f(x)", color=GREEN).scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"10\ln(|x|)", r"+C", color=GREEN).scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1), Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3[0])) + self.wait(3) + self.play(Write(rhs3[1])) + self.wait(1) + self.play(Write(caption1[0])) + self.play(Write(caption1[1])) + self.wait(2) + self.play(Wiggle(rhs3[0])) + self.wait(2) + self.play(Write(caption1[2])) + self.wait(5) + self.play( + FadeOut(rhs3,lhs3, eq3, rhs2, eq2, rhs1, eq1, lhs1, caption1), + ) + + title2 = MathTex(r"\text{Find the general antiderivative for } 2\sec^2(x).", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{The anti-derivatives are }2\tan(x)", r"+C." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + caption1[1].set_color(BLUE) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*1) + eq2 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq1, DOWN*3) + eq3 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq2, DOWN*3) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*3) + + lhs1 = MathTex(r"g'(x)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"2\sec^2(x)",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"g(x)", color=GREEN).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"2\tan(x)", "+C", color=GREEN).scale(0.8).next_to(eq2, RIGHT) + + rhs2[1].set_color(BLUE) + + + self.play(Transform(title1, title2)) + self.wait(3) + self.play(Write(lhs1), Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(2) + self.play( Write(rhs2[1])) + self.wait(1) + self.play(Write(caption1)) + self.wait(5) + self.play( + FadeOut(lhs2, rhs2, eq2, rhs1, eq1, lhs1, caption1), + ) + + + title3 = MathTex(r"\text{Find the general antiderivative for } 6x^4+10x^3+9x^2.", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{The anti-derivatives are }\frac{6}{5}x^5+\frac{5}{2}x^4+3x^3", r"+C." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + caption1[1].set_color(BLUE) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"h'(x)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"6x^4+10x^3+9x^2",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"h(x)", color=GREEN).scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"6\frac{1}{4+1}x^{4+1}+10\frac{1}{3+1}x^{3+1}+9\frac{1}{3}x^{2+1}", "+C", color=GREEN).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + + rhs3 = MathTex(r"\frac{6}{5}x^{5}+\frac{10}{4}x^{4}+\frac{9}{3}x^{3}", "+C", color=GREEN).scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + + rhs3a = MathTex(r"\frac{6}{5}x^{5}+\frac{5}{2}x^{4}+3x^{3}", "+C", color=GREEN).scale(0.8).next_to(eq3, RIGHT) + rhs3a[1].set_color(BLUE) + + + self.play(Transform(title1, title3)) + self.wait(3) + self.play(Write(lhs1), Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(lhs2)) + self.wait(3) + self.play(Write(eq2), Write(rhs2[0])) + self.wait(2) + self.play(Write(rhs2[1])) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(1) + self.play(Write(caption1)) + self.wait(5) + self.play( + FadeOut(rhs3,lhs2, eq3, rhs2, eq2, rhs1, eq1, lhs1, caption1), + ) + + + title4 = MathTex(r"\text{Find the general antiderivative for } \frac{4}{x^{\frac{1}{7}}} -3e^x+6\sin(2x).", color=BLUE).scale(0.8).to_edge(UP) + caption1 = MathTex(r"\text{The anti-derivatives are }\frac{14}{3}x^{\frac{6}{7}}-3e^x-3\cos(x)", r"+C." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + caption1[1].set_color(BLUE) + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*3) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=", color="GREEN").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"k'(x)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{4}{x^{\frac{1}{7}}} -3e^x+6\sin(2x)",).scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"4x^{-\frac{1}{7}} -3e^x+6\sin(2x)").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex(r"k(x)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"4\frac{1}{-\frac{1}{7}+1}x^{-\frac{1}{7}+1} -3e^x+ ", "(-3)", "\cos(2x)", "+C", color=GREEN).scale(0.8).next_to(eq3, RIGHT) + rhs3[3].set_color(BLUE) + + rhs4 = MathTex(r"\frac{28}{6}x^{\frac{6}{7}}-3e^x-3\cos(2x)", "+C", color=GREEN).scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + + rhs4a = MathTex(r"\frac{14}{3}x^{\frac{6}{7}}-3e^x-3\cos(2x)", "+C", color=GREEN).scale(0.8).next_to(eq4, RIGHT) + rhs4a[1].set_color(BLUE) + + + self.play(Transform(title1, title4)) + self.wait(3) + self.play(Write(lhs1), Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(lhs3)) + self.wait(2) + self.play(Write(eq3), Write(rhs3[0]), Write(rhs3[2])) + self.wait(5) + self.play(Write(rhs3[1])) + self.wait(3) + self.play(Write(rhs3[3])) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(1) + self.play(Write(caption1)) + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN4.py b/source/calculus/manim/CalIN4.py new file mode 100644 index 000000000..da7f2e26a --- /dev/null +++ b/source/calculus/manim/CalIN4.py @@ -0,0 +1,139 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindPosition(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the position function of a particle } s(t), \text{ if: } a(t)=2t-1, v(2)=1, s(0)=-5.", color=BLUE).scale(0.6).to_edge(UP) + caption1 = MathTex(r"s(t)=\frac{1}{3}t^3+\frac{1}{2}t^2-t-5." ,color="ORANGE").scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"v'(t)=", "a(t)").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"2t-1",).scale(0.8).next_to(eq1, RIGHT) + + lhs2 = MathTex(r"s'(t)=", "v(t)").scale(0.8).next_to(eq2, LEFT) + rhs2 = MathTex(r"t^2-t", "+C_1").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2a = MathTex(r"t^2-t-1").scale(0.8).next_to(eq2, RIGHT) + + lhs3 = MathTex("1=", r"v(2)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"2^2-2", "+C_1").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + lhs3a = MathTex(r"C_1").scale(0.8).next_to(eq3, LEFT) + rhs3a = MathTex(r"1-2^2+2").scale(0.8).next_to(eq3, RIGHT) + rhs3b = MathTex(r"-1").scale(0.8).next_to(eq3, RIGHT) + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1[1]), Write(eq1), Write(rhs1)) + self.wait(2) + self.play(Write(lhs1[0])) + self.wait(5) + self.play(Write(lhs2[1])) + self.wait(3) + self.play(Write(eq2), Write(rhs2)) + self.wait(4) + self.play(Write(lhs3[1])) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.play(Write(lhs3[0])) + self.wait(3) + self.play(Transform(lhs3, lhs3a), Transform(rhs3, rhs3a)) + self.wait(2) + self.play(Transform(rhs3, rhs3b)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + self.wait(3) + self.play( + FadeOut(rhs3,lhs3, eq3), Write(lhs2[0]) + ) + + + lhs3 = MathTex("s(t)").scale(0.8).next_to(eq3, LEFT) + rhs3 = MathTex(r"\frac{1}{3}t^3+\frac{1}{2}t^2-t", "+C_2").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + rhs3a = MathTex(r"\frac{1}{3}t^3+\frac{1}{2}t^2-t-5").scale(0.8).next_to(eq3, RIGHT) + + lhs4 = MathTex("-5=", r"s(0)").scale(0.8).next_to(eq4, LEFT) + rhs4 = MathTex(r"\frac{1}{3}(0)^3+\frac{1}{2}(0)^2-(0)", "+C_2").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + lhs4a = MathTex(r"C_2").scale(0.8).next_to(eq4, LEFT) + rhs4a = MathTex(r"0-5").scale(0.8).next_to(eq4, RIGHT) + rhs4b = MathTex(r"-5").scale(0.8).next_to(eq4, RIGHT) + + + self.play(Write(lhs3)) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(4) + self.play(Write(lhs4[1])) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.play(Write(lhs4[0])) + self.wait(3) + self.play(Transform(lhs4, lhs4a), Transform(rhs4, rhs4a)) + self.wait(1) + self.play(Transform(rhs4, rhs4b)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(3) + self.play( + FadeOut(rhs4,lhs4, eq4), Write(caption1) + ) + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN5.py b/source/calculus/manim/CalIN5.py new file mode 100644 index 000000000..06cfe7f96 --- /dev/null +++ b/source/calculus/manim/CalIN5.py @@ -0,0 +1,191 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindInt1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the definite integral } \displaystyle \int_{\frac{2}{3}\pi}^{\frac{5}{6}\pi} 4\cot(x)\csc(x)\,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\displaystyle \int_{\frac{2}{3}\pi}^{\frac{5}{6}\pi} 4\cot(x)\csc(x)\,dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"4\left(-\csc(x)|_{\frac{2}{3}\pi}^{\frac{5}{6}\pi}\right)",).scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"-4\csc\left(\frac{5}{6}\pi\right) - \left( -4\csc\left(\frac{2}{3}\pi\right) \right)").scale(0.8).next_to(eq2, RIGHT) + rhs2a = MathTex(r"4\csc\left(\frac{2}{3}\pi\right) -4\csc\left(\frac{5}{6}\pi\right)").scale(0.8).next_to(eq2, RIGHT) + rhs3 =MathTex(r"{4 \over \sin\left(\frac{2}{3}\pi\right)} - {4 \over \sin\left(\frac{5}{6}\pi\right)}").scale(0.8).next_to(eq3, RIGHT) + + rhs4 = MathTex(r"4{2 \over \sqrt{3}} - 4\frac{2}{1}.").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"{8 \over \sqrt{3}} - 8.").scale(0.8).next_to(eq4, RIGHT) + + + + + self.play(Write(title1)) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Transform(rhs2, rhs2a)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + self.wait(2) + + + title1 = MathTex(r"\text{Find the definite integral } \displaystyle \int_1^5 \frac{e^{2x}}{4}\,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\displaystyle \int_1^5 \frac{e^{2x}}{4}\,dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\frac{1}{4} \Biggl(", r"\frac{1}{2} ", r" e^{2x}|_1^5\Biggr)",).scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"\frac{1}{4} \left( \frac{1}{2}e^5 - \frac{1}{2}e^1 \right) ").scale(0.8).next_to(eq2, RIGHT) + rhs3 =MathTex(r"\frac{e^5}{8} - \frac{e}{8}. ").scale(0.8).next_to(eq3, RIGHT) + + + + + + self.play(Write(title1)) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1[0]), Write(rhs1[2])) + self.wait(3) + self.play(Write(rhs1[1])) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, title1) + ) + self.wait(2) + + + title1 = MathTex(r"\text{Find the definite integral } \displaystyle \int_{-2}^1 6x^3-3x^2+9x\,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\displaystyle \int_{-2}^1 6x^3-3x^2+9x\,dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\Biggl(6\frac{1}{4}x^4-3\frac{1}{3}x^3 + 9\frac{1}{2}x^2 |_{-2}^1\Biggr)",).scale(0.8).next_to(eq1, RIGHT) + rhs1a = MathTex(r"\Biggl(\frac{3}{2}x^4-x^3 + \frac{9}{2}x^2 |_{-2}^1\Biggr)",).scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"\left( \frac{3}{2}2^4-2^3 + \frac{9}{2}2^2 \right) - \left( \frac{3}{2}(-1)^4-(-1)^3 + \frac{9}{2}(-1)^2 \right)").scale(0.8).next_to(eq2, RIGHT) + + rhs3 = MathTex(r"\left( \frac{3}{2}16-8 + \frac{9}{2}4 \right) - \left( \frac{3}{2}(1)-(-1) + \frac{9}{2}(1) \right)").scale(0.8).next_to(eq3, RIGHT) + rhs3a = MathTex(r"\left( 24-8 +18 \right) - \left( \frac{3}{2}+ 1 + \frac{9}{2} \right)").scale(0.8).next_to(eq3, RIGHT) + rhs3b = MathTex(r"\left( 34 \right) - \left( 7 \right)").scale(0.8).next_to(eq3, RIGHT) + + rhs4 = MathTex(r"27.").scale(0.8).next_to(eq4, RIGHT) + + + + + + + self.play(Write(title1)) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(3) + self.play(Transform(rhs3, rhs3b)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(10) + + + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN6.py b/source/calculus/manim/CalIN6.py new file mode 100644 index 000000000..7e7ed5897 --- /dev/null +++ b/source/calculus/manim/CalIN6.py @@ -0,0 +1,416 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindDerivative1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative } \frac{d}{dx} \left[ \displaystyle \int_{5}^{e^{x+6}} 7 {\left(9 \cos\left(t\right) + 5\right)}^{4}\,dt \right].", color=TEAL).scale(0.6).to_edge(UP) + caption1 = MathTex(r"\text{Let } F(t) \text{ be an anti-derivative of } 7 {\left(9 \cos\left(t\right) + 5\right)}^{4}.", color=ORANGE).scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*0.5) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\frac{d}{dx} \Biggl[ \displaystyle \int ", r" ^{e^x+6} ", r" _{5}", r" 7 {\left(9 \cos\left(t\right) + 5\right)}^{4}\,dt \Biggr]").scale(0.8).next_to(eq1, LEFT) + lhs1[1].set_color(BLUE) + lhs1[2].set_color(RED) + + rhs1 = MathTex(r"\frac{d}{dx} [ F( ", r" e^x+6 ", r" ) - F( ", r" 5 ", r" ) ]",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(BLUE) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\frac{d}{dx} [ F( ", r" e^x+6 ", r")] - ", r" \frac{d}{dx} [ F( ", r" 5 ", r" ) ]",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2[4].set_color(RED) + + + rhs3 =MathTex(r" F'(", r" e^x+6 ", r" ) \frac{d}{dx}[ ", r" e^x+6 ", r" ] +0 ").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + rhs3[3].set_color(BLUE) + + rhs4 = MathTex(r" 7\bigl( 9\cos( ", r"e^x+6 ", r" ) \bigr)^4 ", r"e^x .").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(caption1)) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Wiggle(rhs2[3]), Wiggle(rhs2[4]), Wiggle(rhs2[5])) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Wiggle(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + + +class FindDerivative2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative } \frac{d}{dx} \left[ \displaystyle \int_{\frac{1}{x^3+2}}^{9} 8e^{-t^2}\,dt \right].", color=TEAL).scale(0.6).to_edge(UP) + caption1 = MathTex(r"\text{Let } F(t) \text{ be an anti-derivative of } 8e^{t^2}.", color=ORANGE).scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*0.5) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\frac{d}{dx} \Biggl[ \displaystyle \int ", r" ^{9} ", r" _{\frac{1}{x^3+2}}", r" 8e^{-t^2}\,dt \Biggr]").scale(0.8).next_to(eq1, LEFT) + lhs1[1].set_color(BLUE) + lhs1[2].set_color(RED) + + rhs1 = MathTex(r"\frac{d}{dx} \biggl[ F( ", r" 9 ", r" ) - F\biggl( ", r" \frac{1}{x^3+2} ", r" \biggr) \biggr]",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(BLUE) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\frac{d}{dx} [ F( ", r" 9 ", r")] ", r" -\frac{d}{dx} \biggl[ F\biggl( ", r" \frac{1}{x^3+2} ", r" \biggr) \biggr]",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2[4].set_color(RED) + + + rhs3 =MathTex(r" 0 - F'\biggl(", r" \frac{1}{x^3+2} ", r" \biggr) \frac{d}{dx} \biggl[ ", r" \frac{1}{x^3+2} ", r" \biggr] ").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + rhs3[3].set_color(RED) + + rhs4 = MathTex(r" -8e^{-\bigl(", r" \frac{1}{x^3+2} ", r" \bigr)^2} ", r"\frac{-3x^2}{(x^3+2)^2} .").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + + rhs4a = MathTex(r" 8e^{", r" -\frac{1}{x^6+4x^3+4} ", r" } ", r"\frac{3x^2}{x^6+4x^3+4} .").scale(0.8).next_to(eq4, RIGHT) + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(caption1)) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Wiggle(rhs2[0]), Wiggle(rhs2[1]), Wiggle(rhs2[2])) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Wiggle(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + +class FindDerivative3(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative } \frac{d}{dx} \left[ \displaystyle \int_{x}^{x^2} \frac{\sin(t)}{t^6+1}\,dt \right].", color=TEAL).scale(0.6).to_edge(UP) + caption1 = MathTex(r"\text{Let } F(t) \text{ be an anti-derivative of } \frac{\sin(t)}{t^6+1}.", color=ORANGE).scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*0.5) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\frac{d}{dx} \Biggl[ \displaystyle \int ", r" ^{x^2} ", r" _{x}", r" \frac{\sin(t)}{t^6+1}\,dt \Biggr]").scale(0.8).next_to(eq1, LEFT) + lhs1[1].set_color(BLUE) + lhs1[2].set_color(RED) + + rhs1 = MathTex(r"\frac{d}{dx} [ F( ", r" x^2 ", r" ) - F( ", r" x ", r" ) ]",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(BLUE) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\frac{d}{dx} [ F( ", r" x^2 ", r")] - ", r" \frac{d}{dx} [ F( ", r" x ", r" ) ]",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2[4].set_color(RED) + + + rhs3 =MathTex(r" F'(", r" x^2 ", r" ) \frac{d}{dx}[ ", r" x^2 ", r" ] + F'(", r"x", r")\frac{d}{dx}[", r"x", r"]" ).scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + rhs3[3].set_color(BLUE) + rhs3[5].set_color(RED) + rhs3[7].set_color(RED) + + rhs4 = MathTex( r"{ \sin(", r"x^2", r") \over (", r"x^2", r")^6+1}", r"(2x)", r"-", r"{ \sin(", r"x", r") \over (", r"x", r")^6+1}", r"1" ).scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + rhs4[5].set_color(BLUE) + + rhs4[8].set_color(RED) + rhs4[10].set_color(RED) + rhs4[12].set_color(RED) + + + rhs4a = MathTex( r"\frac{2x\sin(x^2)}{x^{12}+1} - \frac{\sin(x)}{x^6+1}" ).scale(0.8).next_to(eq4, RIGHT) + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(caption1)) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Wiggle(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + + + +class FindDerivative4(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the derivative } \frac{d}{dx} \left[ \displaystyle \int_{-1}^{\sqrt{x}} \ln(t^4+4)\,dt \right].", color=TEAL).scale(0.6).to_edge(UP) + caption1 = MathTex(r"\text{Let } F(t) \text{ be an anti-derivative of } \ln(t^4+4).", color=ORANGE).scale(0.8).to_edge(DOWN) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*0.5) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\frac{d}{dx} \Biggl[ \displaystyle \int ", r" ^{\sqrt{x}} ", r" _{-1}", r" \ln(t^4+4)\,dt \Biggr]").scale(0.8).next_to(eq1, LEFT) + lhs1[1].set_color(BLUE) + lhs1[2].set_color(RED) + + rhs1 = MathTex(r"\frac{d}{dx} [ F( ", r" \sqrt{x} ", r" ) - F( ", r" -1 ", r" ) ]",).scale(0.8).next_to(eq1, RIGHT) + rhs1[1].set_color(BLUE) + rhs1[3].set_color(RED) + + rhs2 = MathTex(r"\frac{d}{dx} [ F( ", r" \sqrt{x} ", r")] - ", r" \frac{d}{dx} [ F( ", r" -1 ", r" ) ]",).scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(BLUE) + rhs2[4].set_color(RED) + + + rhs3 =MathTex(r" F'(", r" \sqrt{x} ", r" ) \frac{d}{dx}[ ", r" \sqrt{x} ", r" ] +0 ").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(BLUE) + rhs3[3].set_color(BLUE) + + rhs4 = MathTex(r" \ln\bigl( \bigl( ", r"\sqrt{x} ", r" \bigr)^4 + 4 \bigr) ", r"\frac{1}{2}x^{-1/2}").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(BLUE) + rhs4[3].set_color(BLUE) + + rhs4a = MathTex(r" \frac{\ln\bigl( x^2 + 4 \bigr)}{2\sqrt{x}} ").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(caption1)) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Wiggle(rhs2[3]), Wiggle(rhs2[4]), Wiggle(rhs2[5])) + self.wait(3) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Wiggle(caption1)) + self.wait(3) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + + +class Graph(Scene): + def construct(self): + + title1 = MathTex(r" y=\ln(t^4+4) \text{axis on }[-1,\sqrt{x}].", color=TEAL).scale(0.6).to_edge(UP) + + caption1 = MathTex(r" x=", color=ORANGE).scale(0.8).to_edge(DOWN) + + + + axes = Axes(x_range=[-2,4,2], y_range=[-1, 6, 2], x_length=5, y_length=5,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + axes_labels2 = axes.get_axis_labels(MathTex("u").scale(0.5), MathTex("y").scale(0.5)) + axes_labels3 = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + + numberplane = NumberPlane(x_range=[-2,4,2], y_range=[-1, 6, 2], x_length=5, y_length=5, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( np.log(x**4+4) ), + x_range=[-2, 4], + use_smoothing=True, + color=BLUE) + + + area1 = axes.get_area(graph=plot1, x_range=[-1,0], color=RED) + + + tracker=ValueTracker(0.01) + + + + + + + def update(mob): + mob.become( + axes.get_area(graph=plot1, x_range=[-1, tracker.get_value()**(1/2)], color=RED) + + ) + + + area1.add_updater(update) + + + number=DecimalNumber( + 0, + show_ellipsis=False, + num_decimal_places=4, + include_sign=False, + color=ORANGE, + ).scale(0.8).next_to(caption1, RIGHT) + def updateNum(mob): + mob.become(DecimalNumber( + tracker.get_value(), + show_ellipsis=False, + num_decimal_places=4, + include_sign=False, + color=ORANGE, + )).scale(0.8).next_to(caption1, RIGHT) + number.add_updater(updateNum) + + + + + + + + + self.add(title1, caption1, number) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), ) + self.wait(3) + self.play(Create(area1), ) + self.wait(5) + + self.play(tracker.animate.set_value(15), run_time=5) + self.wait(3) + + self.play(tracker.animate.set_value(0), run_time=5) + self.wait(3) + + self.play(tracker.animate.set_value(15), run_time=5) + self.wait(3) + + self.play(tracker.animate.set_value(0), run_time=5) + self.wait(3) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/calculus/manim/CalIN7.py b/source/calculus/manim/CalIN7.py new file mode 100644 index 000000000..cef4b4c95 --- /dev/null +++ b/source/calculus/manim/CalIN7.py @@ -0,0 +1,270 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + +class Graph(Scene): + def construct(self): + + title1 = MathTex(r"\text{Find the } \textbf{total} \text{ area between }y=-x^2+4x+12\text{ and the }x-\text{axis on }[-1,8].", color=TEAL).scale(0.6).to_edge(UP) + + + + axes = Axes(x_range=[-2,9,2], y_range=[-25, 20, 10], x_length=5, y_length=5,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + axes_labels2 = axes.get_axis_labels(MathTex("u").scale(0.5), MathTex("y").scale(0.5)) + axes_labels3 = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + + numberplane = NumberPlane(x_range=[-2,9,2], y_range=[-25, 20, 10], x_length=5, y_length=5, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( -1*x**2+4*x+12 ), + x_range=[-1, 6], + use_smoothing=True, + color=BLUE) + + plot2 = axes.plot(lambda x:( -1*x**2+4*x+12 ), + x_range=[6, 8], + use_smoothing=True, + color=RED) + + area1 = axes.get_area(graph=plot1, x_range=[-1,6], color=BLUE) + + area2 = axes.get_area(graph=plot2, x_range=[6,8], color=RED) + + + + + + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), ) + self.play(Create(plot2), ) + self.wait(3) + self.play(Create(area1), Create(area2)) + self.wait(5) + + + + self.wait(10) + + + + + +class FindArea(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the } \textbf{total} \text{ area between }y=-x^2+4x+12\text{ and the }x-\text{axis.}", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\text{Area}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\text{Area over }x-\text{axis}", r"+", r"\text{Area under }x-\text{axis}").scale(0.8).next_to(eq1, RIGHT) + rhs1[0].set_color(BLUE) + rhs1[2].set_color(RED) + rhs1a = MathTex(r"\displaystyle \int_{-1}^{6} \left|-x^2+4x+12\right|\, dx", r"+", r"\displaystyle \int_{6}^{8} \left| -x^2+4x+12 \right|\, dx").scale(0.8).next_to(eq1, RIGHT) + rhs1a[0].set_color(BLUE) + rhs1a[2].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \int_{-1}^{6} -x^2+4x+12\, dx", r"+", r"\displaystyle \int_{6}^{8} x^2-4x-12\, dx").scale(0.8).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"(-\frac{1}{3}x^3+\frac{4}{2}x^2+12x|_{x=-1}^{x=6})", r"+", r"(\frac{1}{3}x^3-\frac{4}{2}x^2-12x|_{x=6}^{x=8})").scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[2].set_color(RED) + + rhs3a = MathTex(r"(-\frac{1}{3}x^3+2x^2+12x|_{x=-1}^{x=6})", r"+", r"(\frac{1}{3}x^3-2x^2-12x|_{x=6}^{x=8})").scale(0.8).next_to(eq3, RIGHT) + rhs3a[0].set_color(BLUE) + rhs3a[2].set_color(RED) + + + + + rhs4 = MathTex(r"\left( 72 - \left(-\frac{29}{3} \right)\right)", r"+", r"\left(-\frac{160}{3} -(-72) \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(BLUE) + rhs4[2].set_color(RED) + + rhs4a = MathTex(r"\left( \frac{245}{3}\right) ", r"+", r"\left( \frac{56}{3} \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4a[0].set_color(BLUE) + rhs4a[2].set_color(RED) + + rhs4b = MathTex(r" \frac{301}{3}").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + self.play(Transform(rhs4, rhs4b)) + self.wait(5) + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + self.wait(2) + + + +class FindArea(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the } \textbf{total} \text{ area between }y=-x^2+4x+12\text{ and the }x-\text{axis.}", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\text{Area}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\text{Area over }x-\text{axis}", r"+", r"\text{Area under }x-\text{axis}").scale(0.8).next_to(eq1, RIGHT) + rhs1[0].set_color(BLUE) + rhs1[2].set_color(RED) + rhs1a = MathTex(r"\displaystyle \int_{-1}^{6} \left|-x^2+4x+12\right|\, dx", r"+", r"\displaystyle \int_{6}^{8} \left| -x^2+4x+12 \right|\, dx").scale(0.8).next_to(eq1, RIGHT) + rhs1a[0].set_color(BLUE) + rhs1a[2].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \int_{-1}^{6} -x^2+4x+12\, dx", r"+", r"\displaystyle \int_{6}^{8} x^2-4x-12\, dx").scale(0.8).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"\left(-\frac{1}{3}x^3+\frac{4}{2}x^2+12x|_{x=-1}^{x=6}\right)", r"+", r"\left(\frac{1}{3}x^3-\frac{4}{2}x^2-12x|_{x=6}^{x=8}\right)").scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[2].set_color(RED) + + rhs3a = MathTex(r"\left(-\frac{1}{3}x^3+2x^2+12x|_{x=-1}^{x=6}\right)", r"+", r"\left(\frac{1}{3}x^3-2x^2-12x|_{x=6}^{x=8}\right)").scale(0.8).next_to(eq3, RIGHT) + rhs3a[0].set_color(BLUE) + rhs3a[2].set_color(RED) + + + + + rhs4 = MathTex(r"\left( 72 - \left(-\frac{29}{3} \right)\right)", r"+", r"\left(-\frac{160}{3} -(-72) \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(BLUE) + rhs4[2].set_color(RED) + + rhs4a = MathTex(r"\left( \frac{245}{3}\right) ", r"+", r"\left( \frac{56}{3} \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4a[0].set_color(BLUE) + rhs4a[2].set_color(RED) + + rhs4b = MathTex(r" \frac{301}{3}").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(5) + self.play(Transform(rhs4, rhs4a)) + self.wait(5) + self.play(Transform(rhs4, rhs4b)) + self.wait(10) + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + +class FindInt(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the } \textbf{net} \text{ area between }y=-x^2+4x+12\text{ and the }x-\text{axis.}", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\text{Signed Area}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \int_{-1}^{8} -x^2+4x+12\, dx",).scale(0.8).next_to(eq1, RIGHT) + + + rhs2 = MathTex(r"\left(-\frac{1}{3}x^3+\frac{4}{2}x^2+12x|_{x=-1}^{x=8}\right)",).scale(0.8).next_to(eq2, RIGHT) + + rhs2a = MathTex(r"\left(-\frac{1}{3}x^3+2x^2+12x|_{x=-1}^{x=8}\right)", ).scale(0.8).next_to(eq2, RIGHT) + + + + + rhs3 = MathTex(r"\frac{160}{3} - \left(-\frac{29}{3} \right)", ).scale(0.8).next_to(eq3, RIGHT) + + + rhs4 = MathTex(r"63.").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(5) + + self.play(Write(eq2), Write(rhs2)) + self.wait(3) + self.play(Transform(rhs2, rhs2a)) + + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Write(rhs4), Write(eq4)) + self.wait(10) + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, eq4, rhs4, title1) + ) + \ No newline at end of file diff --git a/source/calculus/manim/CalIN8.py b/source/calculus/manim/CalIN8.py new file mode 100644 index 000000000..8fc5f7ce2 --- /dev/null +++ b/source/calculus/manim/CalIN8.py @@ -0,0 +1,351 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + +class Graph(Scene): + def construct(self): + + title1 = MathTex(r"\text{Find the } \text{area bound by }y=-x^2+5, y=-x-1, y=-4x+5, y=2x-1.", color=TEAL).scale(0.6).to_edge(UP) + + + + axes = Axes(x_range=[-4,4,2], y_range=[-2, 6, 2], x_length=5, y_length=5,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + + numberplane = NumberPlane(x_range=[-4,4,2], y_range=[-2, 6, 2], x_length=5, y_length=5, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( -1*x**2+5 ), + x_range=[-2.64,2.64], + use_smoothing=True, + color=YELLOW) + + plot2 = axes.plot(lambda x:( -1*x-1 ), + x_range=[-4, 1], + use_smoothing=True, + color=YELLOW) + + plot3 = axes.plot(lambda x:( -4*x+5 ), + x_range=[-0.25, 1.75], + use_smoothing=True, + color=YELLOW) + + plot4 = axes.plot(lambda x:( 2*x-1 ), + x_range=[-0.5, 3.5], + use_smoothing=True, + color=YELLOW) + + plot1a = axes.plot(lambda x:( -1*x**2+5 ), + x_range=[-2,0], + use_smoothing=True, + color=YELLOW) + + plot2a = axes.plot(lambda x:( -1*x-1 ), + x_range=[-2,0], + use_smoothing=True, + color=YELLOW) + + plot3a = axes.plot(lambda x:( -4*x+5 ), + x_range=[-0,1], + use_smoothing=True, + color=YELLOW) + + plot4a = axes.plot(lambda x:( 2*x-1 ), + x_range=[0,1], + use_smoothing=True, + color=YELLOW) + + area1 = axes.get_area(graph=plot1, x_range=[-2,0], color=YELLOW, bounded_graph=plot2) + area2 = axes.get_area(graph=plot3, x_range=[0,1], color=YELLOW, bounded_graph=plot4) + + label1 = MathTex("y=-x^2+5").scale(0.5).next_to(axes.c2p(-1.25,3), (LEFT+UP)/2).set_color(YELLOW) + label2 = MathTex("y=-x-1").scale(0.5).next_to(axes.c2p(-1,-0.25), (LEFT+DOWN)/2).set_color(YELLOW) + label3 = MathTex("y=-4x+5").scale(0.5).next_to(axes.c2p(0.5,3.5), (RIGHT+UP)/2).set_color(YELLOW) + label4 = MathTex("y=2x-1").scale(0.5).next_to(axes.c2p(0.25,0), (RIGHT+DOWN)/2).set_color(YELLOW) + + + P1=Dot(axes.coords_to_point(-2, 1), color=WHITE) + labelP1 = MathTex(r"(-2,1)", color=WHITE).scale(0.5).next_to(P1, LEFT) + P2=Dot(axes.coords_to_point(0, 5), color=WHITE) + labelP2 = MathTex(r"(0,5)", color=WHITE).scale(0.5).next_to(P2, RIGHT) + P3=Dot(axes.coords_to_point(0, -1), color=WHITE) + labelP3 = MathTex(r"(0,-1)", color=WHITE).scale(0.5).next_to(P3, DOWN) + P4=Dot(axes.coords_to_point(1, 1), color=WHITE) + labelP4 = MathTex(r"(1,1)", color=WHITE).scale(0.5).next_to(P4, RIGHT) + + + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), Create(plot2),Create(plot3),Create(plot4),) + self.wait(3) + self.play(Create(area1), Create(area2),) + self.play(Transform(plot1, plot1a), Transform(plot2, plot2a), Transform(plot3, plot3a), Transform(plot4, plot4a), ) + self.wait(2) + self.play(Write(label1), Write(label2), Write(label3), Write(label4), ) + self.play(Create(P1), Write(labelP1), Create(P2), Write(labelP2), Create(P3), Write(labelP3), Create(P4), Write(labelP4), ) + self.wait(5) + self.play(plot1.animate.set_color(BLUE), area1.animate.set_color(BLUE), label1.animate.set_color(BLUE), + plot2.animate.set_color(BLUE), label2.animate.set_color(BLUE),) + + self.play(plot3.animate.set_color(RED), area2.animate.set_color(RED), label3.animate.set_color(RED), + plot4.animate.set_color(RED), label4.animate.set_color(RED),) + + self.wait(10) + + + + + +class FindArea1(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the } \text{area bound by }y=-x^2+5, y=-x-1, y=-4x+5, y=2x-1.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\text{Area}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\text{Area before }x=0", r"+", r"\text{Area after }x=0").scale(0.8).next_to(eq1, RIGHT) + rhs1[0].set_color(BLUE) + rhs1[2].set_color(RED) + rhs1a = MathTex(r"\displaystyle \int_{-2}^{0} \left(\left(-x^2+5\right) - \left(-x-1\right) \right)\, dx", r"+", r"\displaystyle \int_{0}^{1} \left(\left(-4x+5\right) - \left(2x-1\right) \right) dx").scale(0.6).next_to(eq1, RIGHT) + rhs1a[0].set_color(BLUE) + rhs1a[2].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \int_{-2}^{0} -x^2+x+6\, dx", r"+", r"\displaystyle \int_{0}^{1} -6x+6 dx").scale(0.8).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"\left(-\frac{1}{3}x^3+\frac{1}{2}x^2+6x|_{x=-2}^{x=0}\right)", r"+", r"\left(-\frac{6}{2}x^2+6x|_{x=0}^{x=1}\right)").scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[2].set_color(RED) + + rhs3a = MathTex(r"\left(-\frac{1}{3}x^3+\frac{1}{2}x^2+6x|_{x=-2}^{x=0}\right)", r"+", r"\left(-3x^2+6x|_{x=0}^{x=1}\right)").scale(0.8).next_to(eq3, RIGHT) + rhs3a[0].set_color(BLUE) + rhs3a[2].set_color(RED) + + + + + rhs4 = MathTex(r"\left(0 - \left(-\frac{22}{3} \right)\right)", r"+", r"\left(3-0 \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(BLUE) + rhs4[2].set_color(RED) + + + + rhs4a = MathTex(r" \frac{31}{3}").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + +class Graph2(Scene): + def construct(self): + + title1 = MathTex(r"\text{Find the } \text{area bound by }y=-x^2+5, y=-x-1, y=-4x+5, y=2x-1.", color=TEAL).scale(0.6).to_edge(UP) + + + + axes = Axes(x_range=[-4,4,2], y_range=[-2, 6, 2], x_length=5, y_length=5,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + + numberplane = NumberPlane(x_range=[-4,4,2], y_range=[-2, 6, 2], x_length=5, y_length=5, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + + + plot1 = axes.plot(lambda x:( -1*x**2+5 ), + x_range=[-2,0], + use_smoothing=True, + color=YELLOW) + + plot2 = axes.plot(lambda x:( -1*x-1 ), + x_range=[-2,0], + use_smoothing=True, + color=YELLOW) + + plot3 = axes.plot(lambda x:( -4*x+5 ), + x_range=[-0,1], + use_smoothing=True, + color=YELLOW) + + plot4 = axes.plot(lambda x:( 2*x-1 ), + x_range=[0,1], + use_smoothing=True, + color=YELLOW) + + dummy = axes.plot(lambda x:( 1 ), + x_range=[-2,1], + use_smoothing=True, + color=YELLOW) + + area1 = axes.get_area(graph=plot1, x_range=[-2,0], color=YELLOW, bounded_graph=dummy) + area2 = axes.get_area(graph=plot2, x_range=[-2,0], color=YELLOW, bounded_graph=dummy) + area3 = axes.get_area(graph=plot3, x_range=[0,1], color=YELLOW, bounded_graph=dummy) + area4 = axes.get_area(graph=plot4, x_range=[0,1], color=YELLOW, bounded_graph=dummy) + + label1 = MathTex("y=-x^2+5").scale(0.5).next_to(axes.c2p(-1.25,3), (LEFT+UP)/2).set_color(YELLOW) + label2 = MathTex("y=-x-1").scale(0.5).next_to(axes.c2p(-1,-0.25), (LEFT+DOWN)/2).set_color(YELLOW) + label3 = MathTex("y=-4x+5").scale(0.5).next_to(axes.c2p(0.5,3.5), (RIGHT+UP)/2).set_color(YELLOW) + label4 = MathTex("y=2x-1").scale(0.5).next_to(axes.c2p(0.25,0), (RIGHT+DOWN)/2).set_color(YELLOW) + + label1a = MathTex(r"x=-\sqrt{5-y}").scale(0.5).next_to(axes.c2p(-1.25,3), (LEFT+UP)/2).set_color(YELLOW) + label2a = MathTex(r"x=-y-1").scale(0.5).next_to(axes.c2p(-1,-0.25), (LEFT+DOWN)/2).set_color(YELLOW) + label3a = MathTex(r"x=\frac{5-y}{4}").scale(0.5).next_to(axes.c2p(0.5,3), (RIGHT+UP)/2).set_color(YELLOW) + label4a = MathTex(r"x=\frac{y+1}{2}").scale(0.5).next_to(axes.c2p(0.25,0), (RIGHT+DOWN)/2).set_color(YELLOW) + + + P1=Dot(axes.coords_to_point(-2, 1), color=WHITE) + labelP1 = MathTex(r"(-2,1)", color=WHITE).scale(0.5).next_to(P1, LEFT) + P2=Dot(axes.coords_to_point(0, 5), color=WHITE) + labelP2 = MathTex(r"(0,5)", color=WHITE).scale(0.5).next_to(P2, RIGHT) + P3=Dot(axes.coords_to_point(0, -1), color=WHITE) + labelP3 = MathTex(r"(0,-1)", color=WHITE).scale(0.5).next_to(P3, DOWN) + P4=Dot(axes.coords_to_point(1, 1), color=WHITE) + labelP4 = MathTex(r"(1,1)", color=WHITE).scale(0.5).next_to(P4, RIGHT) + + + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), Create(plot2),Create(plot3),Create(plot4),) + self.play(Create(area1), Create(area2), Create(area3), Create(area4)) + + self.play(Write(label1), Write(label2), Write(label3), Write(label4), ) + self.play(Create(P1), Write(labelP1), Create(P2), Write(labelP2), Create(P3), Write(labelP3), Create(P4), Write(labelP4), ) + self.wait(5) + self.play(Transform(label1, label1a), Transform(label2, label2a), Transform(label3, label3a), Transform(label4, label4a), ) + self.wait(3) + self.play(plot1.animate.set_color(BLUE), area1.animate.set_color(BLUE), label1.animate.set_color(BLUE), + plot3.animate.set_color(BLUE), area3.animate.set_color(BLUE), label3.animate.set_color(BLUE),) + + self.play(plot2.animate.set_color(RED), area2.animate.set_color(RED), label2.animate.set_color(RED), + plot2.animate.set_color(RED), area4.animate.set_color(RED), label4.animate.set_color(RED),) + + self.wait(10) + + + + + + +class FindArea2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the } \text{area bound by }y=-x^2+5, y=-x-1, y=-4x+5, y=2x-1.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*4) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + lhs1 = MathTex(r"\text{Area}").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\text{Area before }y=1", r"+", r"\text{Area after }y=1").scale(0.8).next_to(eq1, RIGHT) + rhs1[0].set_color(BLUE) + rhs1[2].set_color(RED) + rhs1a = MathTex(r"\displaystyle \int_{-1}^{1} \left(\left(\frac{1}{2}y+\frac{1}{2}\right) - \left(-y-1\right) \right)\, dy", r"+", r"\displaystyle \int_{1}^{5} \left(\left(\frac{5}{4}-\frac{1}{4}y\right) - \left(-\sqrt{5-y}\right) \right)\, dy").scale(0.6).next_to(eq1, RIGHT) + rhs1a[0].set_color(BLUE) + rhs1a[2].set_color(RED) + + rhs2 = MathTex(r"\displaystyle \int_{-1}^{1} \frac{3}{2}y+\frac{3}{2} \, dy", r"+", r"\displaystyle \int_{1}^{5} \frac{5}{4}-\frac{1}{4}y+\sqrt{5-y}\, dy").scale(0.8).next_to(eq2, RIGHT) + rhs2[0].set_color(BLUE) + rhs2[2].set_color(RED) + + rhs3 = MathTex(r"\left(-\frac{3}{4}y^2-\frac{3}{2}y|_{y=-1}^{y=1}\right)", r"+", r"\left(\frac{5}{4}y-\frac{1}{8}y^2-\frac{2}{3}(5-y)^{3/2}|_{x=0}^{x=1}\right)").scale(0.8).next_to(eq3, RIGHT) + rhs3[0].set_color(BLUE) + rhs3[2].set_color(RED) + + + + + + rhs4 = MathTex(r"\left(\frac{3}{4} - \left(-\frac{9}{4} \right)\right)", r"+", r"\left(\frac{25}{8}-\left( -\frac{101}{24}\right) \right)").scale(0.8).next_to(eq4, RIGHT) + rhs4[0].set_color(BLUE) + rhs4[2].set_color(RED) + + + + rhs4a = MathTex(r" \frac{31}{3}").scale(0.8).next_to(eq4, RIGHT) + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1),) + self.wait(5) + self.play(Write(eq1), Write(rhs1)) + self.wait(3) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(eq2), Write(rhs2)) + self.wait(5) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + self.wait(10) + + self.play( + FadeOut(rhs1,lhs1, eq1, eq2, rhs2, eq3, rhs3, eq4, rhs4, title1) + ) + + + \ No newline at end of file diff --git a/source/calculus/manim/CalTI1.py b/source/calculus/manim/CalTI1.py new file mode 100644 index 000000000..3b94c08a8 --- /dev/null +++ b/source/calculus/manim/CalTI1.py @@ -0,0 +1,409 @@ +#%%manim -ql LIPoly + +from manim import * + + + + + + + + + + +class FindIndef(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the indefinite integral } \displaystyle \int \frac{\sqrt{\ln(x)+3}}{x} \,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + equ1 = MathTex(r"=", color=RED).scale(0.6).shift(RIGHT*4+UP*1) + equ2 = MathTex(r"=", color=BLUE).scale(0.6).next_to(equ1, DOWN*2) + + lhs1 = MathTex(r"\displaystyle \int \frac{\sqrt{\ln(x)+3}}{x} \,dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \int ", r" { (", r"\ln(x) + 3", r")^{1/2} ", r" \over" ,r" x }", r"\,dx").scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\displaystyle \int ", r" { (", r"u", r")^{1/2} ", r" \over" ,r" x }", r"\,dx").scale(0.8).next_to(eq2, RIGHT) + rhs2[5].set_color(BLUE) + rhs2[6].set_color(BLUE) + + rhs2a = MathTex(r"\displaystyle \int ", r"u", r"^{1/2} " , r" \,du").scale(0.8).next_to(eq2, RIGHT) + rhs2a[1].set_color(RED) + rhs2a[3].set_color(BLUE) + + lhsu1 = MathTex(r"u", color=RED).scale(0.6).next_to(equ1, LEFT) + rhsu1 = MathTex(r"\ln(x)+3", color=RED).scale(0.6).next_to(equ1, RIGHT) + + lhsu2 = MathTex(r"du", color=BLUE).scale(0.6).next_to(equ2, LEFT) + rhsu2 = MathTex(r"\frac{1}{x}dx", color=BLUE).scale(0.6).next_to(equ2, RIGHT) + + rhs3 = MathTex(r"\frac{1}{\frac{3}{2}}", r"u", r"^{3/2}+C").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + rhs3a = MathTex(r"\frac{2}{3}", r"u", r"^{3/2}+C").scale(0.8).next_to(eq3, RIGHT) + rhs3a[1].set_color(RED) + + rhs4 = MathTex(r"\frac{2}{3}", r"(\ln(x)+3)", r"^{3/2}+C.").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(RED) + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(rhs1), Write(eq1)) + self.wait(5) + self.play(Wiggle(rhs1[2])) + self.wait(2) + self.play(Write(lhsu1)) + self.wait(2) + self.play(Write(equ1), Write(rhsu1)) + self.wait(3) + self.play(Write(lhsu2)) + self.wait(2) + self.play(Write(equ2), Write(rhsu2)) + self.wait(5) + self.play(Wiggle(rhs1[2])) + self.play(rhs1[2].animate.set_color(RED)) + self.wait(3) + self.play(Wiggle(rhs1[5]), Wiggle(rhs1[6])) + self.play(rhs1[5].animate.set_color(BLUE), rhs1[6].animate.set_color(BLUE)) + self.wait(2) + self.play(Write(rhs2), Write(eq2)) + self.wait(3) + self.play(Wiggle(lhsu2), Wiggle(rhsu2)) + self.play(Transform(rhs2, rhs2a)) + self.wait(5) + self.play(Write(rhs3), Write(eq3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(2) + self.play(Wiggle(lhsu1), Wiggle(rhsu1)) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(rhs4[1].animate.set_color(WHITE)) + + + + + self.wait(10) + + +class FindDef(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the definite integral } \displaystyle \int_0^2 xe^{x^2-1} \,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + equ1 = MathTex(r"=", color=RED).scale(0.6).shift(RIGHT*4+UP*1) + equ2 = MathTex(r"=", color=BLUE).scale(0.6).next_to(equ1, DOWN*2) + + lhs1 = MathTex(r"\displaystyle \int_{x=0}^{x=2} ", r" x ", r" e ", r" ^{x^2-1} ", r" \,dx").scale(0.8).next_to(eq1, LEFT) + + rhs1 = MathTex(r"\displaystyle \int_{x=0}^{x=2} ", r"e", r"^{u}", r"x\,dx").scale(0.8).next_to(eq1, RIGHT) + rhs1[2].set_color(RED) + rhs1[3].set_color(BLUE) + + rhs1a = MathTex(r"\displaystyle \int_{x=0}^{x=2} ", r"e", r"^{u} " , r"\frac{1}{2} \,du").scale(0.8).next_to(eq1, RIGHT) + rhs1a[2].set_color(RED) + rhs1a[3].set_color(BLUE) + + lhsu1 = MathTex(r"u", color=RED).scale(0.6).next_to(equ1, LEFT) + rhsu1 = MathTex(r"x^2-1", color=RED).scale(0.6).next_to(equ1, RIGHT) + + lhsu2 = MathTex(r"du", color=BLUE).scale(0.6).next_to(equ2, LEFT) + rhsu2 = MathTex(r"2xdx", color=BLUE).scale(0.6).next_to(equ2, RIGHT) + + lhsu2a = MathTex(r"\frac{1}{2}du", color=BLUE).scale(0.6).next_to(equ2, LEFT) + rhsu2a = MathTex(r"xdx", color=BLUE).scale(0.6).next_to(equ2, RIGHT) + + rhs2 = MathTex(r"\frac{1}{2}e", r"^u", r" |", r"_{x=0}", r"^{x=2}").scale(0.8).next_to(eq2, RIGHT) + rhs2[1].set_color(RED) + + rhs2a = MathTex(r"\frac{1}{2}e", r"^u", r"|", r"_{u=-1}", r"^{u=3}").scale(0.8).next_to(eq2, RIGHT) + rhs2a[1].set_color(RED) + + + rhs3 = MathTex(r"\frac{1}{2} e", r"^{x^2-1}", r" |", r"_{x=0}", r"^{x=2}").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + + rhs4 = MathTex(r"\frac{e^3}{2}-\frac{e^{-1}}{2} ").scale(0.8).next_to(eq4, RIGHT) + rhs4a = MathTex(r"\frac{e^3}{2}-\frac{1}{2e} ").scale(0.8).next_to(eq4, RIGHT) + + + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Wiggle(lhs1[3])) + self.wait(2) + self.play(Write(lhsu1)) + self.wait(2) + self.play(Write(equ1), Write(rhsu1)) + self.wait(3) + self.play(Write(lhsu2)) + self.wait(2) + self.play(Write(equ2), Write(rhsu2)) + self.wait(5) + self.play(Wiggle(lhs1[3])) + self.play(lhs1[3].animate.set_color(RED)) + self.wait(3) + self.play(Wiggle(lhs1[1]), Wiggle(lhs1[4])) + self.play(lhs1[1].animate.set_color(BLUE), lhs1[4].animate.set_color(BLUE)) + self.wait(2) + self.play(Transform(rhsu2, rhsu2a), Transform(lhsu2, lhsu2a)) + self.wait(3) + self.play(Write(rhs1), Write(eq1)) + self.wait(3) + self.play(Wiggle(lhsu2), Wiggle(rhsu2)) + self.play(Transform(rhs1, rhs1a)) + self.wait(5) + self.play(Write(rhs2), Write(eq2)) + self.wait(3) + self.play(Wiggle(lhsu1), Wiggle(rhsu1)) + self.play(Transform(rhs2, rhs2a)) + self.wait(5) + self.play(Write(rhs4), Write(eq4)) + self.wait(5) + self.play(FadeOut(eq4, rhs4)) + self.play(Wiggle(lhsu1), Wiggle(rhsu1)) + self.play(Write(eq3), Write(rhs3)) + self.wait(5) + self.play(Write(rhs4), Write(eq4)) + self.wait(3) + self.play(Transform(rhs4, rhs4a)) + + + self.wait(5) + + + +class Graph(Scene): + def construct(self): + + title1 = MathTex(r" \int_0^2 xe^{x^2-1}\,dx.", color=YELLOW).scale(0.8).to_edge(UP) + title2 = MathTex(r" \int_{-1}^3 \frac{1}{2}e^u\,du.", color=PURPLE).scale(0.8).to_edge(UP) + title3 = MathTex(r" \int_0^2 xe^{x^2-1}\,dx.", color=YELLOW).scale(0.8).to_edge(UP) + + + + axes = Axes(x_range=[-2,4,2], y_range=[-1, 42, 10], x_length=5, y_length=5,).shift(DOWN*0.5) + axes_labels = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + axes_labels2 = axes.get_axis_labels(MathTex("u").scale(0.5), MathTex("y").scale(0.5)) + axes_labels3 = axes.get_axis_labels(MathTex("x").scale(0.5), MathTex("y").scale(0.5)) + + numberplane = NumberPlane(x_range=[-2,4,2], y_range=[-1, 42, 10], x_length=5, y_length=5, + ).add_coordinates().shift(DOWN*0.5) + + + + #L1 = DashedLine(axes.coords_to_point(-5, 2/3), axes.coords_to_point(1, 2/3), color="RED") + + + + + plot1 = axes.plot(lambda x:( x*np.exp(x**2-1) ), + x_range=[0, 2], + use_smoothing=True, + color=YELLOW) + plot3 = axes.plot(lambda x:( x*np.exp(x**2-1) ), + x_range=[0, 2], + use_smoothing=True, + color=YELLOW) + + plot2 = axes.plot(lambda x:( (1/2)*np.exp(x) ), + x_range=[-1, 3], + use_smoothing=True, + color=PURPLE) + + area1 = axes.get_area(graph=plot1, x_range=[0,2], color=YELLOW) + + area2 = axes.get_area(graph=plot2, x_range=[-1,3], color=PURPLE) + + area3 = axes.get_area(graph=plot1, x_range=[0,2], color=YELLOW) + + + + + + + self.add(title1) + self.add(axes, axes_labels, numberplane, ) + self.wait(1) + #self.play(Create(L1)) + self.play(Create(plot1), ) + self.wait(3) + self.play(Create(area1), ) + self.wait(5) + self.play(Transform(plot1, plot2), Transform(title1, title2), Transform(area1, area2), Transform(axes_labels, axes_labels2)) + self.wait(7) + self.play(Transform(plot1, plot3), Transform(title1, title3), Transform(area1, area3), Transform(axes_labels, axes_labels3)) + + + self.wait(5) + + +class FindIndef2(Scene): + def construct(self): + #3d stuff + + + title1 = MathTex(r"\text{Find the indefinite integral } \displaystyle \int (x-1)(x-10)^\frac{2}{3}\,dx.", color=TEAL).scale(0.6).to_edge(UP) + + + eq1 = MathTex(r"=").scale(0.8).shift(UP*2+LEFT*2) + eq2 = MathTex(r"=").scale(0.8).next_to(eq1, DOWN*5) + eq3 = MathTex(r"=",).scale(0.8).next_to(eq2, DOWN*5) + eq4 = MathTex(r"=").scale(0.8).next_to(eq3, DOWN*5) + + equ1 = MathTex(r"=", color=RED).scale(0.6).shift(RIGHT*4+UP*1) + equ2 = MathTex(r"=", color=BLUE).scale(0.6).next_to(equ1, DOWN*2) + + lhs1 = MathTex(r"\displaystyle \int (x-1)(x-10)^\frac{2}{3}\,dx").scale(0.8).next_to(eq1, LEFT) + rhs1 = MathTex(r"\displaystyle \int ", r" (x-1) ", r" (x-10) ", r" ^\frac{2}{3} ", r" \,dx").scale(0.8).next_to(eq1, RIGHT) + + rhs2 = MathTex(r"\displaystyle \int ", r" (x-1) ", r" u ", r" ^\frac{2}{3} ", r" \,du").scale(0.8).next_to(eq2, RIGHT) + rhs2[2].set_color(RED) + rhs2[4].set_color(BLUE) + rhs2a = MathTex(r"\displaystyle \int ", r" (u+9) ", r" u ", r" ^\frac{2}{3} ", r" \,du").scale(0.8).next_to(eq2, RIGHT) + rhs2a[2].set_color(RED) + rhs2a[1].set_color(RED) + rhs2a[4].set_color(BLUE) + + rhs2b = MathTex(r"\displaystyle \int ", r" (u+9) ", r" u ", r" ^\frac{2}{3} ", r" \,du").scale(0.8).next_to(eq2, RIGHT) + rhs2b[2].set_color(RED) + rhs2b[1].set_color(RED) + rhs2b[4].set_color(BLUE) + + rhs2c = MathTex(r"\displaystyle \int ", r"u", r"^{\frac{5}{3}} + 9", r"u", r"^{\frac{2}{3}} ", r" \,du").scale(0.8).next_to(eq2, RIGHT) + rhs2c[3].set_color(RED) + rhs2c[1].set_color(RED) + rhs2c[5].set_color(BLUE) + + lhsu1 = MathTex(r"u", color=RED).scale(0.6).next_to(equ1, LEFT) + rhsu1 = MathTex(r"x-10", color=RED).scale(0.6).next_to(equ1, RIGHT) + + lhsu1a = MathTex(r"x-1", color=RED).scale(0.6).next_to(equ1, LEFT) + rhsu1a = MathTex(r"u+9", color=RED).scale(0.6).next_to(equ1, RIGHT) + + lhsu1b = MathTex(r"u", color=RED).scale(0.6).next_to(equ1, LEFT) + rhsu1b = MathTex(r"x-10", color=RED).scale(0.6).next_to(equ1, RIGHT) + + lhsu2 = MathTex(r"du", color=BLUE).scale(0.6).next_to(equ2, LEFT) + rhsu2 = MathTex(r"dx", color=BLUE).scale(0.6).next_to(equ2, RIGHT) + + rhs3 = MathTex(r"\frac{1}{\frac{8}{3}}", r"u", r"^{8/3} ", r"+\frac{9}{\frac{5}{3}}", r"u", r"^{5/3} ", r" +C").scale(0.8).next_to(eq3, RIGHT) + rhs3[1].set_color(RED) + rhs3[4].set_color(RED) + rhs3a = MathTex(r"\frac{3}{8}", r"u", r"^{8/3} ", r"+\frac{27}{5}", r"u", r"^{5/3} ", r" +C").scale(0.8).next_to(eq3, RIGHT) + rhs3a[1].set_color(RED) + rhs3a[4].set_color(RED) + + rhs4 = MathTex(r"\frac{3}{8}", r"(x-10)", r"^{8/3} ", r"+\frac{27}{5}", r"(x-10)", r"^{5/3} ", r" +C").scale(0.8).next_to(eq4, RIGHT) + rhs4[1].set_color(RED) + rhs4[4].set_color(RED) + + + + + + self.add(title1) + self.wait(3) + self.play(Write(lhs1)) + self.wait(3) + self.play(Write(rhs1), Write(eq1)) + self.wait(5) + self.play(Wiggle(rhs1[2])) + self.wait(2) + self.play(Write(lhsu1)) + self.wait(2) + self.play(Write(equ1), Write(rhsu1)) + self.wait(3) + self.play(Write(lhsu2)) + self.wait(2) + self.play(Write(equ2), Write(rhsu2)) + self.wait(5) + self.play(Wiggle(rhs1[2])) + self.play(rhs1[2].animate.set_color(RED)) + self.wait(3) + self.play(Wiggle(rhs1[4]),) + self.play(rhs1[4].animate.set_color(BLUE), ) + self.wait(2) + self.play(Write(rhs2), Write(eq2)) + self.wait(3) + + self.play(Wiggle(rhs2[1])) + self.play(Transform(lhsu1, lhsu1a), Transform(rhsu1, rhsu1a)) + self.wait(5) + self.play(Wiggle(rhs2[1])) + self.play(Transform(rhs2, rhs2b)) + self.wait(5) + self.play(Transform(rhs2, rhs2c)) + self.wait(5) + + + self.play(Write(rhs3), Write(eq3)) + self.wait(3) + self.play(Transform(rhs3, rhs3a)) + self.wait(2) + self.play(Transform(lhsu1, lhsu1b), Transform(rhsu1, rhsu1b)) + self.play(Wiggle(lhsu1), Wiggle(rhsu1)) + self.play(Write(eq4), Write(rhs4)) + self.wait(3) + self.play(rhs4[1].animate.set_color(WHITE)) + self.play(rhs4[4].animate.set_color(WHITE)) + + + + + self.wait(10) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file