ODE_Solver - Excel Add-In for Solving Ordinary Differential Equations

See Also: Exporting Differential Equations from Polymath to Excel  Exporting from Polymath to Excel  Differential Equations Solver


 

The Add-In file name is ODE_Solver.xla

 

This Polymath ODE_Solver Add-In enables simultaneous ordinary differential equations to be solved within Microsoft Excel.  The needed file for this Polymath option is stored in the Program Files\Polymath Software\Polymath Professional\ directory during installation of Polymath. This Add-In must be installed within Excel as discussed below.

 

 


 

Installation of the ODE_Solver Add-In

 

Background:

  1. This Add-In requires the use of Excel 2000 or later versions.  Note that earlier versions of Excel will not support the ODE_Solver Add-In.

  2. The Polymath program setup will install the files listed above in the Program Files\Polymath Software\Polymath Professional\ directory OR another directory was specified during the Polymath installation.

Installation Steps:

 

  1. When signed on as Administrator, copy the ODE_Solver.xla from the installation directory (usually C:\Program Files\Polymath Software\Polymath Professional\) to locations according to:

    Office 2000 – C:\Program Files\Microsoft Office\Office\Library

    Office XP&2002 - C:\Program Files\Microsoft Office\Office10\Library

    Office 2003 - C:\Program Files\Microsoft Office\Office11\Library

               

Example for Office XP - From:

 

 

            To:

 

 

  1. This will make the ODE_Solver Add-In available to all Excel users as shown below under the Tools drop-down menu in Excel.

 

  1. Please not that there may be interferences at times between the ODE_Solver and Solver.  It is suggested that only one of these two Add-Ins be active at a time by using the Add-In selection shown above.

Alternate Installation

You may also use the option under the Tools drop-down menu in Excel to 'Browse' for the ODE_Solver Add-In which can be identified in the directory specified during installation which is usually C:\Program Files\Polymath Software\Polymath Professional\.  The identification of ODE_Solver in this manner will make it available to Excel for the current user.  Note that there may be interferences between Ode_Solver and Solver Add-in such that the Solver Add-in may not work properly.  In this case, please only check the Add-In you desire to use in the 'Add-In' window under Tools drop-down menu in Excel shown above.

Running the ODE Solver with Problem Exported from Polymath

 

The details of using the ODE_Solver Add-In with an exported problem from Polymath into Excel are available from  Exporting Differential Equations from Polymath to Excel.

 

Setting up the ODE Solver for an Excel Problem that has not been Exported from Polymath

 

The ODE_Solver can be used independently of the Polymath program.  This allows Excel users to solve simultaneous ordinary differential equations that have been formulated in an Excel worksheet.  The Polymath ODE entry window for the current  problem information, shown below, becomes visible when the 'Polymath ODE...' Add-In is selected from the Excel Tools drop-down menu.

 

 

The problem solution specification requires that the following continuous groupings of cells, a single cell, and a single value within a problem worksheet:

  1. ODE (Ordinary Differential Equations) initial values vector - This vertical selection of continuous cells in the same column must contain the initial values of the respective dependent variables in the simultaneous ordinary differential equations.  Note that each ODE must have an initial value specified.

  2. ODE equations vector - This vertical selection of continuous cells must contain the respective set of ordinary differential equations for the problem.

  3. Differential variable cell - This is the storage cell for the independent variable for the set of ordinary differential equations.

  4. Differential variable final value - A numerical value for the final value of the independent variable must be entered.

  5. Intermediate Cells to Store - This optional selection of continuous cells contains the problem variables that should be calculated during the numerical solution of the ODE's as the independent variable is varied from the initial to the final value.

Note that placement of the cursor within a input site in the Polymath ODE entry window allows one to use the mouse to conveniently identify a group of cells or an individual cell.

 

Show Report - When checked, this automatically produces a new worksheet in the current workbook that contains the current ODE problem solution.

 

Data Points - This value indicates the desired number of data points where the the problem variables and the 'Intermediate Cells to Store' are to be automatically calculated and stored within the Report worksheet as a table.

 

 

Using the ODE Solver for an Example Excel Problem

 

This example involves a simple set of simultaneous ordinary differential equations and explicit variables that is given by:

 

d(CA)/d(t) = -k1 * CA

CA(0) = 10

d(CB)/d(t) = k1 * CA - k2 * CB

CB(0) = 0

d(CC)/d(t) = k2 * CB

CC(0) = 0

k1 = 2

k2 = 4

xA = (10 - CA) / 10

t0 = 0

tf = 3

 

 

An Excel workbook with this equation entered into a worksheet is shown below.  Selection of the Polymath ODE_Solver Add-In results in the Polymath ODE input window where the problem solution specification has been completed.

 

 

A mouse click on the 'Solve' button initiates the solution proceeds, and the various values in the cells are updated during the numerical integration process. The final values are shown below.

 

 

The Polymath ODE_Solver Report is automatically generated on a new worksheet titled 'DEQ Solution (1)' which is shown below where the variable names have been copied from the original problem worksheet.

 

 

The Intermediate data points can be graphed within Excel as shown below:

 

 

Subsequent execution of the Polymath ODE_Solver will produce additional worksheets with the corresponding problem solution numbers. 

 

ODE_Solver Window:   The 'Reload' button will restore the settings for a previous integration  with the exception of the 'Intermediate Cells to Store'. 

The 'Adv.' button will allow selection of a desired numerical integration algorithm and adjustment of the methods parameters as shown below.

The default algorithm of RKF45 is very robust and very suitable for most problems.