gpt4 book ai didi

How to Implement Brachistochrone with Manim SciPy/SymPy/Numpy and Python(如何使用Manim SciPy/SymPy/Numpy和Python实现Brchistochrone)

转载 作者:bug小助手 更新时间:2023-10-28 21:33:52 25 4
gpt4 key购买 nike



I am just learning about manim from the tutorial, I modify to add another line, just a -x+50, then I was wondering whether the ball that are moving is actually correct, can we determine the speed for each curve?

我刚刚从教程中了解到Manim,我修改添加了另一行,只需a-x+50,然后我想知道正在移动的球是否真的是正确的,我们能确定每条曲线的速度吗?


this is my code :

这是我的代码:


# python3 -m manim manim-argminexample.py ArgMinExample -p -ql
from manim import *

class ArgMinExample(Scene):
def construct(self):
ax = Axes(
x_range=[0, 10], y_range=[0, 100, 10], axis_config={"include_tip": False}
)
labels = ax.get_axis_labels(x_label="x", y_label="f(x)")

t = ValueTracker(0)

def func(x):
return 2 * (x - 5) ** 2
graph = ax.plot(func, color=MAROON)

def func2(x):
return -x+50
graph2 = ax.plot(func2, color=GREEN)


initial_point = [ax.coords_to_point(t.get_value(), func(t.get_value()))]
dot = Dot(point=initial_point)
dot2 = Dot(point=initial_point)

dot.add_updater(lambda x: x.move_to(ax.c2p(t.get_value(), func(t.get_value()))))
dot2.add_updater(lambda x: x.move_to(ax.c2p(t.get_value(), func2(t.get_value()))))
x_space = np.linspace(*ax.x_range[:2],200)
minimum_index = func(x_space).argmin()

self.add(ax, labels, graph, dot)
self.add(ax, labels, graph2, dot2)
self.play(t.animate.set_value(x_space[minimum_index]))
self.wait()

How am I suppose to create animation for Brachistochrone with manim like this:

我应该如何使用Manim为Brchistochrone创建动画,如下所示:


1


I believe using NumPy or SymPy can help a lot. Thanks.

我相信使用NumPy或SymPy会有很大帮助。谢谢。


更多回答

https://stackoverflow.com/questions/21810818 maybe you mean this

Https://stackoverflow.com/questions/21810818也许你是认真的

@DiegoReim I find another website that able to do computation but not the animation. I will try to working on the animation. Thanks.

@DiegoReim我找到了另一个能做计算但不能做动画的网站。我会试着制作这部动画。谢谢。

优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com