diff options
author | vishal786-commits | 2020-07-09 08:37:20 +0530 |
---|---|---|
committer | GitHub | 2020-07-09 08:37:20 +0530 |
commit | e21bbdde2d574b10a073b5f7788748212bd9317e (patch) | |
tree | 12a84c37ea9fb0db34f95b021dbaf211c124f7ce | |
parent | ebfe7a6656b240aacffc4c92e873d4f3fed79971 (diff) | |
download | FSF-mathematics-python-code-archive-e21bbdde2d574b10a073b5f7788748212bd9317e.tar.gz FSF-mathematics-python-code-archive-e21bbdde2d574b10a073b5f7788748212bd9317e.tar.bz2 FSF-mathematics-python-code-archive-e21bbdde2d574b10a073b5f7788748212bd9317e.zip |
Update and rename file1_flux_through_sphere.py to file1_flux_through_circle.py
2 files changed, 43 insertions, 50 deletions
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_circle.py b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_circle.py new file mode 100644 index 0000000..e418a96 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_circle.py @@ -0,0 +1,43 @@ +from manimlib.imports import * +def pendulum_vector_field_func(point): + #theta, omega = point[:2] + return np.array([ + point[0], + point[1], + point[2], + ]) +class F2D(Scene): + CONFIG = { + # "func": cylinder_flow_vec or_field, + "flow_time": 5, + } + def initialize_vector_field(self): + self.vector_field = VectorField( + pendulum_vector_field_func, + ) + self.vector_field.sort(get_norm) + def construct(self): + # plane = NumberPlane(color=RED) + # plane.add(plane.get_axis_labels()) + # self.add(plane) + self.initialize_vector_field() + + field = self.vector_field + c1=Circle(radius=3,color=BLUE) + self.play(ShowCreation(field), run_time=7) + self.play(ShowCreation(c1)) + self.wait(3) + lines = StreamLines( + pendulum_vector_field_func, + virtual_time=3, + min_magnitude=0, + max_magnitude=2, + ) + self.add(AnimatedStreamLines( + lines, + line_anim_class=ShowPassingFlash + )) + self.wait(2) + phase_point = VectorizedPoint(1*UP+1*RIGHT) + self.add(move_along_vector_field(phase_point, pendulum_vector_field_func)) + self.wait(2) diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py deleted file mode 100644 index e07715e..0000000 --- a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py +++ /dev/null @@ -1,50 +0,0 @@ -from manimlib.imports import * -class fluxsphere(ThreeDScene): - - - def construct(self): - s = Sphere(checkerboard_colors=[BLUE_D,BLUE_D]) - s.scale(2.3) - - n = VGroup( - *[self.n(*self.func(u, v)) - for u in np.arange(0, PI, 0.4) - for v in np.arange(0, TAU, 0.8)] - ) - - - - self.move_camera(0.8 * PI / 2, -0.45 * PI) - self.play(Write(s)) - # self.play(Write(f)) - self.play(ShowCreation(n), run_time=4) - # self.add(n) - self.begin_ambient_camera_rotation(rate=0.1) - self.wait(5) - - - def func(self, u, v): - return [ - np.cos(v) * np.sin(u), - np.sin(v) * np.sin(u), - np.cos(u) - ] - - def vect(self, x, y, z): - return np.array([ - x, y, z - ]) - - def n(self, x, y, z): - vect = np.array([ - x, - y, - z - ]) - - mag = math.sqrt(vect[0] ** 2 + vect[1] ** 2 + vect[2] ** 2) - v = Vector( - (1.5/mag) * vect, - color=RED_B, - stroke_width=4).shift(2*x * RIGHT + 2*y * UP + 2*z * OUT) - return v |