Xcos help : Added a page to help the user choose a solver 85/9985/25
Paul BIGNIER [Tue, 11 Dec 2012 09:25:59 +0000 (10:25 +0100)]
Explained how to select the solver type
Numerically compared them on various examples

Change-Id: Iebca647677a0e83abf960865bac274c74dec8800

15 files changed:
scilab/modules/helptools/images/9-Comparisons_1.png [new file with mode: 0644]
scilab/modules/helptools/images/9-Comparisons_2.png [new file with mode: 0644]
scilab/modules/helptools/images/9-Comparisons_3.png [new file with mode: 0644]
scilab/modules/helptools/images/Controller.xcos.png [new file with mode: 0644]
scilab/modules/helptools/images/Kalman.xcos.png [new file with mode: 0644]
scilab/modules/xcos/examples/solvers/benchBasic.sce [new file with mode: 0644]
scilab/modules/xcos/examples/solvers/benchKalman.sce [new file with mode: 0644]
scilab/modules/xcos/examples/solvers/benchSinus.sce [new file with mode: 0644]
scilab/modules/xcos/help/en_US/solvers/0-LSodar.xml
scilab/modules/xcos/help/en_US/solvers/1-CVode.xml
scilab/modules/xcos/help/en_US/solvers/2-Runge-Kutta.xml
scilab/modules/xcos/help/en_US/solvers/3-Dormand-Prince.xml
scilab/modules/xcos/help/en_US/solvers/4-ImplicitRK.xml
scilab/modules/xcos/help/en_US/solvers/7-IDA.xml
scilab/modules/xcos/help/en_US/solvers/9-Comparisons.xml [new file with mode: 0644]

