Up to SecondTermIntuition in eoc10

This commit is contained in:
Grant Sanderson 2017-04-27 12:01:33 -07:00
parent 62c43cd306
commit c96222fec0
3 changed files with 1169 additions and 20 deletions

File diff suppressed because it is too large Load diff

View file

@ -1519,6 +1519,8 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene):
"y_axis_label" : "", "y_axis_label" : "",
"num_rects" : 400, "num_rects" : 400,
"dT" : 0.25, "dT" : 0.25,
"variable_point_label" : "T",
"area_opacity" : 0.8,
} }
def setup(self): def setup(self):
PlotVelocity.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.move_to(self.coords_to_point(x_val, 0), UP)
triangle.set_fill(WHITE, 1) triangle.set_fill(WHITE, 1)
triangle.set_stroke(width = 0) triangle.set_stroke(width = 0)
T_label = TexMobject("T") T_label = TexMobject(self.variable_point_label)
T_label.next_to(triangle, DOWN) T_label.next_to(triangle, DOWN)
v_line = self.get_vertical_line_to_graph( v_line = self.get_vertical_line_to_graph(
x_val, self.v_graph, x_val, self.v_graph,
@ -1745,7 +1747,7 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene):
x_max = t_max, x_max = t_max,
dx = dx, dx = dx,
stroke_width = 0, 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): 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()) curr_t_min = self.x_axis.point_to_number(self.area.get_left())

View file

@ -34,6 +34,8 @@ class GraphScene(Scene):
"default_graph_colors" : [BLUE, GREEN, YELLOW], "default_graph_colors" : [BLUE, GREEN, YELLOW],
"default_derivative_color" : GREEN, "default_derivative_color" : GREEN,
"default_input_color" : YELLOW, "default_input_color" : YELLOW,
"default_riemann_start_color" : BLUE,
"default_riemann_end_color" : GREEN,
} }
def setup(self): def setup(self):
self.default_graph_colors_cycle = it.cycle(self.default_graph_colors) self.default_graph_colors_cycle = it.cycle(self.default_graph_colors)
@ -201,13 +203,17 @@ class GraphScene(Scene):
stroke_width = 1, stroke_width = 1,
stroke_color = BLACK, stroke_color = BLACK,
fill_opacity = 1, fill_opacity = 1,
start_color = BLUE, start_color = None,
end_color = GREEN, end_color = None,
show_signed_area = True, show_signed_area = True,
width_scale_factor = 1.001 width_scale_factor = 1.001
): ):
x_min = x_min if x_min is not None else self.x_min 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 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() rectangles = VGroup()
x_range = np.arange(x_min, x_max, dx) x_range = np.arange(x_min, x_max, dx)
colors = color_gradient([start_color, end_color], len(x_range)) colors = color_gradient([start_color, end_color], len(x_range))