﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?application progid="SMath Studio Desktop" version="0.99.6988.37575"?>
<worksheet xmlns="http://smath.info/schemas/worksheet/1.0">
  <settings ppi="96">
    <identity>
      <id>54c60195-f9ec-4932-97d6-47b451c8092d</id>
      <revision>5</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.6988.37575" guid="a37cba83-b69c-4c71-9992-55ff666763bd" />
      <assembly name="Math Region" version="0.99.6988.37575" guid="02f1ab51-215b-466e-a74d-5d8b1cf85e8d" />
      <assembly name="SpecialFunctions" version="1.12.6988.37575" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
      <assembly name="Maple Tools" version="1.0.6982.28284" guid="32dfd679-8cfd-483a-b79a-19d5ea838750" />
      <assembly name="TextRegion" version="1.11.6988.37575" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
    </dependencies>
  </settings>
  <regions type="content">
    <region id="0" left="27" top="27" width="176" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>From Maple VRV help:</p>
      </text>
    </region>
    <region id="1" left="54" top="54" width="713" height="456" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>stats[fit, leastsquare] - Fit a curve to data using the least square method
Calling Sequence:
     stats[fit, leastsquare[vars, eqn, parms]]( data)
     fit[leastsquare[vars, eqn, parms]]( data)
Parameters:
     data  - list of statistical lists
     vars  - list of variables, corresponding, in order, to the lists in data
     eqn   - The equation to fit (optional, default = a linear equation with the last 
                    variable in vars as dependent variable and with a constant term).
     parms - Set of parameters that will be replaced (optional, default = indets(eqn) 
                      minus op(vars)).
Description:
The function leastsquare of the subpackage stats[fit, ...] fits a curve to the given 
data using the method of least squares. 
The equation to fit must be linear in the unknown parameters. The equation itself 
need not be linear. For example, y=a*x^2+b*x+c with the parameters a, b, c is 
accepted. Note that some equations which have their parameters appearing nonlinearly 
can be transformed to linear ones. y=a*exp(b*x) can be transformed into log(y)=A+b*x, 
where A=log(a). 

Missing data and ranges cannot be handled. 

Weighted data are handled in the following fashion. The weight associated with the 
dependent variable is the weight given to the corresponding point. The weight 
specifications corresponding to the independent variables are ignored. 

