mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Up to SecondTermIntuition in eoc10
This commit is contained in:
1173
eoc/chapter10.py
1173
eoc/chapter10.py
File diff suppressed because it is too large
Load Diff
@ -1519,6 +1519,8 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene):
|
||||
"y_axis_label" : "",
|
||||
"num_rects" : 400,
|
||||
"dT" : 0.25,
|
||||
"variable_point_label" : "T",
|
||||
"area_opacity" : 0.8,
|
||||
}
|
||||
def setup(self):
|
||||
PlotVelocity.setup(self)
|
||||
@ -1719,7 +1721,7 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene):
|
||||
triangle.move_to(self.coords_to_point(x_val, 0), UP)
|
||||
triangle.set_fill(WHITE, 1)
|
||||
triangle.set_stroke(width = 0)
|
||||
T_label = TexMobject("T")
|
||||
T_label = TexMobject(self.variable_point_label)
|
||||
T_label.next_to(triangle, DOWN)
|
||||
v_line = self.get_vertical_line_to_graph(
|
||||
x_val, self.v_graph,
|
||||
@ -1745,7 +1747,7 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene):
|
||||
x_max = t_max,
|
||||
dx = dx,
|
||||
stroke_width = 0,
|
||||
).set_fill(opacity = 0.8)
|
||||
).set_fill(opacity = self.area_opacity)
|
||||
|
||||
def change_area_bounds(self, new_t_min = None, new_t_max = None, **kwargs):
|
||||
curr_t_min = self.x_axis.point_to_number(self.area.get_left())
|
||||
|
@ -34,6 +34,8 @@ class GraphScene(Scene):
|
||||
"default_graph_colors" : [BLUE, GREEN, YELLOW],
|
||||
"default_derivative_color" : GREEN,
|
||||
"default_input_color" : YELLOW,
|
||||
"default_riemann_start_color" : BLUE,
|
||||
"default_riemann_end_color" : GREEN,
|
||||
}
|
||||
def setup(self):
|
||||
self.default_graph_colors_cycle = it.cycle(self.default_graph_colors)
|
||||
@ -201,13 +203,17 @@ class GraphScene(Scene):
|
||||
stroke_width = 1,
|
||||
stroke_color = BLACK,
|
||||
fill_opacity = 1,
|
||||
start_color = BLUE,
|
||||
end_color = GREEN,
|
||||
start_color = None,
|
||||
end_color = None,
|
||||
show_signed_area = True,
|
||||
width_scale_factor = 1.001
|
||||
):
|
||||
x_min = x_min if x_min is not None else self.x_min
|
||||
x_max = x_max if x_max is not None else self.x_max
|
||||
if start_color is None:
|
||||
start_color = self.default_riemann_start_color
|
||||
if end_color is None:
|
||||
end_color = self.default_riemann_end_color
|
||||
rectangles = VGroup()
|
||||
x_range = np.arange(x_min, x_max, dx)
|
||||
colors = color_gradient([start_color, end_color], len(x_range))
|
||||
|
Reference in New Issue
Block a user