[PYTHON] Manim's method 4

Overview

I checked manim's method. I tried using VectorField.

Sample code

from manimlib.imports import *

def pendulum_vector_field_func(point, mu = 0.1, g = 9.8, L = 3):
	theta, omega = point[:2]
	return np.array([omega, -np.sqrt(g / L) * np.sin(theta) - mu * omega, 0, ])

class test(Scene):
	def construct(self):
		plane = NumberPlane()
		mu_tracker = ValueTracker(1)
		field = VectorField(lambda p: pendulum_vector_field_func(plane.point_to_coords(p), mu = mu_tracker.get_value()), delta_x = 0.5, delta_y = 0.5, max_magnitude = 6, opacity = 0.5, )
		field.set_opacity(1)
		stream_lines = StreamLines(field.func, delta_x = 0.5, delta_y = 0.5, )
		animated_stream_lines = AnimatedStreamLines(stream_lines, line_anim_class = ShowPassingFlashWithThinningStrokeWidth, )
		self.add(plane, field, animated_stream_lines)
		self.wait(10)





Generated video

https://www.youtube.com/watch?v=rkXmemK4cuA

that's all.

Recommended Posts

Manim's method 7
Manim's method 13
Manim's method 18
Manim's method 17
Manim's method 5
Manim's method 3
Manim's method 15
Manim's method 11
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
Manim's method part 23
manim's manners
Binary method
Special method
Special method
Understand k-means method
Clustering of clustering method
Dictionary items method
[PyTorch] Installation method
N cross method
Image collection method
Regression analysis method
Gradient method implementation 1
Python-peewee connection method
Class method static method
youtube-dl update method
Monte Carlo method
Mode-Matching Method Simulation_Python
Johnson method (python)
[Python] Semi-Lagrange method