Skip to content

Commit

Permalink
added corrected sounds and added polynomial of 3rd degree and added d…
Browse files Browse the repository at this point in the history
…iscrete elliptic charts
  • Loading branch information
martawleklinska committed Aug 16, 2024
1 parent 9f7070b commit c61d754
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 53 deletions.
Binary file modified data/sound/e4/slide0-1.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide0-2.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide0-3.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-0.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-1.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-2.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-3.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-4.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-5.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-6.mp3
Binary file not shown.
Binary file modified data/sound/e4/slide1-7.mp3
Binary file not shown.
6 changes: 3 additions & 3 deletions zkmarek/video/slides/e4/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, include_details=True, **kwargs):
step = 10 if include_details else 20
self.ax = Axes(
x_range=[-4.7, 4, step],
y_range=[-3.4, 27, step],
y_range=[-4.2, 37, step],
x_length=7,
axis_config={
"include_numbers": include_details,
Expand All @@ -29,15 +29,15 @@ def __init__(self, include_details=True, **kwargs):
template = TexTemplate()
template.add_to_preamble(r"\usepackage{amsfonts}")
self.graph = self.ax.plot_implicit_curve(
lambda x, y: 2*x**2 + 3*x - 2 - y,
lambda x, y: 4*x**3 - 8*x**2 - 17*x +30 - y,
color=SECONDARY_COLOR
)
self.graph2 = self.ax.plot_implicit_curve(
lambda x, y: x**3 +x**2 - 2*x + 8 - y,
color=HIGHLIGHT_COLOR
)
self.graph3 = self.ax.plot_implicit_curve(
lambda x, y: x**3 - x**2 - 5*x + 10 - y,
lambda x, y: 3*x**3 - 9*x**2 - 15*x + 22 - y,
color=HIGHLIGHT_COLOR
)
self.add(self.ax)
Expand Down
2 changes: 1 addition & 1 deletion zkmarek/video/slides/e4/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, x: float, y: float):

@staticmethod
def from_x(x, sgn = 1):
y = 2*x **2 + 3*x - 2
y = 4 *x**(3)-8 *x**(2)-17* x+30
return Curve(x, -y) if sgn < 0 else Curve(x, y)

def __neg__(self):
Expand Down
28 changes: 4 additions & 24 deletions zkmarek/video/slides/e4/e3_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ def construct(self):
self.tau1 = MathTex(r"\tau_1", color = SECONDARY_COLOR, font_size=70).next_to(self.group, LEFT, buff=0.1)
self.tau2 = MathTex(r"\tau_2", color = SECONDARY_COLOR, font_size=70).next_to(self.group, RIGHT, buff=0.1)

def create_arrow(self, scene):
self.arrow = Arrow(start=LEFT, end=RIGHT, color=PRIMARY_COLOR)

self.arrow.align_on_border(UP, buff=0.1)
self.arrow.shift(RIGHT * 1)
self.arrow.generate_target()

self.label = Text("Click here for episode 3", font_size=24, color=PRIMARY_COLOR, font=PRIMARY_FONT)
self.label.next_to(self.arrow, LEFT)
self.label.generate_target()

self.arrow.shift(9 * LEFT)
self.label.shift(9 * LEFT)

scene.play(MoveToTarget(self.label, rate_func=rate_functions.ease_out_bounce, run_time=0.7),
MoveToTarget(self.arrow, rate_func=rate_functions.ease_out_bounce, run_time=0.7))
scene.play(ApplyWave(VGroup(self.label, self.arrow)), run_time=1)
scene.play(FadeIn(self.group), run_time=0.7)

def animate_in(self, scene):
self.new_subsection(scene, "Intro", sound="data/sound/e4/slide0-1.mp3")
self.create_arrow(scene)
scene.play(Write(self.title_label), run_time=1)
scene.play(Write(self.tau0), run_time=0.7)
scene.play(Write(self.tau1), run_time=0.7)
scene.play(Write(self.tau2), run_time=0.7)
scene.play(Write(self.title_label), run_time=1.2)
scene.play(Write(self.tau0), run_time=1)
scene.play(Write(self.tau1), run_time=1)
scene.play(Write(self.tau2), run_time=1)
self.slide = Ceremony()
self.slide.construct()
self.slide2 = Polynomial()
Expand Down
65 changes: 40 additions & 25 deletions zkmarek/video/slides/e4/polynomials.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,40 @@
from zkmarek.video.mobjects.dot_on_curve import DotOnCurve
from zkmarek.video.slides.e4.chart import Chart
from zkmarek.video.slides.e4.curve import Curve
from zkmarek.video.slides.episode4.discreete_polynomial_chart import DiscreetePolynomialChart
from zkmarek.crypto.field_element import FieldElement
def poly(x):
return 4 * x ** 3 - 8 * x **2 + 17 * x + 30

class Polynomials(SlideBase):

def __init__(self):
super().__init__("Polynomials")

def construct(self):
self.chart = DiscreetePolynomialChart(5, poly)
self.chart.to_edge(LEFT).scale(0.8).shift(UP*0.5)
self.title_label = Text("Polynomials", color = PRIMARY_COLOR, font = PRIMARY_FONT, font_size = 40).to_edge(UP)
self.x = MathTex(r"x", color = PRIMARY_COLOR, font_size=70)

self.polynomial_eqn = MathTex(r"P(x) = {{a_n}} \cdot {{x^n}} + {{a_{n-1} }}\cdot {{x^{n-1} }} + \cdots + {{a_1}} \cdot {{x}} + {{a_0}}", color = PRIMARY_COLOR, font_size = 60)

self.polynomial_eqn1 = MathTex(r"{{a_n}} \cdot {{x^n}} + {{a_{n-1} }}\cdot {{x^{n-1} }} + \cdots + {{a_1}} \cdot {{x}} + {{a_0}}", color = PRIMARY_COLOR, font_size = 60)

self.polynomial_eqn3 = MathTex(r"P(x) = {{a_2}} \cdot {{x^2}} + {{a_{1} }}\cdot {{x }} + {{a_0}}", color = PRIMARY_COLOR, font_size = 60).to_edge(DOWN).scale(0.7)
self.polynomial_eqn3 = MathTex(r"P(x) = {{a_3}}\cdot {{x^3}} +{{a_2}} \cdot {{x^2}} + {{a_{1} }}\cdot {{x }} + {{a_0}}", color = PRIMARY_COLOR, font_size = 60).to_edge(DOWN).scale(0.7)

self.polynomial_eqn2 = MathTex(r"{{x}}^n + {{x}}^{n-1} + \cdots + {{x}}", color = PRIMARY_COLOR, font_size = 60)
self.polynomial = MathTex(r"P({{x}}) = 2 {{x}}^2 + 3{{x}} - 2 {{}}", color = PRIMARY_COLOR).to_edge(DOWN)
self.polynomial_z = MathTex(r"P({{z}}) = 2 {{z}}^2 + 3{{z}} - 2 {{=y}}", color = PRIMARY_COLOR).to_edge(RIGHT).shift(LEFT*1.5)
self.polynomial_brakdown = MathTex("P({{x}})", "=", "2 {{x}}^2", "+", "3{{x}}", "-", "2", color = PRIMARY_COLOR).to_edge(RIGHT).shift(LEFT*1.5)
self.polynomial_roots = MathTex(r"P(x{{_0}}) = 2 {{x_0}}^2 + 3{{x_0}} - 2 = 0", color = PRIMARY_COLOR).to_edge(DOWN)
self.quotient = MathTex(r"Q({{x}}) = {{x}}^3 + {{x}}^2 - 2{{x}} + 8 {{}}", color = PRIMARY_COLOR).to_edge(DOWN)
self.polynomial = MathTex(r"P({{x}}) = 4 {{x^3}} - 8{{x^2}} - 17 {{x}} + 30 {{}}", color = PRIMARY_COLOR).to_edge(DOWN)
self.polynomial_z = MathTex(r"P({{z}}) = 4 {{z^3}} - 8{{z^2}} - 17 {{z}} + 30 {{=y}}", color = PRIMARY_COLOR).to_edge(RIGHT).shift(LEFT*1.5)
self.polynomial_brakdown = MathTex("P({{x}})", "=", "4 {{x^3}}", "-", "8{{x^2}}", "-", "17 {{x}}", "+", "30", color = PRIMARY_COLOR).to_edge(RIGHT).shift(LEFT*1.5)
self.polynomial_roots = MathTex(r"P(x{{x_0}}) = 4 {{x_0^3}} - 8{{x_0^2}} - 17 {{x_0}} + 30 = 0", color = PRIMARY_COLOR).to_edge(DOWN)
self.quotient = MathTex(r"Q({{x}}) = {{x^3}} + {{x^2}} - 2{{x}} + 8 {{}}", color = PRIMARY_COLOR).to_edge(DOWN)
self.quotient_breakdown = MathTex("Q({{x}})", "=", "{{x}}^3", "+", "{{x}}^2", "-", "2{{x}}", "+", "8", color = PRIMARY_COLOR).to_edge(RIGHT).shift(LEFT*1.5).scale(0.7)

self.line_subtract = Line(start = self.polynomial_brakdown.get_left(), end = self.polynomial_brakdown.get_right(), color = HIGHLIGHT_COLOR).next_to(self.polynomial_brakdown, DOWN, buff = 0.2)
self.quotient_z = MathTex(r"Q({{z}}) = {{z}}^3 + {{z}}^2 - 2{{z}} + 8 {{=y}}", color = PRIMARY_COLOR).next_to(self.polynomial_brakdown, UP, buff = 0.6)
self.subtract = MathTex("R(x)", "=", "x^3", "-", "x^2", "-", "5x", "+", "10", color = PRIMARY_COLOR).next_to(self.line_subtract, DOWN, aligned_edge=LEFT).shift(LEFT)
self.subtract_z = MathTex("R(z)", "=", "z^3", "-", "z^2", "-", "5z", "+", "10", "=0", color = PRIMARY_COLOR).next_to(self.line_subtract, DOWN, aligned_edge=LEFT).shift(LEFT)
self.subtract = MathTex("R(x)", "=", "3x^3", "-", "9x^2", "-", "15x", "+", "22", color = PRIMARY_COLOR).next_to(self.line_subtract, DOWN, aligned_edge=LEFT).shift(LEFT)
self.subtract_z = MathTex("R(z)", "=", "3z^3", "-", "9z^2", "-", "15z", "+", "22", "=0", color = PRIMARY_COLOR).next_to(self.line_subtract, DOWN, aligned_edge=LEFT).shift(LEFT)
self.polynomial2 = MathTex(r"P({{x}}) = 2 {{x}}^2 + 3{{x}} - 2 = {{(2x-1)(x+2)}}", color = PRIMARY_COLOR).to_edge(DOWN)

self.proof = ImageMobject("data/images/Proof.png")
Expand All @@ -43,28 +49,31 @@ def construct(self):
self.chart = Chart(include_details=True).scale(0.6).next_to(self.title_label, DOWN).shift(DOWN)
self.p1_1 = ValueTracker(1)
a1_1 = Curve.from_x(self.p1_1.get_value())
self.p1 = DotOnCurve(self.chart.ax, "(1,3)", a1_1)
self.p1 = DotOnCurve(self.chart.ax, "(1,9)", a1_1)

self.p2_10 = ValueTracker(2)
a2_10 = Curve.from_x(self.p2_10.get_value())
self.p2 = DotOnCurve(self.chart.ax, "(2,12)", a2_10)
self.p2 = DotOnCurve(self.chart.ax, "(2,-4)", a2_10)

self.p3_23 = ValueTracker(3)
a3_23 = Curve.from_x(self.p3_23.get_value())
self.p3 = DotOnCurve(self.chart.ax, "(3,25)", a3_23)
self.p3 = DotOnCurve(self.chart.ax, "(3,-12)", a3_23)

self.poly_point1 = MathTex("P(1) = 3", color = PRIMARY_COLOR).to_edge(RIGHT)
self.poly_point2 = MathTex("P(2) = 12", color = PRIMARY_COLOR).next_to(self.poly_point1, DOWN)
self.poly_point3 = MathTex("P(3) = 25", color = PRIMARY_COLOR).next_to(self.poly_point2, DOWN)
self.poly_point1 = MathTex("P(1) = 9", color = PRIMARY_COLOR).to_edge(RIGHT)
self.poly_point2 = MathTex("P(2) = -4", color = PRIMARY_COLOR).next_to(self.poly_point1, DOWN)
self.poly_point3 = MathTex("P(3) = -12", color = PRIMARY_COLOR).next_to(self.poly_point2, DOWN)

self.p25 = ValueTracker(-2)
a25 = Curve.from_x(self.p25.get_value())
self.root1 = DotOnCurve(self.chart.ax, "({{-2}},{{0}})", a25)
self.p05 = ValueTracker(0.5)
self.p05 = ValueTracker(1.5)
a05 = Curve.from_x(self.p05.get_value())
self.root2 = DotOnCurve(self.chart.ax, "({{0.5}},{{0}})", a05)
self.p52 = ValueTracker(2.5)
a25 = Curve.from_x(self.p05.get_value())
self.root3 = DotOnCurve(self.chart.ax, "({{2.5}},{{0}})", a25)

self.p_intersect = ValueTracker(-2.5328)
self.p_intersect = ValueTracker(-1.849)
a_i = Curve.from_x(self.p_intersect.get_value())
self.intersect = DotOnCurve(self.chart.ax, r"(z,y)", a_i)
self.intersect.set_color(PRIMARY_COLOR)
Expand All @@ -77,7 +86,7 @@ def construct(self):
points = ValueTracker(point_value)
a = Curve.from_x(points.get_value())
self.point.append(DotOnCurve(self.chart.ax, "", a))

self.z = FieldElement(1, 5)

def animate_in(self, scene):
self.new_subsection(scene, "intro", "data/sound/e4/slide1-0.mp3")
Expand All @@ -87,16 +96,16 @@ def animate_in(self, scene):
scene.play(FadeIn(self.x))
scene.play(TransformMatchingShapes(self.x, self.polynomial_eqn2))

scene.play(Indicate(self.polynomial_eqn2[0], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn2[2], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn2[4], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn2[0], color = HIGHLIGHT_COLOR), run_time=0.3)
scene.play(Indicate(self.polynomial_eqn2[2], color = HIGHLIGHT_COLOR), run_time=0.3)
scene.play(Indicate(self.polynomial_eqn2[4], color = HIGHLIGHT_COLOR), run_time=0.3)

scene.play(TransformMatchingShapes(self.polynomial_eqn2, self.polynomial_eqn1), run_time=1)

scene.play(Indicate(self.polynomial_eqn1[0], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn1[4], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn1[8], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn1[12], color = HIGHLIGHT_COLOR), run_time=0.5)
scene.play(Indicate(self.polynomial_eqn1[0], color = HIGHLIGHT_COLOR), run_time=0.3)
scene.play(Indicate(self.polynomial_eqn1[4], color = HIGHLIGHT_COLOR), run_time=0.3)
scene.play(Indicate(self.polynomial_eqn1[8], color = HIGHLIGHT_COLOR), run_time=0.3)
scene.play(Indicate(self.polynomial_eqn1[12], color = HIGHLIGHT_COLOR), run_time=0.3)

scene.play(TransformMatchingShapes(self.polynomial_eqn1, self.polynomial_eqn), run_time=1)

Expand Down Expand Up @@ -152,7 +161,8 @@ def animate_in(self, scene):
scene.wait(1.2)
scene.play(Indicate(self.root1.label[3], color = HIGHLIGHT_COLOR, scale_factor=2), Indicate(self.root2.label[3], color = HIGHLIGHT_COLOR, scale_factor=2))
scene.play(TransformMatchingShapes(self.polynomial_roots, self.polynomial2))

scene.wait(2)

self.new_subsection(scene, "operations", "data/sound/e4/slide1-4.mp3")
scene.play(FadeOut(self.root1, self.polynomial2, self.root2))
scene.wait(1.5)
Expand Down Expand Up @@ -195,6 +205,11 @@ def animate_in(self, scene):
scene.play(FadeOut(self.intersect_sub))
scene.wait(2)

self.new_subsection(scene, "finite fields", "data/sound/e4/slide1-6.mp3")
self.chart.gen_points()
scene.play(FadeIn(self.chart))
self.chart.add_xaxis_label(self.z.value, r"z")

def animate_out(self, scene):
scene.play(FadeOut(self.chart.graph3, self.chart.ax, self.chart.labels, self.title_label, self.line_subtract, self.minus, self.subtract_z, self.quotient_z, self.polynomial_z))

Expand Down

0 comments on commit c61d754

Please sign in to comment.