The command with(stats[describe],leastsquare) allows the use of the abbreviated form 
of this command.</p>
      </text>
    </region>
    <region id="2" left="18" top="522" width="119" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Basic example</p>
      </text>
    </region>
    <region id="3" left="54" top="549" width="509" height="57" color="#000000" bgColor="#ffffff">
      <maple width="509" height="57" border="true" linenumbers="false" backcolor="White">
        <text>dwBpAHQAaAAoAHMAdABhAHQAcwApADoADQAKAGEAbgBzACAAOgA9ACAAZgBpAHQAWwBsAGUAYQBzAHQAcwBxAHUAYQByAGUAWwBbAHgALAB5ACwAegBdAF0AXQANAAoAIAAgACgAWwBbADEALAAyACwAMwAsADUAXQAsAFsAMgAsADQALAA2ACwAOABdACwAWwAzACwANQAsADcALAAxADAAXQBdACkAOwA=</text>
        <input>
          <e type="operand">#</e>
        </input>
      </maple>
    </region>
    <region id="4" left="54" top="612" width="170" height="41" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">ans</e>
        </input>
        <result action="symbolic">
          <e type="operand">z</e>
          <e type="operand">2</e>
          <e type="operand">y</e>
          <e type="operator" args="2">+</e>
          <e type="operand">2</e>
          <e type="operand">x</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="operand">2</e>
          <e type="operator" args="2">/</e>
          <e type="operator" args="2">=</e>
        </result>
      </math>
    </region>
    <region id="5" left="18" top="657" width="110" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Using Weight</p>
      </text>
    </region>
    <region id="6" left="54" top="684" width="507" height="57" color="#000000" bgColor="#ffffff">
      <maple width="507" height="57" border="true" linenumbers="false" backcolor="White">
        <text>dwBpAHQAaAAoAHMAdABhAHQAcwApADoADQAKAGEAbgBzACAAOgA9ACAAZgBpAHQAWwBsAGUAYQBzAHQAcwBxAHUAYQByAGUAWwBbAHgALAB5ACwAegBdAF0AXQANAAoAIAAgACgAWwBbADEALAAyACwAMwAsADUALAA1ACwANQBdACwAWwAyACwANAAsADYALAA4ACwAOAAsADgAXQAsAFsAMwAsADUALAA3ACwAMQAwACwAMQA1ACwAMQA1AF0AXQApADsA</text>
        <input>
          <e type="operand">#</e>
        </input>
      </maple>
    </region>
    <region id="7" left="54" top="747" width="220" height="43" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">ans</e>
        </input>
        <result action="symbolic">
          <e type="operand">z</e>
          <e type="operand">2</e>
          <e type="operand">3</e>
          <e type="operand">13</e>
          <e type="operand">x</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operand">7</e>
          <e type="operand">y</e>
          <e type="operator" args="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>
        </result>
      </math>
    </region>
    <region id="8" left="54" top="792" width="507" height="73" color="#000000" bgColor="#ffffff">
      <maple width="507" height="73" border="true" linenumbers="false" backcolor="White">
        <text>dwBpAHQAaAAoAHMAdABhAHQAcwApADoADQAKAGEAbgBzACAAOgA9ACAAZgBpAHQAWwBsAGUAYQBzAHQAcwBxAHUAYQByAGUAWwBbAHgALAB5ACwAegBdAF0AXQANAAoAIAAgACgAWwBbADEALAAyACwAMwAsADUALAA1AF0ALABbADIALAA0ACwANgAsADgALAA4AF0ALABbADMALAA1ACwANwAsADEAMAAsAA0ACgAgACAAIAAgAFcAZQBpAGcAaAB0ACgAMQA1ACwAMgApAF0AXQApADsA</text>
        <input>
          <e type="operand">#</e>
        </input>
      </maple>
    </region>
    <region id="9" left="54" top="873" width="220" height="43" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">ans</e>
        </input>
        <result action="symbolic">
          <e type="operand">z</e>
          <e type="operand">2</e>
          <e type="operand">3</e>
          <e type="operand">13</e>
          <e type="operand">x</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">*</e>
          <e type="operand">7</e>
          <e type="operand">y</e>
          <e type="operator" args="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>
        </result>
      </math>
    </region>
    <region id="10" left="18" top="927" width="135" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Fit a quadratic</p>
      </text>
    </region>
    <region id="11" left="54" top="954" width="507" height="106" color="#000000" bgColor="#ffffff">
      <maple width="507" height="106" border="true" linenumbers="false" backcolor="White">
        <text>dwBpAHQAaAAoAHMAdABhAHQAcwApADoADQAKAFgAdgBhAGwAdQBlAHMAOgA9AFsAMQAsADIALAAzACwANABdADsADQAKAFkAdgBhAGwAdQBlAHMAOgA9AFsAMAAsADYALAAxADQALAAyADQAXQA7AA0ACgBhAG4AcwAgADoAPQAgAGYAaQB0AFsAbABlAGEAcwB0AHMAcQB1AGEAcgBlAFsAWwB4ACwAeQBdACwAIAANAAoAIAAgAHkAPQBhACoAeABeADIAKwBiACoAeAArAGMALAAgAA0ACgAgACAAewBhACwAYgAsAGMAfQBdAF0AKABbAFgAdgBhAGwAdQBlAHMALAAgAFkAdgBhAGwAdQBlAHMAXQApADsA</text>
        <input>
          <e type="operand">#</e>
        </input>
      </maple>
    </region>
    <region id="12" left="54" top="1080" width="190" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">ans</e>
        </input>
        <result action="symbolic">
          <e type="operand">y</e>
          <e type="operand">4</e>
          <e type="operator" args="1">-</e>
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operand">x</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>
        </result>
      </math>
    </region>
    <region id="13" left="18" top="1134" width="193" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Calling maple function</p>
      </text>
    </region>
    <region id="14" left="54" top="1170" width="397" height="33" color="#000000" bgColor="#ffffff" fontSize="10">
      <math optimize="2">
        <description active="true" position="Top" lang="spa">
          <p>IsMat(x) try to check if x is a matrix.</p>
        </description>
        <input>
          <e type="operand">x\032E\</e>
          <e type="function" args="1">IsMat</e>
          <e type="operand">x\032E\</e>
          <e type="function" args="1">num2str</e>
          <e type="operand" style="string">mat(</e>
          <e type="function" args="2">findstr</e>
          <e type="operand">1</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">≠</e>
          <e type="function" args="1">eval</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="15" left="54" top="1251" width="611" height="224" color="#000000" bgColor="#ffffff" fontSize="10">
      <math optimize="2">
        <description active="true" position="Top" lang="spa">
          <p>Converts a Matrix into a string with specific delimiters.</p>
        </description>
        <input>
          <e type="operand">M\032E\</e>
          <e type="operand">D\032E\\005B\</e>
          <e type="operand">D\032E\\005D\</e>
          <e type="operand">D\032E\\002C\</e>
          <e type="function" args="4">Mat2Str</e>
          <e type="operand">M\032E\</e>
          <e type="function" args="1">IsMat</e>
          <e type="operand">s\0324\</e>
          <e type="operand">D\032E\\005B\</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r\0324\</e>
          <e type="operand">1</e>
          <e type="operand">M\032E\</e>
          <e type="function" args="1">rows</e>
          <e type="function" args="2">range</e>
          <e type="operand">s\0324\</e>
          <e type="operand">s\0324\</e>
          <e type="operand">D\032E\\005B\</e>
          <e type="function" args="2">concat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">c\0324\</e>
          <e type="operand">1</e>
          <e type="operand">M\032E\</e>
          <e type="function" args="1">cols</e>
          <e type="function" args="2">range</e>
          <e type="operand">s\0324\</e>
          <e type="operand">s\0324\</e>
          <e type="operand">M\032E\</e>
          <e type="operand">r\0324\</e>
          <e type="operand">c\0324\</e>
          <e type="function" args="3">el</e>
          <e type="operand">D\032E\\005B\</e>
          <e type="operand">D\032E\\005D\</e>
          <e type="operand">D\032E\\002C\</e>
          <e type="function" args="4">Mat2Str</e>
          <e type="operand">D\032E\\002C\</e>
          <e type="function" args="3">concat</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="operand">s\0324\</e>
          <e type="operand">s\0324\</e>
          <e type="operand">1</e>
          <e type="operand">s\0324\</e>
          <e type="function" args="1">strlen</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="function" args="3">substr</e>
          <e type="operand">D\032E\\005D\</e>
          <e type="operand">D\032E\\002C\</e>
          <e type="function" args="3">concat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="function" args="3">for</e>
          <e type="operand">s\0324\</e>
          <e type="operand">s\0324\</e>
          <e type="operand">1</e>
          <e type="operand">s\0324\</e>
          <e type="function" args="1">strlen</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="function" args="3">substr</e>
          <e type="operand">D\032E\\005D\</e>
          <e type="function" args="2">concat</e>
          <e type="operator" args="2">:</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="operand">M\032E\</e>
          <e type="function" args="1">num2str</e>
          <e type="function" args="3">if</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="16" left="54" top="1512" width="325" height="29" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">M#</e>
          <e type="function" args="1">Mat2Str</e>
          <e type="operand">M#</e>
          <e type="operand" style="string">[</e>
          <e type="operand" style="string">]</e>
          <e type="operand" style="string">,</e>
          <e type="function" args="4">Mat2Str</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="3">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="17" left="54" top="1557" width="103" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">X</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">3</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="operand">4</e>
          <e type="function" args="6">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="18" left="189" top="1557" width="103" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">Y</e>
          <e type="operand">2</e>
          <e type="operand">4</e>
          <e type="operand">6</e>
          <e type="operand">8</e>
          <e type="operand">1</e>
          <e type="operand">4</e>
          <e type="function" args="6">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="19" left="333" top="1557" width="111" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">Z</e>
          <e type="operand">3</e>
          <e type="operand">5</e>
          <e type="operand">7</e>
          <e type="operand">10</e>
          <e type="operand">1</e>
          <e type="operand">4</e>
          <e type="function" args="6">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="20" left="495" top="1557" width="250" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Values from the first example</p>
      </text>
    </region>
    <region id="21" left="54" top="1602" width="714" height="32" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">str</e>
          <e type="operand" style="string">with(stats):fit[leastsquare[[x,y,z]]](</e>
          <e type="operand">X</e>
          <e type="operand">Y</e>
          <e type="operand">Z</e>
          <e type="function" args="3">stack</e>
          <e type="function" args="1">Mat2Str</e>
          <e type="operand" style="string">)</e>
          <e type="function" args="3">concat</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region id="22" left="54" top="1647" width="648" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">str</e>
        </input>
        <result action="numeric">
          <e type="operand" style="string">with(stats):fit[leastsquare[[x,y,z]]]([[1,2,3,5],[2,4,6,8],[3,5,7,10]])</e>
        </result>
      </math>
    </region>
    <region id="23" left="18" top="1692" width="258" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>Unfortunatelly this don't work</p>
      </text>
    </region>
    <region id="24" left="54" top="1728" width="145" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">str</e>
          <e type="function" args="1">maple</e>
        </input>
        <result action="symbolic">
          <e type="operand">str</e>
        </result>
      </math>
    </region>
    <region id="25" left="18" top="1782" width="315" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>You must to copy and paste the string</p>
      </text>
    </region>
    <region id="26" left="54" top="1809" width="783" height="41" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand" style="string">with(stats):fit[leastsquare[[x,y,z]]]([[1,2,3,5],[2,4,6,8],[3,5,7,10]])</e>
          <e type="function" args="1">maple</e>
        </input>
        <result action="symbolic">
          <e type="operand">z</e>
          <e type="operand">2</e>
          <e type="operand">y</e>
          <e type="operator" args="2">+</e>
          <e type="operand">2</e>
          <e type="operand">x</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">+</e>
          <e type="operand">2</e>
          <e type="operator" args="2">/</e>
          <e type="operator" args="2">=</e>
        </result>
      </math>
    </region>
    <region id="27" left="18" top="1863" width="738" height="40" color="#000000" bgColor="#ffffff" fontSize="10">
      <text lang="eng">
        <p>There are also another fit function: leastmediansquare for Fit a Curve to data using the 
least median of squares method</p>
      </text>
    </region>
    <region id="28" left="18" top="1926" width="60" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
      <math>
        <input>
          <e type="operand">Alvaro</e>
        </input>
      </math>
    </region>
  </regions>
</worksheet>