[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fsolve() nasty bug ?
From: |
Christophe Prud'homme |
Subject: |
Re: fsolve() nasty bug ? |
Date: |
Fri, 21 Apr 2006 17:38:38 +0200 |
User-agent: |
KMail/1.9.1 |
Hi John
thanks for answering
| I don't see how this can happen.
I know! that's why I sent an email asking for explanation
| In src/DLD-FUNCTIONS/fsolve.cc, the
| following code is the only use of the nonlinear equation solving object:
|
| NLEqn nleqn (x, nleqn_fcn);
| nleqn.set_options (fsolve_opts);
|
| octave_idx_type info;
| ColumnVector soln = nleqn.solve (info);
|
| if (fcn_name.length())
| clear_function (fcn_name);
| if (jac_name.length())
| clear_function (jac_name);
|
| if (! error_state)
| {
| std::string msg = nleqn.error_message ();
|
| retval(2) = msg;
| retval(1) = static_cast<double> (hybrd_info_to_fsolve_info (info));
|
| retval(0) = soln;
|
| if (! nleqn.solution_ok () && nargout < 2)
| error ("fsolve: %s", msg.c_str ());
| }
|
| I don't see how there could possibly be a difference among any of
|
| x = fsolve (...);
| [x, info] = fsolve (...);
| [x, info, msg] = fsolve (...);
Yes I 100% agree. However testing the code with octave 2.1.73 and 2.9.5 under
debian, shows that it matters to get fsolve converging (hence 'nasty')
|
| since the code path is exactly the same and INFO is computed and returned
| whether or not you ask for it.
|
| Also, in the code you sent, the only calls to fsolve that I see are
|
| | for the_t=tt(2:end)
| | if ( exist('OCTAVE_VERSION') )
| | [w, info] = fsolve("myfun",the_y);
| | else
| | w = fsolve('myfun',the_y,options);
| | end
| | u = [u w];
| | the_y = w;
| | end
|
| so when running your code with Octave, it seems that only one case is
| tested. Or am I missing something here?
yes the other case is for matlab (ie when OCTAVE_VERSION does not exist)
I edited the files a bit and made it clearer by removing the matlab parts.
now if I try in cranknc,
w =fsolve(...)
and
[w info]=fsolve() or [w info msg]=fsolve()
the first case fails, the second and third succeed
|
| If you think there is a bug, please submit a complete bug report to
| the address@hidden list with an example that clearly demonstrates the
| problem (it would help if you could eliminate the on-the-fly creation
| of a function from another function if that is not central to the bug
| report).
There is a bug (100% reproducible on different debian installations/distros at
least) and I will fill a bug report ASAP.
Best regards
C.
--
Christophe Prud'homme
EPFL SB IACS CMCS
MA B2 534 (Bâtiment MA)
Station 8
CH-1015 Lausanne
Tel: +41 (0)21 693 25 47
Fax: +41 (0)21 693 43 03
cranknic.m
Description: Text Data
cranknic_test2.m
Description: Text Data