Can someone explain how to create the vector field? #1537
Answered
by
TonyCrane
Jack071120
asked this question in
Q&A
-
Hi there. I've tried to use the VectorField commend with defined function. However, I'm stuck on the coordinate system parameter. I can't find any vector field example using manimgl, so it would be great if someone could give me an example and explain it briefly. Thx! |
Beta Was this translation helpful? Give feedback.
Answered by
TonyCrane
Jun 14, 2021
Replies: 1 comment 2 replies
-
Just like this? : class Code1537(Scene):
def construct(self):
plane = NumberPlane()
vector_field = VectorField(
lambda x, y: np.array([x, y]), plane,
magnitude_range=(0, 5),
vector_config={"thickness": 0.025}
)
self.add(plane, vector_field)
class Code1537(Scene):
def construct(self):
matrix = np.array(self.matrix)
def func(x, y):
return 0.15 * np.dot(matrix.T, [x, y])
plane = NumberPlane()
vector_field = VectorField(
func, plane,
magnitude_range=(0, 2),
vector_config={"thickness": 0.025}
)
self.add(plane, vector_field) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
TonyCrane
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just like this? :
And you can also learn it from 3b1b's newest video code: https://github.com/3b1b/videos/blob/master/_2021/matrix_exp.py
Such as: