A. Quarteroni, P. Gervasio, Aeolian
dolphins, heartbeats, and search engines
Image by Wolfgang Zimmel from Pixabay


Alfio Quarteroni, Paola Gervasio
A Primer on Mathematical Modelling
Series La Matematica per il 3+2, vol. 121
Springer International Publishing
2020
Octave functions and scripts

The Octave software is of great value whilst reading the book. For this reason we are making available a number of ready-to-use programs that, by typing simple commands, allow to analyse the numerical results and plots described in the text.

In order to execute these programs it is necessary to install Octave, a freely distributed software.




Instructions for Windows
  1. Download the file QG_functions_scripts.zip here and unzip it.
  2. Move the folder QG_functions_scripts from the folder Download to a folder of your choice on your computer. For example, we moved it in our User folder.
  3. In a browser search www.octave.org and click "Download"

  4. Click on "Windows" in the menu at the top of the page



    and click on the link installer.exe that is right for your computer. We chose the first link in the list, which refers to the latest Octave version, and started downloading.
  5. Install Octave by following Windows' instructions.
  6. Launch Octave. Various pop-ups appear, but just continue. At the end the application's window opens:

  7. Find in the left menu the "QG_functions_scripts" folder and click on it twice.

  8. In the top "Current Folder" bar you will see the complete path of the folder you're in.
    We are in "C:\Users\maria\QG_functions_scripts"

  9. Click in "Command Window", next to the symbol >> (called prompt), and type
    hello
    then press Enter.



    If everything was done correctly up to this point, the Command Window will display
    "Welcome, we are ready to work together"
    and right afterwards the Octave prompt >> appears.



    If instead you read:
    error: 'hello' undefined near line 1 column
    it means you are not currently in the QG_functions_scripts folder, so you should go back to step 7.
  10. There is another check you can make: type in the Command Window (next to the prompt)
    hakes_sharks(1000)
    and then press Enter. If all is ok, two windows open that show Figures 6.21 and 6.22 of the book (pages 190 and 191).
  11. To quit Octave write
    exit
    in the Command Window, and then press Enter.
    The complete sequence must be executed only the first time. Afterwards it suffices to launch Octave and execute step 7.
Top




Instructions for Mac
  1. Download the file QG_functions_scripts.zip here and unzip it.
  2. Move the folder QG_functions_scripts from the folder Downloads to a folder of your choice on your computer. For example, inside the Documents folder, we generated the Octave folder and we moved the QG_functions_scripts folder inside the Octave folder.
  3. In a browser, search octave-app.org and click "Download".
  4. Click on the link "Octave-4.4.1.dmg" to begin the download.

  5. Once this has finished, click on the Download folder's icon in your Mac's tool bar and select "Open in Finder".
  6. Click on "Octave-4.4.1.dmg" twice. In the pop-up window click "Agree" if you accept the licence agreements.
  7. Another pop-up appears, and shortly afterwards a new window "GNU Octave".

    Drag the "Octave-4.4.1" icon (to the left of the orange arrow) onto the folder "Applications" (to the right of the orange arrow) and wait for Octave to be copied and installed. In the meantime you'll see a pop-up with "Preparing to copy...", and then another one with "Copying Octave-4.4.1".
    Once this is done, you can close the windows.
  8. In the Applications folder (in the Finder), simultaneously press the keyboard button "control" and click on the icon Octave-4.4.1, then select "Open":

    Warning: double-clicking here doesn't work, for it won't allow Octave to start properly the first time over. You'll be able to open Octave by double-clicking only starting from the second time.
  9. You will see a small pop-up with "Verifying Octave-4.4.1" and after one minute or so, another pop-up with "Octave-4.4.1 is an application downloaded from the internet. Are you sure you want to open it?".
    Click on "Open" and wait a couple of minutes. If nothing happens after that, doble-click on the Octave-4.4.1 icon.
  10. A new pop-up appears saying "Welcome to Octave",

    continue by clicking on "Next", accept (or not) to receive news from the Octave website, click again on "Next" and then "Finish".
  11. This Octave window opens:
  12. Find in the left menu the QG_functions_scripts folder (we select Documents and then Octave) and double-click on it. In the top "Current Folder" bar you will see the complete path of the folder you're in.
    We are in "/Users/maria/Documents/Octave/QG_functions_scripts".
  13. Click in "Command Window", next to the symbol >> (called prompt), and type
    hello
    then press Enter.
    If everything was done correctly up to this point, the Command Window will display
    "Welcome, we are ready to work together"
    and right afterwards the Octave prompt >> appears.

    If instead you read:
    error: 'hello' undefined near line 1 column
    it means you are not currently in the QG_functions_scripts folder, so you should go back to step 12.
  14. There is another check you can make: type in the Command Window (next to the prompt)
    hakes_sharks(1000)
    and then press Enter. If all is ok, two windows open that show Figures 6.21 and 6.22 of the book (pages 190 and 191).
  15. To quit Octave write
    exit
    in the Command Window, and then press Enter.
    The complete sequence must be executed only the first time. Afterwards it suffices to launch Octave and execute step 12.
  16. Top




    Instructions for Linux
    1. Download the file QG_functions_scripts.zip here and unzip it.
    2. Move the folder QG_functions_scripts from the folder Download to a folder of your choice on your computer. For example, we moved it in the folder /home/gerva/Octave
    3. Download the latest version of Octave through the update software of your Linux distributor. In Ubuntu, for instance, you will need to execute the command
      sudo apt-get install octave
      while in Fedora you should type
      sudo dnf install octave
    4. Launch Octave by either clicking in its icon or writing
      octave
      in a shell (the first time you do this there will be welcome pop-ups, but just continue with the installation). Once the installation is complete the Octave window opens:

    5. Search in the left menu for the folder "QG_functions_scripts" and select it by clicking on it twice.

    6. In the upper "Current directory'' bar you will find the full path of the folder you're in.
      We are in "/home/gerva/Octave/QG_functions_scripts".

    7. Click in "Command Window", next to the symbol >> (called prompt), and type
      hello
      then press Enter.



      If everything was done correctly up to this point, the Command Window will display
      "Welcome, we are ready to work together"
      and right afterwards the Octave prompt >> appears.



      If instead you read:
      error: 'hello' undefined near line 1 column
      it means you are not currently in the QG_functions_scripts folder, so you should go back to step 5.
    8. There is another check you can make: type in the Command Window (next to the prompt)
      hakes_sharks(1000)
      and then press Enter. If all is ok, two windows open that show Figures 6.21 and 6.22 of the book (pages 190 and 191).
    9. To quit Octave write
      exit
      in the Command Window, and then press Enter.
      The complete sequence must be executed only the first time. Afterwards it suffices to launch Octave and execute step 5.


    10.     Paola Gervasio   -   March 2020 Valid HTML 4.01 Transitional