微分方程数值解法(实际应用的改进)
来源:互联网 发布:115会员淘宝购买 编辑:程序博客网 时间:2024/05/16 10:40
微分方程数值解法(实际应用的改进)
延伸上面的问题
假设有这样一种情况,关于人行走的,从A到B地,行走速度越来越慢,速度是关于时间A/
(t+B)+C的函数,现在求当s和时间t的关系;
从微分的角度看,v=s'=A/(t+B)+C
采用分离变量法有:
d(s)/d(t)=A/(t+B)+C
Go
d(s)=d(t)*{A/(t+B)+C}
Go
s=A*In (t+B)+C*t+D
假设A=10,另外再假设B=1,C=2,D=100,
这样有s(0)=100;
下面看数值解法和公式解法的差异;
下面写程序来证明:
(setq a 10)
(setq b 1)
(setq c 2)
(setq d 100)
(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 count)
(if (or (> count 1) (eq count 1) )
(* num
(slayerex
(- num 1)
(- count 1) ) )
1))
注意这里是关于x1的函数
(defun expr (x1 y1 )
(+ y1
(* 0.1
(+ C
(/ A
(+ B
x1))))))
(defun calc (n x)
(if (eq n 0)
1.0
(+ (calc (1- n)
x)
(* (pow x
n)
(/ 1
(slayer n))))))
(defun mysqrt (x)
(calc 10
(* 1/2
(log x))))
(defun formula (x)
(+ (* A
(log (+ x
B)))
(* C
x)
D))
(defun exprhelp (x1 )
(if (< (abs (- x1 0))
0.1)
(formula 0)
(expr x1
(exprhelp (- x1
0.1)))))
(defun test (n)
(if (> n 99)
(progn
(print (exprhelp n))
(print 'compare)
(print (formula n))
(test (- n 0.1)))
(print 'over)))
[32]> (test 100)
345.65558
COMPARE
346.15118
345.44568
COMPARE
345.94128
345.23578
COMPARE
345.73138
345.02585
COMPARE
345.52148
344.81592
COMPARE
345.31152
344.606
COMPARE
345.1016
344.39603
COMPARE
344.89163
344.18607
COMPARE
344.68167
343.9761
COMPARE
344.4717
343.7661
COMPARE
344.26172
343.55612
COMPARE
344.05173
OVER
OVER
两者的值也是非常的接近,不过这里线性关系已经占主要部分了;
- 微分方程数值解法(实际应用的改进)
- 微分方程数值解法(实际应用)
- 微分方程的数值解法——常微分方程——欧拉法与改进欧拉法(2)
- 微分方程(1)---微分方程的数值解法
- 常微分方程的数值解法
- 偏微分方程数值解法的MATLAB源码
- 微分方程的数值解法——常微分方程——差分法(1)
- 微分方程数值解法(欧拉方法)
- 常微分方程数值解法
- 数值分析 第七章 常微分方程的数值解法
- 数值偏微分方程解法分类
- 微分方程的Matlab解法
- 常微分方程的RK4解法
- 利用python画微分方程(组)的数值曲线
- 实验四 常微分方程的数值解(android)
- 数值作业:改进欧拉法求常微分方程C语言代码
- 欧拉法、预估校正法(改进的欧拉法)与四阶龙格库塔法求解常微分方程的数值解C++程序
- 一元方程的数值解法
- sigprocmask理解
- 利用form的“accept-charset”在不同编码的页面间提交表单
- sigsuspend()
- EDID
- 多线程写文件异常(正由另一进程使用,因此该进程无法访问该文件)的解决方法
- 微分方程数值解法(实际应用的改进)
- VirtualBox 32位系统上安装64位系统
- sigprocmask和sigsuspend转
- Redmine 1.1.2安装
- struts2 <s:action>标签的用法
- android 中超出屏幕宽度的字符 省略号显示
- datagrid的用法(持续添加中)
- Ubuntu 11.10 Alpha2 试用手记
- Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Info