bugGNU Octave - Bugs: bug #57508, Add an example for calling lsode

 
 

bug #57508: Add an example for calling lsode

Submitted by:  Kai Torben Ohlhus <siko1056>
Submitted on:  Tue 31 Dec 2019 02:59:53 AM UTC  
 
Category:  Documentation Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 08 Jun 2021 05:39:34 AM UTC, comment #7: 

Finally I used the "standard" minimal Van der Pol example used in ode45, ode23, and elsewhere.  This might also highlight the differences between calling lsode and odeXX functions.

See this cset for Octave 6.3 https://hg.savannah.gnu.org/hgweb/octave/rev/f82a1bc641b8

Closing as fixed.

Kai Torben Ohlhus <siko1056>
Project Member
Wed 05 Feb 2020 08:09:40 PM UTC, comment #6: 

The mini-example does immediately follow the DOCSTRING for lsode_options.  There is already a cindex (concept index) entry to this location under the keyword "oregonator".

One option would be to put a sentence like this in the documentation for lsode

For an example of using @code{lsode} try @code{doc oregonator}.

If this were the case, we might want to move the cindex location to be above the sentence which begins "Here is an example".

Also, the function file oregonator.m exists in the examples/code directory.  Maybe we want to start packaging this file in the distributed tar.gz as we do for some other files like penny.mat.

Other possibilities include swapping oregonator for the Van der Pol oscillator model since this is more well known.

Rik <rik5>
Project Administrator
Wed 05 Feb 2020 07:37:01 PM UTC, comment #5: 

In the user manual (doc lsode_options) there is already a "hello world" mini example. It is however not displayed when "help lsode_options" is issued. I think it is diffeq.txi.

Hg200 <hg200>
Wed 05 Feb 2020 06:15:36 PM UTC, comment #4: 

I think this bug is talking about adding an example block to the user manual in Texinfo format that can be copy-pasted if the user wants, not a runnable %!demo block.

Mike Miller <mtmiller>
Project Administrator
Wed 05 Feb 2020 06:08:54 PM UTC, comment #3: 

ahh - copyright missing

(file #48355)

Hg200 <hg200>
Wed 05 Feb 2020 05:44:43 PM UTC, comment #2: 

lsode is implemented in ./libinterp/corefcn/lsode.cc. There is no .m to place the demo in. However "demo.m" states:

The preferred location for example code blocks is embedded within the script m-file immediately following the code that it exercises.  Alternatively, the examples may be stored in a file with the same name but no extension located on Octave's load path.

In the attached patch i have placed the Van der Pol Demo in a file called "lsode". Typing "demo lsode" looks like everything is working fine. If somebody can confirm this procedure?

(file #48354)

Hg200 <hg200>
Tue 31 Dec 2019 04:06:09 PM UTC, comment #1: 

Changes to the documentation can be made at any time.  Is this a particularly well-known ODE?  It might make sense to use an ODE that users may have encountered in their training.  The Van der Pol Oscillator is one such ODE (https://en.wikipedia.org/wiki/Van_der_Pol_oscillator).

Rik <rik5>
Project Administrator
Tue 31 Dec 2019 02:59:53 AM UTC, original submission:  

From the mailing-list https://lists.gnu.org/archive/html/help-octave/2019-12/msg00131.html

An example code using "lsode" for beginners...

"Test.m" calls the function file "ODE.m"

Content of "Test.m"

t = linspace (0, 50, 10);         % Time interval for integration
y0 = [ 4; 1.1; 4 ];                % Initial condition for Y(0)
B=[77.27 8.375e-06 0.161];        % Additional fixed parameters used in ODE
funct=@(y0,t)ODE(y0,t,B);        % create a function to supply to LODE
y = lsode (funct, y0, t)        % Call LODE to solve

Content of "ODE.m"

function y = ODE (x, t, B)

y = zeros (3,1);

y(1) = B(1) * (x(2) - x(1)*x(2) + x(1) - B(2)*x(1)^2);
y(2) = (x(3) - x(1)*x(2) - x(2)) / B(1);
y(3) = B(3)*(x(1) - x(3));

endfunction

Kai Torben Ohlhus <siko1056>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48354:  patch_lsode_demo.diff added by hg200 (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-08 siko1056 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2020-02-05 hg200 Attached File- => Added patch_lsode_demo_copyright.diff, #48355
    2020-02-05 hg200 Attached File- => Added patch_lsode_demo.diff, #48354

    Back to the top


    Powered by Savane 3.7