Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

ode changes

Grant Sandersonf2cd7004d7d4
diff --git a/active_projects/ode/all_part1_scenes.py b/active_projects/ode/all_part1_scenes.py
index bac3f09e0..945daf6d1 100644
--- a/active_projects/ode/all_part1_scenes.py
+++ b/active_projects/ode/all_part1_scenes.py
@@ -3,5 +3,6 @@ from active_projects.ode.part1.staging import *
OUTPUT_DIRECTORY = "ode/part1"
ALL_SCENE_CLASSES = [
- PendulumTest
+ PendulumTest,
+ VectorFieldTest,
]
diff --git a/active_projects/ode/part1/staging.py b/active_projects/ode/part1/staging.py
index 687591dc3..ae8c158bf 100644
--- a/active_projects/ode/part1/staging.py
+++ b/active_projects/ode/part1/staging.py
@@ -1,5 +1,27 @@
from big_ol_pile_of_manim_imports import *
-class NewSceneName(Scene):
+
+def pendulum_vector_field(point, mu=0.1, g=9.8, L=3):
+ theta, omega, z = point
+ return np.array([
+ omega,
+ -np.sqrt(g / L) * np.sin(theta) - mu * omega,
+ 0,
+ ])
+
+
+class VectorFieldTest(Scene):
def construct(self):
- pass
+ plane = NumberPlane(
+ # axis_config={"unit_size": 2}
+ )
+ field = VectorField(
+ lambda p: pendulum_vector_field(
+ [*plane.point_to_coords(p), 0],
+ mu=0.1
+ ),
+ max_magnitude=4,
+ # length_func=lambda norm: norm,
+ )
+
+ self.add(plane, field)