Giter Club home page Giter Club logo

Comments (8)

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

Is it possible for Newton's method to solve the nonlinear system when it has more constraints than variables? I think you'd generally have to interpret it in the L2 sense instead?

from boundaryvaluediffeq.jl.

homocomputeris avatar homocomputeris commented on June 16, 2024

Well, yeah.
Does DiffEq exclusively use Newton's? BVP solvers use NLsolve, don't they? Does NLsolve provide anything else like Matlab's fsolve?

Basically, my question comes from adapting a Matlab cruft for the problem in #52 which is solved with fsolve. I hoped I could use the high-level abstractions of BVP instead of rewriting everything.

Sorry for double posting here and on Gitter. Could you consider mentioning this dimension match thing in the docs?

from boundaryvaluediffeq.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

Does DiffEq exclusively use Newton's? BVP solvers use NLsolve, don't they? Does NLsolve provide anything else like Matlab's fsolve?

Does fsolve allow systems with more equations than variables? What algorithm is it using there? If it's possible we'll get it done.

from boundaryvaluediffeq.jl.

homocomputeris avatar homocomputeris commented on June 16, 2024

To be honest, I'm not familiar with the depths of Matlab. It seems that fsolve with Levenberg–Marquardt (which multiplies J by its transpose, so non-square systems is not a problem) is automatically used to solve such problems:

function F = root2d(x)
F(1) = exp(-exp(-(x(1)+x(2)))) - x(2)*(1+x(1)^2);
F(2) = x(1)*cos(x(2)) + x(2)*sin(x(1)) - 0.5;
F(3) = x(1)^2 + x(2)^2 - 2;
end
clear all;
fun = @root2d;
x0 = [0,0];
x = fsolve(fun,x0)
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead. 
> In fsolve (line 316) 

No solution found.

fsolve stopped because the last step was ineffective. However, the vector of function
values is not near zero, as measured by the value of the function tolerance. 
x =    0.2447    1.3199

The algorithm I'm translating to Julia, fsolve ise used to minimize the 2-point BVP residual with 7 values fixed on the left and 7 on the right (14 BCs total) while the state vector has dimension 13, so there are 6 variables to find. And for that problem it produces realistic results.

Matlab references:

  • Levenberg, K., “A Method for the Solution of Certain Problems in Least-Squares,” Quarterly Applied Mathematics 2, pp. 164-168, 1944.
  • Marquardt, D., “An Algorithm for Least-squares Estimation of Nonlinear Parameters,” SIAM Journal Applied Mathematics, Vol. 11, pp. 431-441, 1963.
  • Moré, J. J., “The Levenberg-Marquardt Algorithm: Implementation and Theory,” Numerical Analysis, ed. G. A. Watson, Lecture Notes in Mathematics 630, Springer Verlag, pp. 105-116, 1977.

from boundaryvaluediffeq.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

Yeah that's an L2 minimization, not a linear solve, which gives "exact" f(x)=0. That might be the only way to interpret it though?

from boundaryvaluediffeq.jl.

homocomputeris avatar homocomputeris commented on June 16, 2024

If this 'non-exact' solution eventually satisfies the BVP, it should be fine, I think.

from boundaryvaluediffeq.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

@YingboMa have you looked into this?

from boundaryvaluediffeq.jl.

avik-pal avatar avik-pal commented on June 16, 2024

This is handled currently. The user needs to pass in an NLLS solvers. Eventually once we have default solvers for NLLS in NonlinearSolve, the switching will be automatic!

from boundaryvaluediffeq.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.