bugGNU Octave - Bugs: bug #45871, fsolve. different output octave...

 
 

bug #45871: fsolve. different output octave and matlab

Submitter:  None
Submitted:  Thu 03 Sep 2015 08:41:37 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 14 Sep 2015 10:12:42 PM UTC, comment #6: 

Octave is free software and the full source code is available for you to inspect and debug all you want. To view the fsolve function in your running Octave session, just enter "type fsolve". The full source is available for download from the Octave web site.

I can't say the same for Matlab. If you are a Matlab customer you should be able to view the source of some of their functions, but you cannot share the code or anything you learn by reading the source code with us or anyone else who is not a Matlab customer.

If you want to investigate your model further on your own, please feel free, but if you want us to treat this as an Octave bug, we'll need some specific test case using fsolve directly that shows the error or difference from Matlab behavior that we can reproduce.

Mike Miller <mtmiller>
Group Member
Mon 14 Sep 2015 05:24:45 PM UTC, comment #5: 

Hello Mike.

Is it really (my Octave  version is 3.8.1).?  because it wasn't working, and to be honest it isn't working for all values that I'm looking at. Do you know how I could see the script of the function, for both matlab and octave?

Thank you!

And about the older version of Octave, I can't use the stable version 4.0.0 because it isn't compatible with Dynare, which I need to use to run DSGE models (what I'm working with).

Anonymous
Sat 12 Sep 2015 06:46:41 PM UTC, comment #4: 

Matlab's help claims that the default MaxIter is 400, same as Octave. But if you are happy with the workaround you have working, we can close this bug.

Mike Miller <mtmiller>
Group Member
Fri 04 Sep 2015 06:05:51 PM UTC, comment #3: 

Hello John. Thanks for replying. Yes, dynare is needed. The whole problem was to solve a steady state model, which can only be done with dynare, with the help of the fsolve() function. But I just found what was wrong. It's in the options. Probably the default value of matlab is bigger than octave...the problem is that octave was stopping before finding the optimal value.

The code changed from : options=optimset('Display','iter','MaxFunEvals',200000,'TolFun',1e-8);  (in the mod_fiscal_04_ss_solve.m)

To

options=optimset('Display','iter','MaxFunEvals',200000,'TolFun',1e-8,'MaxIter',1000); 

I don't know if I was completely clear. If not, just rewrite so I can explain it better.

Anonymous
Fri 04 Sep 2015 11:28:27 AM UTC, comment #2: 

Also, 3.8.1 is old and no longer supported version of Octave.  Another useful test would be to upgrade to the stable version of Octave (version 4.0.0) and re-run the simulation.

Rik <rik5>
Group administrator
Thu 03 Sep 2015 11:15:23 PM UTC, comment #1: 

What does it mean that it 'doesn't "work"'?  What result do you expect?

Exactly what commands need to be executed to demonstrate the problem?

Is dynare required to run your code to show that fsolve is not working for you?  If so, can you eliminate that requirement somehow and simplify the example so it can be run with just Octave?

John W. Eaton <jwe>
Group administrator
Thu 03 Sep 2015 08:41:37 PM UTC, original submission:  

Hello, I'm working with a fiscal model in both matlab and octave (octave 3.8.1 and dynare version 4.4.3). My routine is to run a simulation file (simula_mod_fiscal_04_bre_02b.m), where I set the value of parameters and compute the steady state (calling mod_fiscal_04_ss_solve), prior to runing the .mod file. The idea is to variate the nr_i parameter (it can be 0.2, 0.4, 0.6) which stands for the proportion of non-ricardian agents (who work) in the economy. When I run this simulation file on matlab, it works perfectly. However, when running in octave, it doesn't "work" for nr_i = 0.2 and nr_i = 0.6 . I've checked the steady state values and they are equal for 0.4 but different for 0.2. Does anyone know why this is happening? The files (.m and .mod) are attached.

Thank you!!!!

p.s: I believe the problem is in the fsolve() function (found in the mod_fiscal_04d_ss_solve.m file)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #34808:  mod_fiscal_04_ss.m added by None (11KiB - application/octet-stream)
file #34809:  mod_fiscal_04d_ajs_tax.mod added by None (28KiB - video/mpeg)
file #34810:  mod_fiscal_04_ss_solve.m added by None (12KiB - application/octet-stream)
file #34811:  simula_mod_fiscal_04_bre_02b.m added by None (13KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-22 rik5 Open/ClosedOpen Closed
    2015-09-04 rik5 Carbon-CopyRemoved 72865 -
    2015-09-04 rik5 StatusNone Need Info
    2015-09-03 None Attached File- Added mod_fiscal_04_ss.m, #34808
        Attached File- Added mod_fiscal_04d_ajs_tax.mod, #34809
        Attached File- Added mod_fiscal_04_ss_solve.m, #34810
        Attached File- Added simula_mod_fiscal_04_bre_02b.m, #34811

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code