Mon 25 Mar 2013 08:11:01 AM UTC, original submission:
Hello,
I'm having an issue with jacobs(x,f) in the optim package. The jacobs(x,f) method fails to generate the Jacobian for functions larger than n=2. I can reproduce this behavior by going through one of the examples in my Numerical Analysis 9th Edition Textbook by Burden and Faires (page 651):
jacobs(x,f) gives the following error message:
This is due specifically to these lines:
I was able to copy the relevant portions of the code and by replacing "idx(2:end)" with "idx(2:end)'" (I added the Transpose symbol), the correct result was achieved and verified by the example in the book, where "jac(x,f)" is the modified "jacobs(x,f)" method:
octave:23> jac(x,f)
ans =
3.0000e+00 9.9998e-04 -9.9998e-04
2.0000e-01 -3.2400e+01 9.9500e-01
-9.9005e-02 -9.9005e-02 2.0000e+01
I looked into the latest version of the optim package (1.2.2) on this site as well as the one residing in the Arch Linux AUR (1.2.2-1) and was able to reproduce the same bug (the jacobs.m files are exactly the same). The version of Octave in the Arch Linux "extra" repository is marked "out-of-date" (3.6.3-2), so I'm not sure if this is the cause of the error or not, but I think it should be looked into further. Forgive me if the patch file is not correct, I'm pretty new to open-source contributing.
Thank you for your time.
- Hershal
|