Only now did I notice that you were not replying to the octave-forge mailing-list. Always do so so that others can comment on this:
On 30 November 2011 13:29, Júlio Maranhão <ju...@maranhao.us> wrote: >On 29 November 2011 17:56, Carnë Draug <carandraug+...@gmail.com> wrote: >> On 29 November 2011 16:05, Júlio Maranhão <ju...@maranhao.us> wrote: >>> On Sun, Nov 27, 2011 at 00:44, Carnë Draug <carandraug+...@gmail.com> wrote: >>>> This problem in irr() has been fixed in the development version. >>> >>> Uhhhh, yes. I also noted that it also uses a non-zero initial value >>> for fsolve(). >>> >>>> I believe I may have fixed your issue. The problem is indeed with the >>>> way fsolve is being called. Could you please test the attached >>>> function file? >>>> >>>> The way to fix this is something like: >>>> f = @(x) pv (x, n, p, l, m) - v; >>>> r = fsolve (f, 0); >>> >>> Ok, it almost works. As in irr(), the initial value cannot be zero. >>> So, "r = fsolve(f, 0.01)" is an option that works. Examples: >>> >>> octave:1> rate(30, 510.19, 10000) ---> fsolve(f, 0) >>> ans = 0.019085 ---> wrong >>> octave:1> rate(30, 510.19, 10000) ---> fsolve(f, 0.01) >>> ans = 0.030000 ---> right >> >> What version of octave are you using? The latest stable release is >> 3.4.3 (and 3.6 should be out soon). Using 0 as initial value for >> fsolve will still return 0.03 for me, as you said it should. this >> seems to be the same in irr, changing from 0.01 to 0 still works fine: > > Unfortunately I am using Ubuntu which uses 3.2 series. So I cannot > test with 3.4 series. But I am really considering moving away from > Ubuntu as I just verified that 3.2 series is not maintained by Octave > (from repo logs) and Fedora uses the latest version. Look! pre-compiled octave binaries for ubuntu http://octave.org/wiki/index.php?title=Octave_for_GNU_Linux:_Binary_Octave_packages_for_GNU_Linux#Ubuntu >> octave> irr([-100000 10000 20000 30000 40000 50000]) >> ans = 0.12006 >> >>> Thank you for help me fix my installation. >>> And as you are fixing the HEAD, look at rate.m, line 43. It is "v" instead. >> >> I ended up changing more stuff at input check. And I also improved the >> help text to document the possibility to skip the `l' argument and >> specify only the optional `method'. I don't have no opinion about whether I should change initial value for fsolve or not. It's working fine in the latest and I'm guessing it should be 0 for all. Carnë ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev