[关闭]
@Ding-feng 2017-09-26T13:42:05.000000Z 字数 482 阅读 745

Homework 3

作者:丁峰 学号:2015301020029


摘要

用Euler法计算常微分方程

题目

The position of an object moving horizontally with a constant velocity,v,is described by the equation

Assuming that the velocity is a constant, say v = 40 m/s, use the Euler method to solve it for x as a function of time. Compare your result with the exact solution.

解答

调用函数库:matplotlib
具体计算方法:欧拉法
所用公式:


时间间隔dt选取得越短,则模拟计算越精确
此处取dt=0.01 循环1000次
所用程序 homework_3
由程序绘制得到图像如下图所示:
当初速度为v=40时:

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注