﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?application progid="SMath Studio Desktop" version="0.99.7251.32800"?>
<worksheet xmlns="http://smath.info/schemas/worksheet/1.0">
  <settings ppi="96">
    <identity>
      <id>c99e3b99-ac50-407c-9f66-e14bb2ed6d9d</id>
      <revision>34</revision>
    </identity>
    <calculation>
      <precision>4</precision>
      <exponentialThreshold>5</exponentialThreshold>
      <trailingZeros>false</trailingZeros>
      <significantDigitsMode>false</significantDigitsMode>
      <roundingMode>0</roundingMode>
      <fractions>decimal</fractions>
    </calculation>
    <pageModel active="true" viewMode="0" printGrid="false" printAreas="true" simpleEqualsOnly="false" printBackgroundImages="true">
      <paper id="1" orientation="Portrait" width="850" height="1100" />
      <margins left="39" right="39" top="49" bottom="49" />
      <header alignment="Center" color="#a9a9a9">&amp;[DATE] &amp;[TIME] - &amp;[FILENAME]</header>
      <footer alignment="Center" color="#a9a9a9">&amp;[PAGENUM] / &amp;[COUNT]</footer>
      <backgrounds />
    </pageModel>
    <dependencies>
      <assembly name="SMath Studio Desktop" version="0.99.7251.32800" guid="a37cba83-b69c-4c71-9992-55ff666763bd" />
      <assembly name="Math Region" version="0.99.7251.32800" guid="02f1ab51-215b-466e-a74d-5d8b1cf85e8d" />
      <assembly name="SpecialFunctions" version="1.12.7251.32800" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
      <assembly name="Maple Tools" version="1.1.7442.27161" guid="32dfd679-8cfd-483a-b79a-19d5ea838750" />
      <assembly name="TextRegion" version="1.11.7251.32800" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
      <assembly name="ALGLIB® - numerical analysis library" version="1.0.7175.33522" guid="8e40b49c-3681-4332-903d-751303860e7b" />
      <assembly name="PlotRegion" version="1.11.7251.32800" guid="c451c2b5-798b-4f08-b9ec-b90963d1ddaa" />
      <assembly name="ODE Solvers" version="0.2.7155.3312" guid="ddc09821-49f1-4c21-a829-6499de0a8f06" />
    </dependencies>
  </settings>
  <regions type="content">
    <region left="18" top="18" width="236" height="27" color="#800000" fontSize="12">
      <text lang="eng">
        <p bold="true" fontName="Arial">Integration using ode solvers</p>
      </text>
    </region>
    <region left="18" top="54" width="432" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Integrals can be evaluated with an appropiate ode solver. For example:</p>
      </text>
    </region>
    <region left="54" top="90" width="131" height="26" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">φ</e>
          <e type="operand">x</e>
          <e type="operand">x</e>
          <e type="function" args="1">cos</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="234" top="90" width="106" height="27" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="operand">0</e>
          <e type="operand">π</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="54" top="135" width="121" height="69" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">φ</e>
          <e type="operand">x</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="4">int</e>
        </input>
        <result action="numeric">
          <e type="operand">2</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="279" top="135" width="398" height="84" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="operand">x</e>
          <e type="function" args="1">φ</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">M</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">100</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="function" args="5">rkfixed</e>
          <e type="operator" args="2">:</e>
          <e type="operand">M</e>
          <e type="operand">M</e>
          <e type="function" args="1">rows</e>
          <e type="operand">2</e>
          <e type="function" args="3">el</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
        </input>
        <result action="numeric">
          <e type="operand">2.04951252</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="18" top="234" width="205" height="40" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Notice that Rkadapt fails, but not
