Source code:
from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
import numpy as np
from scipy.optimize import fsolve
class ThirdOrder(GraphScene):
CONFIG = {
"y_max" : 3,
"y_min" : -3,
"x_max" : 2,
"x_min" : -2,
"y_tick_frequency" : 1,
"x_tick_frequency" : 1,
"x_axis_width" : 6,
"y_axis_height" : 6,
"num_graph_anchor_points": 600,
#"x_labeled_nums" : range(-15,16,1),
#"y_labeled_nums" : range(-50,51,1),
"axes_color" : GREY
}
def construct(self):
self.graph_origin=0*LEFT+0*DOWN
self.setup_axes(animate=True)
func1 = self.get_graph(self.func1,x_min= -0.6823, x_max = 2, color=BLUE)
func2 = self.get_graph(self.func2,x_min= -0.6823, x_max = 2, color=BLUE)
line = self.get_graph(self.line,x_min= -1, x_max = 2, color=BLUE)
vertical = self.get_graph(self.vertical, x_min= 1.435, x_max = 1.468, color=BLUE)
#func_graph_2=self.get_graph(self.func_to_graph_2,x_min=-0.6823, x_max=2, color=BLUE)
#func_graph_3=self.get_graph(self.func_to_graph,x_min=-0.6823,x_max=3, color=BLUE)
#func_graph_4=self.get_graph(self.func_to_graph_2,x_min=-0.6823,x_max=3, color=BLUE)
eqn=TextMobject("$y^2 = x^3 + Ax + B$")
ell = TextMobject("Elliptic curve")
#point1=Dot(0.243*UP + 0.657*LEFT)
#point2=Dot(1.098*UP + 0.198*RIGHT)
point1=Dot(self.coords_to_point(-0.657,self.func1(-0.657)))
point2=Dot(self.coords_to_point(0.198,self.func1(0.198)))
point3=Dot(self.coords_to_point(1.459,self.func1(1.459)))
point4=Dot(self.coords_to_point(1.459,self.func2(1.459)))
p1label=TextMobject("P")
p1label.scale(0.55)
p1label.next_to(point1,LEFT)
p2label=TextMobject("Q")
p2label.scale(0.55)
p2label.next_to(point2,UP)
p3label=TextMobject("P + Q")
p3label.scale(0.55)
p3label.next_to(point3,LEFT)
p4label=TextMobject("P + Q")
p4label.scale(0.65)
p4label.set_color(YELLOW)
p4label.next_to(point4,LEFT)
eqn.scale(0.75)
eqn.move_to(UP*3 + LEFT*3)
ell.scale(0.75)
ell.move_to(UP*3 + LEFT*3)
ell.set_color(YELLOW)
#eqn.shift(4*RIGHT + 3*UP)
self.play(Write(eqn))
self.wait()
self.play(ShowCreation(func1),ShowCreation(func2))
self.wait()
self.play(ReplacementTransform(eqn,ell))
self.wait()
self.play(Write(point1))
self.play(Write(point2))
self.play(ShowCreation(line))
self.play(Write(point3))
self.wait(2)
self.play(Write(p1label))
self.play(Write(p2label))
self.play(Write(p3label))
self.wait()
self.play(ShowCreation(vertical))
self.play(Uncreate(p3label))
self.play(Write(point4))
self.wait()
self.play(ShowCreation(p4label))
#self.play(ShowCreation(func_graph_3),ShowCreation(func_graph_4))
#self.play(Write(eqn))
self.wait(2)
def func1(self,x):
return(np.sqrt(x**3 + 1*x + 1))
def func2(self,x):
return(-1*np.sqrt(x**3 + 1*x + 1))
def line(self,x):
return(x + 0.9)
def vertical(self,x):
return(200*x - 290)
Информация по комментариям в разработке