octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63925] 'lsqnonlin' ceases to converge from a


From: anonymous
Subject: [Octave-bug-tracker] [bug #63925] 'lsqnonlin' ceases to converge from a small change(Mathlab - OK)
Date: Tue, 14 Mar 2023 11:18:55 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?63925>

                 Summary: 'lsqnonlin' ceases to converge from a small
change(Mathlab - OK)
                   Group: GNU Octave
               Submitter: None
               Submitted: Tue 14 Mar 2023 03:18:52 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Leo
        Originator Email: forettro@gmail.com
             Open/Closed: Open
                 Release: 8.1.0
         Discussion Lock: Any
        Operating System: Microsoft Windows
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 14 Mar 2023 03:18:52 PM UTC By: Anonymous
tryed on 7.3.0, both OpenBLAS and Reference BLAS

# did't work (working only in Mathlab online):

fun = @(x)[ x(5) * 0.1 +  x(4) * 0.25 +  x(3) * 0.5 +  x(2) * 0.25 +  x(1) *
0.1 - 0.3;
x(6) * 0.1 +  x(5) * 0.25 +  x(4) * 0.5 +  x(3) * 0.25 +  x(2) * 0.1 -
0.62500001;
x(7) * 0.1 +  x(6) * 0.25 +  x(5) * 0.5 +  x(4) * 0.25 +  x(3) * 0.1 -
0.500000025;
x(8) * 0.1 +  x(7) * 0.25 +  x(6) * 0.5 +  x(5) * 0.25 +  x(4) * 0.1 -
0.22500005;
x(9) * 0.1 +  x(8) * 0.25 +  x(7) * 0.5 +  x(6) * 0.25 +  x(5) * 0.1 -
0.050000025000000003;
x(10) * 0.1 +  x(9) * 0.25 +  x(8) * 0.5 +  x(7) * 0.25 +  x(6) * 0.1 -
1e-08];
options = optimset("Display", "iter","FinDiffType" ,"central","MaxIter",
20000, "MaxFunEvals", 40000, "TolFun", 1e-39, "TolX", 1e-39);
x0 = [0.5,0.5,0.5,0.5,0.5,5e-08,2e-08,1e-08,2e-08,5e-08];
lb = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
ub =
[2.9999999999999996,1.2,0.6,1.2,0.50000025,1e-07,4e-08,2e-08,4e-08,1e-07];
[x,val] = lsqnonlin(fun, x0, lb, ub, options);

# Ideal estimated result
#   [0.0, 0.0, 0.0, 1.0, 0.5, 0.0000001, 0.0, 0.0, 0.0, 0.0]
# Mathlab online result, perfect
#   x: [0, 0, 0, 1.0000, 0.5000, 1.0000e-07, 2.2301e-17, 0, 0, 0]
#   val: 3.112467704292398e-33
# Octave result, to bad
#   x     [6.1062e-16, 0.32759, 0.42248, 0.46753, 0.48734, 1e-07, 5.7973e-16,
1.099e-16, 4e-08, 2.4127e-15
#   val   0.055000


# working good (both in Octave and Mathlab online):

fun = @(x)[ x(5) * 0.1 +  x(4) * 0.25 +  x(3) * 0.5 +  x(2) * 0.25 +  x(1) *
0.1 - 0.3;
x(6) * 0.1 +  x(5) * 0.25 +  x(4) * 0.5 +  x(3) * 0.25 +  x(2) * 0.1 - 0.625;
x(7) * 0.1 +  x(6) * 0.25 +  x(5) * 0.5 +  x(4) * 0.25 +  x(3) * 0.1 - 0.5; 
x(8) * 0.1 +  x(7) * 0.25 +  x(6) * 0.5 +  x(5) * 0.25 +  x(4) * 0.1 - 0.225;

x(9) * 0.1 +  x(8) * 0.25 +  x(7) * 0.5 +  x(6) * 0.25 +  x(5) * 0.1 - 0.05;
x(10) * 0.1 +  x(9) * 0.25 +  x(8) * 0.5 +  x(7) * 0.25 +  x(6) * 0.1 - 0.0];
options = optimset("Display", "iter","FinDiffType" ,"central","MaxIter",
20000, "MaxFunEvals", 40000, "TolFun", 1e-39, "TolX", 1e-39);
x0 = [0.5,0.5,0.5,0.5,0.5,0.0,0.0,0.0,0.0,0.0];
lb = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
ub = [2.9999999999999996,1.2,0.6,1.2,0.5,0.0,0.0,0.0,0.0,0.0];
[x,val] = lsqnonlin(fun, x0, lb, ub, options);

# Ideal estimated result
#   [0.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0]
# Mathlab online result, perfect
#   x: [0, 0, 0, 1, 0.5000, 0, 0, 0, 0, 0]
#   val: 0
# Octave result, good
# x     [1.3332e-16, 1.0417e-17, 2.189e-12, 1, 0.5, 0, 0, 0, 0, 0]
# val   6.782908519975903e-25


looks like some kind of crutch in the solver

Can i do somesthing with it?
(potentially ready to participate in the search for a problem if there is
introductory information on the code stack and localization)







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63925>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]