Newton-Raphson method with linear constraints

版本 1.1 (13.0 KB) 作者: Michael Mauersberger
Implementation of the Newton-Raphson method with linear constraints, increment damping and additional sweep points
22.0 次下载
更新时间 2023/12/19

newtRaph.m

A Matlab implementation of the Newton-Raphson method with linear constraints

(c) Michael Mauersberger 2021 (v0.1), 2023 (v1.0, v1.1), LGPL License v2.1

Newton-Raphson method with constraints for finding function roots. Damping coefficient helps to find a feasible solution. Number of sweep points help to set a new initial searching point on the axis between the minimum and maximum of the domain. Search ends if function tolerance or argument tolerance has been reached. Linear constraints are applied in the form A*x <= b via writing back the arguments to the constraint (done by means of QR decomposition and a pseudo-inverse).

References:

Wikipedia - "Newtonverfahren" (German), "Newton's method" (English)

View NewtRaphConMatlab on File Exchange

Examples

Damping coefficient

[xVal,fVal,it,ex] = newtRaph(@(x)(x.^3-2*x+2),0,[],[],[],[],1e-10,1e-10,100,.0,'cent',1e-10,2)
xVal = 8.2740e-08
fVal = 2.0000
it = 100
ex = -2

[xVal,fVal,it,ex] = newtRaph(@(x)(x.^3-2*x+2),0,[],[],[],[],1e-10,1e-10,100,.2,'cent',1e-10,2)
xVal = -1.7693
fVal = 7.6439e-11
it = 24
ex = 0

Linear constraint

[xVal,fVal,it,ex] = newtRaph(@(x)(5*(x(1)+1)^2+x(2)^2-2*x(2)),[0 1],[],[],[],[],1e-10,1e-10,100,.2,'forw',1e-10,2)
xVal = [-0.5528  1.0000]
fVal = 8.3129e-11
it = 16
ex = 0

[xVal,fVal,it,ex] = newtRaph(@(x)(5*(x(1)+1)^2+x(2)^2-2*x(2)),[0 1],[],[],[-1 -1],[-.8],1e-8,1e-10,100,.2,'forw',1e-10,2)
xVal = [-0.5878  1.3878]
fVal = 8.1014e-09
it = 64
ex = 0

Number of sweep points

[xVal,fVal,it,ex] = newtRaph(@(x)((x.^2-3)*(x-1)-5*exp(-100*(x+.5)^2)),0,-1,0,[],[],1e-8,1e-10,100,.2,'cent',1e-10,2)
xVal = -2.6000
fVal = 4.0000
it = 3
ex = -2

[xVal,fVal,it,ex] = newtRaph(@(x)((x.^2-3)*(x-1)-5*exp(-100*(x+.5)^2)),0,-1,0,[],[],1e-8,1e-10,100,.2,'cent',1e-10,4)
xVal = -0.4544
fVal = 7.1891e-09
it = 20
ex = 0

引用格式

Michael Mauersberger (2024). Newton-Raphson method with linear constraints (https://github.com/m-mauersberger/NewtRaphConMatlab/releases/tag/v1.1), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2022a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1

See release notes for this release on GitHub: https://github.com/m-mauersberger/NewtRaphConMatlab/releases/tag/v1.1

1.0

See release notes for this release on GitHub: https://github.com/m-mauersberger/NewtRaphConMatlab/releases/tag/v1.0

0.9

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库