diff --git a/scilab/modules/helptools/images/9-Comparisons_1.png b/scilab/modules/helptools/images/9-Comparisons_1.png
new file mode 100644 (file)
index 0000000..13eb7a8
Binary files /dev/null and b/scilab/modules/helptools/images/9-Comparisons_1.png differ
diff --git a/scilab/modules/helptools/images/9-Comparisons_2.png b/scilab/modules/helptools/images/9-Comparisons_2.png
new file mode 100644 (file)
index 0000000..5bf54ea
Binary files /dev/null and b/scilab/modules/helptools/images/9-Comparisons_2.png differ
diff --git a/scilab/modules/helptools/images/9-Comparisons_3.png b/scilab/modules/helptools/images/9-Comparisons_3.png
new file mode 100644 (file)
index 0000000..75a14d0
Binary files /dev/null and b/scilab/modules/helptools/images/9-Comparisons_3.png differ
diff --git a/scilab/modules/helptools/images/Controller.xcos.png b/scilab/modules/helptools/images/Controller.xcos.png
new file mode 100644 (file)
index 0000000..818aeb4
Binary files /dev/null and b/scilab/modules/helptools/images/Controller.xcos.png differ
diff --git a/scilab/modules/helptools/images/Kalman.xcos.png b/scilab/modules/helptools/images/Kalman.xcos.png
new file mode 100644 (file)
index 0000000..7ec3702
Binary files /dev/null and b/scilab/modules/helptools/images/Kalman.xcos.png differ
diff --git a/scilab/modules/xcos/examples/solvers/benchBasic.sce b/scilab/modules/xcos/examples/solvers/benchBasic.sce
new file mode 100644 (file)
index 0000000..7832156
--- /dev/null
@@ -0,0 +1,44 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+// Run with exec("SCI/modules/xcos/examples/solvers/benchBasic.sce");
+
+// Import the diagram, augment the ending time and store its compilation in Info()
+loadScicos();
+loadXcosLibs();
+importXcosDiagram("SCI/modules/xcos/demos/Controller.xcos");
+Info = scicos_simulate(scs_m, 'nw');
+tf = 4000;
+tolerances = scs_m.props.tol;
+tolerances(1) = 10^(-13);
+tolerances(2) = 10^(-13);
+[%tcur, %cpr, alreadyran, needstart, needcompile, %state0] = Info(:);
+
+solverName = ["LSodar", "CVode BDF/Newton", "CVode BDF/Functional", "CVode Adams/Newton", "CVode Adams/Functional", "Dormand-Prince", "Runge-Kutta", "implicit Runge-Kutta"];
+
+disp("--------------------------------");
+for solver = 0:7
+
+ disp("Time for " + solverName(solver + 1) + " :");
+ tolerances(6) = solver;
+
+ // Modify 'Max step size' if RK-based solver
+ if (solver >= 5) then tolerances(7) = 3*10^(-2); end
+
+ // Start the solver
+ [state, t] = scicosim(%state0, 0.0, tf, %cpr.sim, 'start', tolerances);
+
+ // Run until the end
+ tic();
+ [state, t] = scicosim(state, 0.0, tf, %cpr.sim, 'run', tolerances);
+ t = toc();
+ disp(t);
+
+ // End the solver
+ [state, t] = scicosim(state, tf, tf, %cpr.sim, 'finish', tolerances);
+
+end
+disp("--------------------------------");
+
diff --git a/scilab/modules/xcos/examples/solvers/benchKalman.sce b/scilab/modules/xcos/examples/solvers/benchKalman.sce
new file mode 100644 (file)
index 0000000..ccc151c
--- /dev/null
@@ -0,0 +1,48 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+// Run with exec("SCI/modules/xcos/examples/solvers/benchKalman.sce");
+
+// Import the diagram, augment the ending time and store its compilation in Info()
+loadScicos();
+loadXcosLibs();
+importXcosDiagram("SCI/modules/xcos/demos/Kalman.xcos");
+Info = scicos_simulate(scs_m, 'nw');
+tf = 1050;
+tolerances = scs_m.props.tol;
+tolerances(1) = 10^(-13);
+tolerances(2) = 10^(-13);
+[%tcur, %cpr, alreadyran, needstart, needcompile, %state0] = Info(:);
+
+solverName = ["LSodar", "CVode BDF/Newton", "CVode BDF/Functional", "CVode Adams/Newton", "CVode Adams/Functional", "Dormand-Prince", "Runge-Kutta", "implicit Runge-Kutta"];
+
+disp("--------------------------------");
+for solver = 0:7
+
+ disp("Time for " + solverName(solver + 1) + " :");
+ tolerances(6) = solver;
+
+ // Modify 'Max step size' if RK-based solver
+ if (solver >= 5) then tolerances(7) = 3*10^(-2); end
+ // Implicit RK does not support tolerances above 10^-(11) for this diagram
+ if (solver >= 7) then tolerances(1) = 10^(-10); end
+ if (solver >= 7) then tolerances(2) = 10^(-10); end
+
+ // Start the solver
+ [state, t] = scicosim(%state0, 0.0, tf, %cpr.sim, 'start', tolerances);
+
+ // Run until the end
+ tic();
+ [state, t] = scicosim(state, 0.0, tf, %cpr.sim, 'run', tolerances);
+ t = toc();
+ disp(t);
+
+ // End the solver
+ [state, t] = scicosim(state, tf, tf, %cpr.sim, 'finish', tolerances);
+
+end
+disp("--------------------------------");
+
diff --git a/scilab/modules/xcos/examples/solvers/benchSinus.sce b/scilab/modules/xcos/examples/solvers/benchSinus.sce
new file mode 100644 (file)
index 0000000..7008b0a
--- /dev/null
@@ -0,0 +1,42 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+// Run with exec("SCI/modules/xcos/examples/solvers/benchSinus.sce");
+
+// Import the diagram, augment the ending time and store its compilation in Info()
+loadScicos();
+loadXcosLibs();
+importXcosDiagram("SCI/modules/xcos/examples/solvers/ODE_Example.xcos");
+Info = scicos_simulate(scs_m, 'nw');
+tf = 50000;
+tolerances = scs_m.props.tol;
+[%tcur, %cpr, alreadyran, needstart, needcompile, %state0] = Info(:);
+
+solverName = ["LSodar", "CVode BDF/Newton", "CVode BDF/Functional", "CVode Adams/Newton", "CVode Adams/Functional", "Dormand-Prince", "Runge-Kutta", "implicit Runge-Kutta"];
+
+disp("--------------------------------");
+for solver = 0:7
+
+ disp("Time for " + solverName(solver + 1) + " :");
+ tolerances(6) = solver;
+
+ // Modify 'Max step size' if RK-based solver
+ if (solver >= 5) then tolerances(7) = 10^(-2); end
+
+ // Start the solver
+ [state, t] = scicosim(%state0, 0.0, tf, %cpr.sim, 'start', tolerances);
+
+ // Run until the end
+ tic();
+ [state, t] = scicosim(state, 0.0, tf, %cpr.sim, 'run', tolerances);
+ t = toc();
+ disp(t);
+
+ // End the solver
+ [state, t] = scicosim(state, tf, tf, %cpr.sim, 'finish', tolerances);
+
+end
+disp("--------------------------------");
+
index ca130ea..bd210c7 100644 (file)
@@ -152,7 +152,7 @@ Time for Adams / Functional :
             &#8776; <emphasis>max(reltol, abstol)</emphasis> ).
         </para>
         <para>
-            Variable step-size ODE solvers are not appropriate for deterministic real-time applications because the computational overhead of taking a time step varies over the course of an application.
+            Variable-size step ODE solvers are not appropriate for deterministic real-time applications because the computational overhead of taking a time step varies over the course of an application.
         </para>
     </refsection>
     <refsection>
@@ -174,6 +174,9 @@ Time for Adams / Functional :
                 <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode">ode</link>
             </member>
             <member>
index b5fa5e0..98fe8be 100644 (file)
@@ -268,6 +268,9 @@ Time for Adams / Functional :
                 <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode">ode</link>
             </member>
             <member>
index 7ae6ba5..4b1a9db 100644 (file)
@@ -231,6 +231,9 @@ Time for Runge-Kutta :
                 <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode">ode</link>
             </member>
             <member>
index 8271753..93ff5b5 100644 (file)
@@ -215,6 +215,9 @@ Time for DoPri :
                 <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode">ode</link>
             </member>
             <member>
index 8523aca..1be9c79 100644 (file)
@@ -271,6 +271,9 @@ Time for implicit Runge-Kutta :
                 <link linkend="DoPri">Dormand-Prince 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode_discrete">ode_discrete</link>
             </member>
             <member>
index a86b194..4f96b2d 100644 (file)
@@ -176,6 +176,9 @@ try xcos_simulate(scs_m, 4); catch disp(lasterror()); end
                 <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
             </member>
             <member>
+                <link linkend="Comparisons">Comparisons</link>
+            </member>
+            <member>
                 <link linkend="ode">ode</link>
             </member>
             <member>
