[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help-octave Digest, Vol 45, Issue 10
From: |
Jaroslav Hajek |
Subject: |
Re: Help-octave Digest, Vol 45, Issue 10 |
Date: |
Mon, 7 Dec 2009 21:15:21 +0100 |
On Mon, Dec 7, 2009 at 8:19 PM, Bart Vandewoestyne
<address@hidden> wrote:
> On Mon, Dec 07, 2009 at 09:02:51AM -0600, address@hidden wrote:
>>
>> The style of supplying Jacobian is not supported in the 3.2 version of
>> fsolve. Instead, one should use the Matlab-compatible style:
>>
>> function [y,J] = f_3d(x)
>>
>> y(1) = 16*x(1)^4 + 16*x(2)^4 + x(3)^4 - 16;
>> y(2) = x(1)^2 + x(2)^2 + x(3)^2 - 3;
>> y(3) = x(1)^3 - x(2);
>>
>> if (nargout > 1)
>> J = zeros(3,3);
>> J = [64*x(1)^3 64*x(2)^3 4*x(3)^3; ...
>> 2*x(1) 2*x(2) 2*x(3); ...
>> 3*x(1)^2 -1 0];
>> endif
>>
>>
>> I think this style is preferable not only because of
>> Matlab-compatibility, but also because y and J are usually closely
>> related. It wouldn't be hard to support also the old version, but the
>> fact is that it is not there, because nobody asked for it.
>
> OK. Thanks. In the meanwhile, i also found that this was the
> solution to my problem.
>
>> Apparently the manual wasn't updated. But it has the docstring
>> included; so you should pay attention to that.
>
> I'm afraid I don't understande what you mean here. Can you
> explain a bit?
>
> Kind regards,
> Bart
>
The fsolve function was completely rewritten as an m-file between 3.0
and 3.2. Matlab compatibility was a major point; also the rewrite
removed some limitations of the old MINPACK wrapper and adds a number
of improvements.
The function's docstring (as displayed by "help fsolve") is
up-to-date, because I rewrote it along the code change;
but apparently I missed the extra examples in the manual.
This is general: when a function is rewritten or significantly
modified, the docstring is easily updated because it's in the same
file. Scanning through the manual for other leftovers is something I
typically put off till later; then forget about it :)
Now the question is: should we add back the support for address@hidden, @jac}
style?
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz