学习newton raphson and back eluer
% % time step https://ww2.mathworks.cn/matlabcentral/answers/184200-newton-raphson-loop-for-backward-euler
% h = (t_final - t_init)/n; % with n number of time steps
% % vectors
% t = [tinit zeros(,n)]; % time
% y = [yinit zeros(,n)]; % solution
% % Backward Euler loop
% for i = :n
% t(i+) = t(i) + h;
% y_temp = y(i) + h(f(t(i), y(i)));
% y(i+) = y(i) + h*f(t(i+), y_temp);
% end
% for i = :n
% error = ;
% tolerance = 1e-;
% t(i+) = t(i) + h;
% y_temp = y(i) + h*(f(t(i), y(i)));
% while error >= tolerance
% y(i+) = y(i) + h*f(t(i+), y_temp);
% error = abs(y(i+) - y_temp) % (local) absolute error
% y_temp = y(i+);
% end
% end % yold = y(i)+h*f(t(i),y(i));
% while error >= tolerance
% ynew = yold-(yold-(y(i)+h*f(t(i+),yold)))/(-h*df(t(i+),yold));
% error = abs(ynew-yold);
% yold=ynew;
% end
% y(i+) = ynew; %y'=y+2*x/y^2 x=[0,2] y(0)=1 https://wenku.baidu.com/view/d18cdaa10b4c2e3f5627632f.html
t_final=;
t_init=;
n=;
tolerance=0.0000001
h = (t_final - t_init)/n;
ti=t_init+h;
yold=+h*f(,);% yold = y(i)+h*f(t(i),y(i));
while error >= tolerance
ynew = yold-(yold-(y(i)+h*f(t(i+),yold)))/(-h*df(t(i+),yold));
error = abs(ynew-yold);
yold=ynew;
end
y(i+) = ynew;
上面代码应该怎样修改?
学习newton raphson and back eluer的更多相关文章
- Jacobian矩阵、Hessian矩阵和Newton's method
在寻找极大极小值的过程中,有一个经典的算法叫做Newton's method,在学习Newton's method的过程中,会引入两个矩阵,使得理解的难度增大,下面就对这个问题进行描述. 1, Jac ...
- Newton's method Drawback and advantage
Newton Raphson Method: Advantages and Drawbacks: v=QwyjgmqbR9s" target="_blank"& ...
- Boosting(提升方法)之GBDT
一.GBDT的通俗理解 提升方法采用的是加法模型和前向分步算法来解决分类和回归问题,而以决策树作为基函数的提升方法称为提升树(boosting tree).GBDT(Gradient Boosting ...
- C++函数式编程实现牛顿法
In numerical analysis, Newton's method (also known as the Newton–Raphson method), named after Isaac ...
- Generalized normal distribution and Skew normal distribution
Density Function The Generalized Gaussian density has the following form: where (rho) is the " ...
- Tree - XGBoost with parameter description
In the previous post, we talk about a very popular Boosting algorithm - Gradient Boosting Decision T ...
- Tree - Gradient Boosting Machine with sklearn source code
This is the second post in Boosting algorithm. In the previous post, we go through the earliest Boos ...
- OpenCASCADE解非线性方程组
OpenCASCADE解非线性方程组 eryar@163.com Abstract. 在科学技术领域里常常提出求解非线性方程组的问题,例如,用非线性函数拟合实验数据问题.非线性网络问题.几何上的曲线曲 ...
- Apply Newton Method to Find Extrema in OPEN CASCADE
Apply Newton Method to Find Extrema in OPEN CASCADE eryar@163.com Abstract. In calculus, Newton’s me ...
随机推荐
- 经典笔试题型----IT经理(IT Manager)
一般企业设置IT部门都是服务性质,虽然谈IT需要成为战略部门许多年,但用脑子想下,这概率有多少?企业存在的第一目标是:赚取利润.贸易型企业最重要的部门为销售部,生产型企业最重要的部门为销售部与生产部, ...
- impala daemon启动失败
启动错误日志: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: ...
- ffmpeg 编译
下载FFmpeg git clone https://git.ffmpeg.org/ffmpeg.git 配置编译FFmpeg ./configure --prefix=host --enable-s ...
- Android Studio设置连续按两次退出APP
主要是在onKeyDown方法中进行操作,直接上代码. private long mTime; @Override public boolean onKeyDown(int keyCode, KeyE ...
- js中的数值转换
js中有3个函数可以把非数值转换为数值:Number().parseInt().parseFloat().其中Number()可以用于任何数据类型.parseInt()及parseFloat()用于将 ...
- SpringBoot 之jsp
Boot 内嵌的tomcat 是不支持jsp 的, jetty 也是. 虽然boot也是有默认配置一个InternalResourceViewResolver ,但是它并不像我们在springmvc ...
- leetcode621
public class Solution { public int LeastInterval(char[] tasks, int n) { Dictionary<char, int> ...
- EasyARM-iMX283A的make menuconfig出现错误:Install ncurses(ncurses-devel) and try again。
lin@lin-machine:~/linux-2.6.35.3$ make menuconfig *** Unable to find the ncurses libraries or the ** ...
- python Django 无法获取post 参数问题
对于 request.POST.get(name) 方式取值,需要 from 表单提交数据,如果 是ajax 提交数据,则需要做如下设置: 1.设置请求头,以from表单方式传值 'Content-T ...
- 在C++程序中自动加入svn版本号
原创文章,欢迎阅读,如果您想转载,请在第一行醒目注明原作者和原始链接. 为了方便追查和确认软件bug等问题,给软件或者库赋予版本号是个好办法. 最简单的版本号管理是记录编译时间: cout<&l ...