diff --git a/scilab/modules/xcos/help/en_US/solvers/9-Comparisons.xml b/scilab/modules/xcos/help/en_US/solvers/9-Comparisons.xml
new file mode 100644 (file)
index 0000000..c065a81
--- /dev/null
@@ -0,0 +1,676 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Scilab Enterprises - 2012 - Paul Bignier
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.
+ * The terms are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg"  xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en_US" xml:id="Comparisons">
+    <refnamediv>
+        <refname>Comparisons</refname>
+        <refpurpose>
+            This page compares solvers to determine which one is best fitted for the studied problem.
+        </refpurpose>
+    </refnamediv>
+    <refsection>
+        <title>Introduction</title>
+        <para>
+            Following the type of problem studied, finding out which method to use is not always obvious, only general guidelines can be established. Those are and discussed in this page.
+        </para>
+        <title>Variable-size and Fixed-size</title>
+        <para>
+            The solvers can be divided into two distinct main families : the <emphasis>Variable</emphasis>-size and the <emphasis>Fixed</emphasis>-size step methods.
+        </para>
+        <para>
+            They both compute the next simulation time as the sum of the current simulation time and a quantity known as the step size, which is constant in the Fixed-size solvers and can change in the Variable-size ones, depending on the model dynamics and the input <link linkend="Simulatemenu_Menu_entries">tolerances</link>.
+        </para>
+        <para>
+            If looking for stable computation time, the user should select a Fixed-size step solver, because the computation overhead for a Variable-size step method cannot be properly foreseen.
+        </para>
+        <para>
+            Although for a simple problem (or loose tolerances) a Variable-size solver can significantly improve the simulation time by computing bigger step sizes, a Fixed-size method is preferable if the ideal step size is known and roughly constant (the user should then mention it in <link linkend="Simulatemenu_Menu_entries">max step size</link>).
+        </para>
+        <para>
+            <!--<informaltable border="1">
+                <tr>
+                    <td align="center">
+                        <emphasis role="bold">Variable</emphasis>
+                    </td>
+                    <td align="center">
+                        <emphasis role="bold">Fixed</emphasis>
+                    </td>
+                </tr>
+                <tr>
+                    <td> LSodar </td>
+                    <td> Runge-Kutta </td>
+                </tr>
+                <tr>
+                    <td> CVode </td>
+                    <td> Dormand-Prince </td>
+                </tr>
+                <tr>
+                    <td> IDA </td>
+                    <td> Implicit Runge-Kutta </td>
+                </tr>
+            </informaltable>-->
+            <emphasis role="bold">Variable</emphasis>-size step solvers :
+            <simplelist>
+                <member>LSodar</member>
+                <member>CVode</member>
+                <member>IDA</member>
+            </simplelist>
+            <emphasis role="bold">Fixed</emphasis>-size step solvers :
+            <simplelist>
+                <member>Runge-Kutta 4(5)</member>
+                <member>Dormand-Prince 4(5)</member>
+                <member>Implicit Runge-Kutta 4(5)</member>
+            </simplelist>
+        </para>
+        <para>
+            Variable step-size ODE solvers are not appropriate for deterministic real-time applications because the computational overhead of taking a time step varies over the course of an application.
+        </para>
+        <title>Explicit and Implicit - Stiffness</title>
+        <para>
+            Within these two families, we can distinguish <emphasis>Explicit</emphasis> solvers from <emphasis>Implicit</emphasis> ones.
+        </para>
+        <para>
+            While <emphasis>explicit</emphasis> methods only use data available on the current step, the <emphasis>implicit</emphasis> ones will attempt to compute derivatives at further times. In order to do this, they use nonlinear solvers such as fixed-point iterations, functional iterations (nonstiff) or modified Newton methods (stiff).
+        </para>
+        <para>
+            The family choice is usually determined by the <emphasis>stiffness</emphasis> of the problem, which is, when there is a big gap between the biggest and the smallest eigen values modules of the jacobian matrix (when it is ill-conditionned). It is generally a system that is sensitive to discontinuitues, meaning that the required precision is not constant.
+        </para>
+        <para>
+            <emphasis role="bold">Implicit</emphasis> solvers :
+            <simplelist>
+                <member>LSodar</member>
+                <member>CVode</member>
+                <member>IDA</member>
+                <member>Implicit Runge-Kutta 4(5)</member>
+            </simplelist>
+            <emphasis role="bold">Explicit</emphasis> solvers :
+            <simplelist>
+                <member>Runge-Kutta 4(5)</member>
+                <member>Dormand-Prince 4(5)</member>
+            </simplelist>
+        </para>
+        <para>
+            To put it simply, the <emphasis>Explicit</emphasis> go straight to a computation of the solution, whereas the <emphasis>Implicit</emphasis> concentrate on stability, involving more operations, following the tolerances.
+        </para>
+        <title>So how to choose ?</title>
+        <para>
+            Because it is not possible to know for sure wether a solver will be efficient for a given system or not, the best way is to run the most probable on it and to compare their results.
+        </para>
+        <para>
+            The user should first establish the complexity of his problem (stability / stiffness) and if he desires high precision, rapid simulation, predictable time or an automated program.
+            <para>
+                <emphasis role="bold">Precision :</emphasis> <emphasis>CVode</emphasis>,
+            </para>
+            <para>
+                <emphasis role="bold">Predictable time :</emphasis> Fixed-size step.
+            </para>
+            <para>
+                <emphasis role="bold">Simulation time :</emphasis> <emphasis>LSodar</emphasis>,
+            </para>
+            <para>
+                <emphasis role="bold">Automated :</emphasis> <emphasis>LSodar</emphasis>,
+            </para>
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <para>
+            We will begin with a simple nonstiff example : a Sinus integration.
+        </para>
+        <para>
+            <link type="scilab" linkend="scilab.xcos/xcos/examples/solvers/ODE_Example.xcos">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata align="center" fileref="../../../examples/solvers/ODE_Example.xcos" valign="middle"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </link>
+            <scilab:image><![CDATA[
+loadScicos();
+loadXcosLibs();
+importXcosDiagram(SCI + "/modules/xcos/examples/solvers/ODE_Example.xcos");
+scs_m.props.tol(6) = 0;
+try xcos_simulate(scs_m, 4); catch disp(lasterror()); end
+]]></scilab:image>
+        </para>
+        <para>
+            In the following script, we compare the time difference between the solvers by running the example with the eight solvers in turn (<emphasis>IDA</emphasis> doesn't handle this kind of problem) :
+            <link type="scilab" linkend ="scilab.scinotes/xcos/examples/solvers/benchSinus.sce">
+                Open the script
+            </link>
+        </para>
+        <para>
+            The Scilab console displays :
+            <screen><![CDATA[
+Time for LSodar :
+ 10.1
+
+Time for CVode BDF/Newton :
+ 31
+
+Time for CVode BDF/Functional :
+ 30
+
+Time for CVode Adams/Newton :
+ 17.211
+
+Time for CVode Adams/Functional :
+ 16.305
+
+Time for Dormand-Prince :
+ 12.92
+
+Time for Runge-Kutta :
+ 7.663
+
+Time for implicit Runge-Kutta :
+ 10.881
+            ]]></screen>
+        </para>
+        <para>
+            These results show that on a nonstiff problem and for same precision required, <emphasis>Runge-Kutta</emphasis> is fastest.
+        </para>
+        <para>
+            In spite of the computational overhead of the step size, <emphasis>LSodar</emphasis> not too distant from the Fixed-size solvers because it is able to take long steps.
+        </para>
+        <para>
+            From the results, we can extract speed factors and set the following table :
+        </para>
+        <para>
+            <informaltable border="1">
+                <tr>
+                    <td align="center"> </td>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Implicit Runge-Kutta</emphasis> 
+                    </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>LSodar</emphasis> 
+                    </td>
+                    <td align="center"> 3.1x </td>
+                    <td align="center"> 3x </td>
+                    <td align="center"> 1.7x </td>
+                    <td align="center"> 1.6x </td>
+                    <td align="center"> 1.3x </td>
+                    <td align="center"> 0.75x </td>
+                    <td align="center"> 1.08x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.6x </td>
+                    <td align="center"> 0.5x </td>
+                    <td align="center"> 0.4x </td>
+                    <td align="center"> 0.25x </td>
+                    <td align="center"> 0.35x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.6x </td>
+                    <td align="center"> 0.5x </td>
+                    <td align="center"> 0.4x </td>
+                    <td align="center"> 0.25x </td>
+                    <td align="center"> 0.4x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.9x </td>
+                    <td align="center"> 0.75x </td>
+                    <td align="center"> 0.45x </td>
+                    <td align="center"> 0.6x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.8x </td>
+                    <td align="center"> 0.5x </td>
+                    <td align="center"> 0.7x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.6x </td>
+                    <td align="center"> 0.8x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 1.4x </td>
+                </tr>
+            </informaltable>
+        </para>
+        <para>
+            Next, a basic controller with six continuous states is tested.
+            <link type="scilab" linkend="scilab.xcos/xcos/demos/Controller.xcos">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata align="center" fileref="../../../demos/Controller.xcos" valign="middle"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </link>
+            <scilab:image><![CDATA[
+loadScicos();
+loadXcosLibs();
+importXcosDiagram(SCI + "/modules/xcos/demos/Controller.xcos");
+scs_m.props.tol(6) = 0;
+try xcos_simulate(scs_m, 4); catch disp(lasterror()); end
+]]></scilab:image>
+        </para>
+        <para>
+            In the following script, we compare the time difference between the solvers by running the example with the eight solvers in turn (<emphasis>IDA</emphasis> doesn't handle this kind of problem) :
+            <link type="scilab" linkend ="scilab.scinotes/xcos/examples/solvers/benchBasic.sce">
+                Open the script
+            </link>
+        </para>
+        <para>
+            The Scilab console displays :
+            <screen><![CDATA[
+Time for LSodar :
+ 10
+
+Time for CVode BDF/Newton :
+ 28.254
+
+Time for CVode BDF/Functional :
+ 25.545
+
+Time for CVode Adams/Newton :
+ 15
+
+Time for CVode Adams/Functional :
+ 12.1
+
+Time for Dormand-Prince :
+ 2.359
+
+Time for Runge-Kutta :
+ 1.671
+
+Time for implicit Runge-Kutta :
+ 5.612
+            ]]></screen>
+        </para>
+        <para>
+            These results show that as stiffness appears, <emphasis>BDF/Newton</emphasis> starts picking up speed. But the problem is not yet complicated enough for that method to be interesting.
+        </para>
+        <para>
+            The updated speed factors table is as follows :
+        </para>
+        <para>
+            <informaltable border="1">
+                <tr>
+                    <td align="center"> </td>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Implicit Runge-Kutta</emphasis> 
+                    </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>LSodar</emphasis> 
+                    </td>
+                    <td align="center"> 2.8x </td>
+                    <td align="center"> 2.6x </td>
+                    <td align="center"> 1.5x </td>
+                    <td align="center"> 1.2x </td>
+                    <td align="center"> 0.2x </td>
+                    <td align="center"> 0.17x </td>
+                    <td align="center"> 0.5x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.9x </td>
+                    <td align="center"> 0.5x </td>
+                    <td align="center"> 0.4x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.05x </td>
+                    <td align="center"> 0.2x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.6x </td>
+                    <td align="center"> 0.5x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.07x </td>
+                    <td align="center"> 0.2x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.8x </td>
+                    <td align="center"> 0.15x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.4x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.2x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.5x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.7x </td>
+                    <td align="center"> 2.4x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 3.4x </td>
+                </tr>
+            </informaltable>
+        </para>
+        <para>
+            Now, we use Kalman's filter, which contains fifteen continuous states.
+            <link type="scilab" linkend="scilab.xcos/xcos/demos/Kalman.xcos">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata align="center" fileref="../../../demos/Kalman.xcos" valign="middle"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </link>
+            <scilab:image><![CDATA[
+loadScicos();
+loadXcosLibs();
+importXcosDiagram(SCI + "/modules/xcos/demos/Kalman.xcos");
+scs_m.props.tol(6) = 0;
+try xcos_simulate(scs_m, 4); catch disp(lasterror()); end
+]]></scilab:image>
+        </para>
+        <para>
+            In the following script, we compare the time difference between the solvers by running the example with the eight solvers in turn (<emphasis>IDA</emphasis> doesn't handle this kind of problem) :
+            <link type="scilab" linkend ="scilab.scinotes/xcos/examples/solvers/benchKalman.sce">
+                Open the script
+            </link>
+        </para>
+        <para>
+            The Scilab console displays :
+            <screen><![CDATA[
+Time for LSodar :
+ 10
+
+Time for CVode BDF/Newton :
+ 21.3
+
+Time for CVode BDF/Functional :
+ 15.8
+
+Time for CVode Adams/Newton :
+ 12.5
+
+Time for CVode Adams/Functional :
+ 8.67
+
+Time for Dormand-Prince :
+ 1.244
+
+Time for Runge-Kutta :
+ 0.87
+
+Time for implicit Runge-Kutta :
+ 4
+            ]]></screen>
+        </para>
+        <para>
+            These results show that for a bigger problem (more continuous states implies more equations), the <emphasis>Newton iteration</emphasis> starts showing interest, for it comes closer to the other solvers.
+        </para>
+        <para>
+            The updated speed factors table is as follows :
+        </para>
+        <para>
+            <informaltable border="1">
+                <tr>
+                    <td align="center"> </td>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center">
+                        <emphasis>Implicit Runge-Kutta</emphasis> 
+                    </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>LSodar</emphasis> 
+                    </td>
+                    <td align="center"> 2.1x </td>
+                    <td align="center"> 1.6x </td>
+                    <td align="center"> 1.3x </td>
+                    <td align="center"> 0.85x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.4x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.75x </td>
+                    <td align="center"> 0.6x </td>
+                    <td align="center"> 0.4x </td>
+                    <td align="center"> 0.06x </td>
+                    <td align="center"> 0.05x </td>
+                    <td align="center"> 0.2x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>BDF / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.8x </td>
+                    <td align="center"> 0.55x </td>
+                    <td align="center"> 0.08x </td>
+                    <td align="center"> 0.06x </td>
+                    <td align="center"> 0.25x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Newton</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.7x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.07x </td>
+                    <td align="center"> 0.3x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Adams / Functional</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.15x </td>
+                    <td align="center"> 0.1x </td>
+                    <td align="center"> 0.5x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Dormand-Prince</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 0.7x </td>
+                    <td align="center"> 3.2x </td>
+                </tr>
+                <tr>
+                    <td align="center">
+                        <emphasis>Runge-Kutta</emphasis> 
+                    </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> </td>
+                    <td align="center"> 4.6x </td>
+                </tr>
+            </informaltable>
+        </para>
+    </refsection>
+    <refsection>
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="LSodar">LSodar</link>
+            </member>
+            <member>
+                <link linkend="CVode">CVode</link>
+            </member>
+            <member>
+                <link linkend="IDA">IDA</link>
+            </member>
+            <member>
+                <link linkend="RK">Runge-Kutta 4(5)</link>
+            </member>
+            <member>
+                <link linkend="DoPri">Dormand-Prince 4(5)</link>
+            </member>
+            <member>
+                <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
+            </member>
+            <member>
+                <link linkend="ode">ode</link>
+            </member>
+            <member>
+                <link linkend="ode_discrete">ode_discrete</link>
+            </member>
+            <member>
+                <link linkend="ode_root">ode_root</link>
+            </member>
+            <member>
+                <link linkend="odedc">odedc</link>
+            </member>
+            <member>
+                <link linkend="impl">impl</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>