this other from alglib</p>
      </text>
    </region>
    <region left="279" top="234" width="366" height="84" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="operand">x</e>
          <e type="function" args="1">φ</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">M</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">100</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="function" args="5">al_rkckadapt</e>
          <e type="operator" args="2">:</e>
          <e type="operand">M</e>
          <e type="operand">M</e>
          <e type="function" args="1">rows</e>
          <e type="operand">2</e>
          <e type="function" args="3">el</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
        </input>
        <result action="numeric">
          <e type="operand">2</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="18" top="333" width="126" height="27" color="#800000" fontSize="12">
      <text lang="eng">
        <p bold="true" fontName="Arial">The ode solver</p>
      </text>
    </region>
    <region left="18" top="369" width="754" height="40" color="#000000" fontSize="10">
      <text lang="eng" width="754">
        <p fontName="Arial">We can define our own integration procedure, cleaning the ode solver method for improve it's performance, This is a rude Runge Kuta 2-3 solver</p>
      </text>
    </region>
    <region left="54" top="414" width="654" height="487" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">u.0</e>
          <e type="operand">t.1</e>
          <e type="operand">t.2</e>
          <e type="operand">N</e>
          <e type="operand">E</e>
          <e type="function" args="5">RK23</e>
          <e type="operand">u</e>
          <e type="operand">u.0</e>
          <e type="operator" args="2">:</e>
          <e type="operand">t</e>
          <e type="operand">t.1</e>
          <e type="operator" args="2">:</e>
          <e type="operand">h.o</e>
          <e type="operand">t.2</e>
          <e type="operand">t.1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">N</e>
          <e type="operator" args="2">/</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">h</e>
          <e type="operand">h.o</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">4</e>
          <e type="function" args="6">mat</e>
          <e type="operand">t</e>
          <e type="operand">k</e>
          <e type="function" args="2">K</e>
          <e type="operand">h</e>
          <e type="operand">t</e>
          <e type="function" args="1">D</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">eval</e>
          <e type="operand">h</e>
          <e type="operand">k</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">eval</e>
          <e type="function" args="2">try</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">line</e>
          <e type="operator" args="2">:</e>
          <e type="operand">t</e>
          <e type="operand">t.2</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">k.1</e>
          <e type="operand">t</e>
          <e type="operand">u</e>
          <e type="function" args="2">K</e>
          <e type="operator" args="2">:</e>
          <e type="operand">k.2</e>
          <e type="operand">t</e>
          <e type="operand">h</e>
          <e type="operator" args="2">+</e>
          <e type="operand">k.1</e>
          <e type="function" args="2">K</e>
          <e type="operator" args="2">:</e>
          <e type="operand">k.3</e>
          <e type="operand">t</e>
          <e type="operand">0.5</e>
          <e type="operand">h</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="operand">k.2</e>
          <e type="function" args="2">K</e>
          <e type="operator" args="2">:</e>
          <e type="operand">d</e>
          <e type="operand">k.1</e>
          <e type="operand">2</e>
          <e type="operand">k.3</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">-</e>
          <e type="operand">k.2</e>
          <e type="operator" args="2">+</e>
          <e type="operand">3</e>
          <e type="operator" args="2">/</e>
          <e type="function" args="1">abs</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="bracket">(</e>
          <e type="operand">q</e>
          <e type="operand">E</e>
          <e type="operand">u</e>
          <e type="function" args="1">abs</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="function" args="1">max</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">≤</e>
          <e type="operand">t</e>
          <e type="operand">t</e>
          <e type="operand">h</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">k.1</e>
          <e type="operand">4</e>
          <e type="operand">k.3</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="operand">k.2</e>
          <e type="operator" args="2">+</e>
          <e type="operand">6</e>
          <e type="operator" args="2">/</e>
          <e type="operator" args="2">+</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operand" style="string"></e>
          <e type="function" args="3">if</e>
          <e type="operand">d</e>
          <e type="operand">0</e>
          <e type="operator" args="2">≠</e>
          <e type="operand">h</e>
          <e type="operand">h.o</e>
          <e type="operand">0.9</e>
          <e type="operand">h</e>
          <e type="operator" args="2">*</e>
          <e type="operand">q</e>
          <e type="operand">d</e>
          <e type="operator" args="2">/</e>
          <e type="operand">3</e>
          <e type="function" args="2">nthroot</e>
          <e type="operator" args="2">*</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="function" args="1">min</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand" style="string"></e>
          <e type="function" args="3">if</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="function" args="7">line</e>
          <e type="function" args="2">while</e>
          <e type="operand">u</e>
          <e type="operand">4</e>
          <e type="operand">1</e>
          <e type="function" args="6">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="18" top="918" width="42" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Thus</p>
      </text>
    </region>
    <region left="108" top="918" width="314" height="58" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">D</e>
          <e type="operand">x</e>
          <e type="function" args="1">φ</e>
          <e type="operator" args="2">:</e>
          <e type="operand">0</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">100</e>
          <e type="operand">10</e>
          <e type="operand">6</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">^</e>
          <e type="function" args="5">RK23</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
        </input>
        <result action="numeric">
          <e type="operand">2.00113492</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="18" top="1017" width="138" height="27" color="#800000" fontSize="12">
      <text lang="eng">
        <p bold="true" fontName="Arial">Double Integrals</p>
      </text>
    </region>
    <region left="18" top="1062" width="133" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">SMath can Integrate</p>
      </text>
    </region>
    <region left="180" top="1062" width="142" height="34" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operand">x</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operand">y</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="351" top="1062" width="203" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">over the region defined between</p>
      </text>
    </region>
    <region left="567" top="1062" width="123" height="57" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operand">e</e>
          <e type="operand">x</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operand">2</e>
          <e type="operand">x</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">sys</e>
        </input>
      </math>
    </region>
    <region left="18" top="1134" width="354" height="57" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operator" args="2">-</e>
          <e type="operand">x</e>
          <e type="function" args="2">solve</e>
          <e type="function" args="1">sort</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">0.768</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.6783</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="459" top="1134" width="296" height="181" color="#000000" fontSize="10" showInputData="false">
      <plot type="2d" render="lines" scale_x="2.357947691" scale_y="5.05447028499294" scale_z="5.05447028499294" rotate_x="0" rotate_y="0" rotate_z="0" transpose_x="-50" transpose_y="-69" transpose_z="0">
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="function" args="1">a</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand" style="string">o</e>
          <e type="function" args="3">augment</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">sys</e>
        </input>
      </plot>
    </region>
    <region left="54" top="1206" width="100" height="31" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="801" top="1242" width="390" height="85" color="#000000" fontSize="10">
      <math evaluate="false" decimalPlaces="8">
        <description active="true" position="Top" lang="eng">
          <p fontName="Arial">Numerical optimization</p>
        </description>
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operand">y</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="function" args="4">int</e>
          <e type="operand">x</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="function" args="4">int</e>
          <e type="function" args="1">evalf</e>
          <e type="function" args="1">maple</e>
        </input>
        <result action="numeric">
          <e type="operand">18.57686882</e>
        </result>
      </math>
    </region>
    <region left="18" top="1251" width="359" height="83" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I.0</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operand">y</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="function" args="4">int</e>
          <e type="operand">x</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="function" args="4">int</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.57686864</e>
        </result>
      </math>
    </region>
    <region left="54" top="1350" width="165" height="31" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operand">t.0</e>
          <e type="operator" args="2">-</e>
        </input>
        <result action="numeric">
          <e type="operand">1.891</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
        </result>
      </math>
    </region>
    <region left="18" top="1404" width="132" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Define some utilities</p>
      </text>
    </region>
    <region left="54" top="1440" width="342" height="84" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
          <e type="operand">Δt</e>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operand">t.0</e>
          <e type="operator" args="2">-</e>
          <e type="operator" args="2">:</e>
          <e type="operand">t.0</e>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="operand">I</e>
          <e type="operand">I.0</e>
          <e type="operator" args="2">-</e>
          <e type="function" args="1">abs</e>
          <e type="operand">Δt</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="486" top="1440" width="83" height="39" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">ε.x</e>
          <e type="operand">10</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="603" top="1440" width="83" height="39" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">ε.y</e>
          <e type="operand">10</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="486" top="1485" width="60" height="30" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">n.x</e>
          <e type="operand">15</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="603" top="1485" width="60" height="30" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">n.y</e>
          <e type="operand">15</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="18" top="1539" width="717" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Now, we try to extend the above method for solve this problem parametrizing the ode solver  from  the SMath plugins ...</p>
      </text>
    </region>
    <region left="54" top="1575" width="698" height="145" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">2</e>
          <e type="function" args="1">f</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="function" args="7">DInt</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">n</e>
          <e type="function" args="3">RK</e>
          <e type="operand">M</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">n</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="function" args="5">al_rkckadapt</e>
          <e type="operator" args="2">:</e>
          <e type="operand">M</e>
          <e type="operand">M</e>
          <e type="function" args="1">rows</e>
          <e type="operand">2</e>
          <e type="function" args="3">el</e>
          <e type="function" args="1">eval</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operator" args="2">:</e>
          <e type="operand">y</e>
          <e type="operand">u</e>
          <e type="function" args="2">D</e>
          <e type="operand">x</e>
          <e type="operand">v</e>
          <e type="function" args="2">D</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">mat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">n.x</e>
          <e type="function" args="3">RK</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operator" args="2">:</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.y</e>
          <e type="function" args="3">RK</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="18" top="1728" width="206" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">... or using our own ode solver ...</p>
      </text>
    </region>
    <region left="54" top="1764" width="576" height="85" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">2</e>
          <e type="function" args="1">f</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="operand">ε.x</e>
          <e type="operand">ε.y</e>
          <e type="function" args="9">DInt</e>
          <e type="operand">y</e>
          <e type="function" args="1">D</e>
          <e type="operand">x</e>
          <e type="function" args="1">D</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operator" args="2">:</e>
          <e type="operand">0</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">n.x</e>
          <e type="operand">ε.x</e>
          <e type="function" args="5">RK23</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operator" args="2">:</e>
          <e type="operand">0</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.y</e>
          <e type="operand">ε.y</e>
          <e type="function" args="5">RK23</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="18" top="1863" width="765" height="40" color="#000000" fontSize="10">
      <text lang="eng" width="754">
        <p fontName="Arial">... and, as first approach, using integration over a rectangle bigger  than the true region of integration and making zero f outside the region of integration</p>
      </text>
    </region>
    <region left="54" top="1908" width="307" height="28" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">g</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">f</e>
          <e type="operand">y</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operator" args="2">≤</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operand">y</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operator" args="2">≥</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="396" top="1908" width="82" height="57" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="operand">0</e>
          <e type="operand">6</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="558" top="1908" width="100" height="31" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="54" top="1971" width="278" height="81" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">g</e>
          <e type="operand">y</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="function" args="4">int</e>
          <e type="operand">x</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="function" args="4">int</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.5832591</e>
        </result>
      </math>
    </region>
    <region left="558" top="1971" width="163" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
        </input>
        <result action="numeric">
          <e type="operand">0.0064</e>
          <e type="operand">5.35</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="54" top="2070" width="339" height="33" color="#000000" fontSize="10">
      <math evaluate="false" decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">g</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="function" args="7">DInt</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">#</e>
        </result>
      </math>
    </region>
    <region left="504" top="2070" width="248" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">Convergent only for rkafixed ode solver.</p>
      </text>
    </region>
    <region left="54" top="2124" width="476" height="33" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">g</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">y.1</e>
          <e type="operand">y.2</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="operand">ε.x</e>
          <e type="operand">ε.y</e>
          <e type="function" args="9">DInt</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.45199634</e>
        </result>
      </math>
    </region>
    <region left="558" top="2124" width="168" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
        </input>
        <result action="numeric">
          <e type="operand">0.1249</e>
          <e type="operand">71.53</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="18" top="2187" width="295" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">As better approach, using a change of variables</p>
      </text>
    </region>
    <region left="342" top="2187" width="147" height="32" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">y</e>
          <e type="operand">y.1</e>
          <e type="operand">u</e>
          <e type="operand">y.2</e>
          <e type="operand">y.1</e>
          <e type="operator" args="2">-</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">≡</e>
        </input>
      </math>
    </region>
    <region left="513" top="2187" width="130" height="32" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">dy</e>
          <e type="operand">y.2</e>
          <e type="operand">y.1</e>
          <e type="operator" args="2">-</e>
          <e type="bracket">(</e>
          <e type="operand">du</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">≡</e>
        </input>
      </math>
    </region>
    <region left="18" top="2223" width="655" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p fontName="Arial">we can integrate from 0 to 1 for y, and isn't necessary to guess the limits of integration, as in the first method.</p>
      </text>
    </region>
    <region left="54" top="2259" width="407" height="30" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="operand">u</e>
          <e type="function" args="2">h</e>
          <e type="operand">x</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operand">u</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operator" args="2">-</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="function" args="2">f</e>
          <e type="operand">x</e>
          <e type="function" args="1">b</e>
          <e type="operand">x</e>
          <e type="function" args="1">a</e>
          <e type="operator" args="2">-</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="54" top="2304" width="281" height="81" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">h</e>
          <e type="operand">y</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="function" args="4">int</e>
          <e type="operand">x</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="function" args="4">int</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.56839179</e>
        </result>
      </math>
    </region>
    <region left="558" top="2304" width="176" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
        </input>
        <result action="numeric">
          <e type="operand">0.0085</e>
          <e type="operand">10.453</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="54" top="2394" width="403" height="33" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">h</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="function" args="7">DInt</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.57686894</e>
        </result>
      </math>
    </region>
    <region left="558" top="2394" width="210" height="54" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
        </input>
        <result action="numeric">
          <e type="operand">3.0316</e>
          <e type="operand">10</e>
          <e type="operand">7</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">*</e>
          <e type="operand">7.387</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="54" top="2475" width="451" height="33" color="#000000" fontSize="10">
      <math decimalPlaces="8">
        <input>
          <e type="operand">I</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">h</e>
          <e type="operand">x.1</e>
          <e type="operand">x.2</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">n.x</e>
          <e type="operand">n.y</e>
          <e type="operand">ε.x</e>
          <e type="operand">ε.y</e>
          <e type="function" args="9">DInt</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">18.4681218</e>
        </result>
      </math>
    </region>
    <region left="558" top="2475" width="168" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">t.0</e>
          <e type="function" args="1">Err\0026\T</e>
        </input>
        <result action="numeric">
          <e type="operand">0.1087</e>
          <e type="operand">2.139</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="18" top="2529" width="60" height="24" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">Alvaro</e>
        </input>
      </math>
    </region>
  </regions>
</worksheet>