Метод касательных. Метод Ньютона.

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Code Snippet:
from manim import *
from math import log2

class
def construct(self):

# 1. Построение графика и осей:
axes = Axes(
x_range=[-11, 11, 1],
y_range=[-11, 11, 1],
x_length = 7,
y_length = 7,
axis_config={"color": BLUE},
).move_to(LEFT*3)
labels = axes.get_axis_labels(x_label="x", y_label="y")
graph = axes.plot(lambda x: (x/2)**3, x_range=[-4, 4], color=GREEN)

self.play(Create(axes, run_time = 4))
self.play(Write(labels))
self.play(Create(graph))

# показываем что мы ищем:
reshenie_dot = Dot(axes.coords_to_point(0, 0), color = PINK).scale(0.8)
podpis = MathTex("x^*", color = + LEFT/2.5 + UP/2.5).scale(0.8)

self.play(
Create(reshenie_dot),
Write(podpis),
run_time = 2
)

self.wait()

# 2. Построение крайних значений функции:
#
Rpoint = Dot().move_to(axes.coords_to_point(4, 8))
self.play(Create(Rpoint)) # *
self.wait()

R_point_proecsia = Dot().move_to(axes.coords_to_point(4, 0)) # точка проекц на ось Х.
R_point_proecsia.scale(0.5)
R_Dline = DashedLine( # пунктирная линия
Rpoint.get_center(),

)

#

Lpoint = Dot().move_to(axes.coords_to_point(-4, -8))
self.play(Create(Lpoint)) # *
self.wait()

L_point_proecsia = Dot().move_to(axes.coords_to_point(-4, 0)) # точка проекц на ось Х.
L_point_proecsia.scale(0.5)
L_Dline = DashedLine( # пунктирная линия
Lpoint.get_center(),

)
self.play(Create(L_Dline), Create(L_point_proecsia), Create(R_Dline), Create(R_point_proecsia))
self.wait()
#



# 3. Подписываем крайние точки:
L_label = + UP/3).scale(0.6)
R_label = + DOWN/3).scale(0.6)
self.play(Create(L_label), Create(R_label))
self.wait()

# 4. Проводим касаетльную
#-
R_label_new = MathTex("x_{0}", color = + DOWN/3).scale(0.6)
self.play(Transform(R_label, R_label_new), Flash(R_label_new, flash_radius=0.25), run_time = 3)
#-
target_point = Dot().move_to(axes.coords_to_point(2.667, 0)).scale(0.5)
casatelnaya = Line(
axes.coords_to_point(4, 8),
target_point.get_center(),
color = BLUE
)

x1_text = MathTex("x_{1}", color = + DOWN/3).scale(0.5)

#
self.play(Create(casatelnaya), Create(target_point))
self.play(Create(x1_text))
self.wait()

# 5. Начинаем писать формулу:
angle = Angle(
axes.x_axis, # направление 1
Line(axes.coords_to_point(2.667, 0), axes.coords_to_point(4, 8)), # направление 2
radius=0.2,
color = ORANGE
)
value = MathTex(r"\alpha", color = + UP/5 + RIGHT/7).scale(0.7)
self.play(Create(angle), Create(value))

L1 = MathTex(
"x_1 - x_0",
" = ",
"-",
r"AB",
r"\cdot",
r"\cos(",
r"\alpha",
")"
).move_to([4, 3, 0])
L1[0].color = RED
L1[2].color = RED
L1[3].color = BLUE
L1[6].color = ORANGE


# 6. Обозначения для касательно
A = Text("A",
B = Text("B",

self.play(Write(L1))
self.play(
ReplacementTransform(x1_text, A), # не используй Transform!!!!
Flash(x1_text, flash_radius=0.25),
run_time = 3
)
self.play(Create(B))
self.wait()


self.play(Wiggle(
VGroup(
A,
B,
casatelnaya,
L1[3]
)
), run_time = 2)



self.wait()

OnTheWayToTheDirection