微分方程数值解法(实际应用)
假设有这样一种情况,关于人行走的,从A到B地,行走速度越来越慢,速度是关于时间1/(t+A)的函数,现在求当s和时间t的关系;
从微分的角度看,v=s'=1/(t+A)
采用分离变量法有:
d(s)/d(t)=1/(t+A)
Go
d(s)=d(t)/(t+A)
Go
s=In (t+A)+B
在这里为了不使当t很小的时候In (t+A)的值变为负无穷大,假设A=1,另外再假设B=10,
这样有s(0)=In 1+10=10;
下面看数值解法和公式解法的差异;
下面写程序来证明:
(setq a 1)
(setq b 10)
(defun pow (num count)
(if (or (> count 1) (eq count 1) )
(* num
(pow num
(- count 1) ) )
1))
(defun slayer ( count)
(if (or (> count 1) (eq count 1) )
(* count
(slayer
(- count 1) ) )
1))
(defun slayerex (num coun
假设有这样一种情况,关于人行走的,从A到B地,行走速度越来越慢,速度是关于时间1/(t+A)的函数,现在求当s和时间t的关系;
从微分的角度看,v=s'=1/(t+A)
采用分离变量法有:
d(s)/d(t)=1/(t+A)
Go
d(s)=d(t)/(t+A)
Go
s=In (t+A)+B
在这里为了不使当t很小的时候In (t+A)的值变为负无穷大,假设A=1,另外再假设B=10,
这样有s(0)=In 1+10=10;
下面看数值解法和公式解法的差异;
下面写程序来证明:
(setq a 1)
(setq b 10)
(defun pow (num count)
(if (or (> count 1) (eq count 1) )
(* num
(pow num
(- count 1) ) )
1))
(defun slayer ( count)
(if (or (> count 1) (eq count 1) )
(* count
(slayer
(- count 1) ) )
1))
(defun slayerex (num coun