﻿<?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>8756e0b0-4786-49cc-b282-8d7a293f7675</id>
      <revision>122</revision>
    </identity>
    <metadata lang="eng">
      <title>Functions for line intersections</title>
      <author>Marco Bernacca</author>
    </metadata>
    <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="9" orientation="Portrait" width="827" height="1169" />
      <margins left="39" right="30" top="39" bottom="59" />
      <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="Custom Functions" version="1.1.7200.16172" guid="18dadffd-79a3-4cf9-aee1-d66deb0ea720" />
      <assembly name="SpecialFunctions" version="1.12.7251.32800" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
      <assembly name="TextRegion" version="1.11.7251.32800" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
      <assembly name="PlotRegion" version="1.11.7251.32800" guid="c451c2b5-798b-4f08-b9ec-b90963d1ddaa" />
    </dependencies>
  </settings>
  <regions type="content">
    <region left="0" top="0" width="719" height="89" color="#000000" fontSize="10">
      <text lang="eng">
        <p>These functions have been written to implement in Smath some features that are natively 
provided by either Scilab or Matlab in order to make available in Smath a function 
originally written in Matlab to find intersections between lines.
The function in subject is  P = InterX(L1, L2), written by NS. See below link:
https://de.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections</p>
      </text>
    </region>
    <region left="9" top="108" width="687" height="73" border="true" color="#000000" bgColor="#f9fed8" fontSize="10">
      <text lang="eng">
        <p>Function mdiff(V)
Input: a vector (either a row or a column)
Output: a vector of the same nature of input (a row or a column) containing the
                 differences V(i+1)-V(i). Number of output elements are lenght(V)-1.</p>
      </text>
    </region>
    <region left="9" top="189" width="580" height="104" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">V</e>
          <e type="function" args="1">mdiff</e>
          <e type="operand">V</e>
          <e type="function" args="1">rows</e>
          <e type="operand">1</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">a</e>
          <e type="operand">V</e>
          <e type="operand">0</e>
          <e type="function" args="2">stack</e>
          <e type="operand">0</e>
          <e type="operand">V</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">-</e>
          <e type="operand">2</e>
          <e type="operand">V</e>
          <e type="function" args="1">rows</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="5">submatrix</e>
          <e type="operator" args="2">:</e>
          <e type="operand">a</e>
          <e type="operand">V</e>
          <e type="operand">0</e>
          <e type="function" args="2">augment</e>
          <e type="operand">0</e>
          <e type="operand">V</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">-</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">V</e>
          <e type="function" args="1">cols</e>
          <e type="function" args="5">submatrix</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">if</e>
          <e type="operand">a</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="783" top="189" width="593" height="85" color="#000000" fontSize="10">
      <math evaluate="false" optimize="2" trailingZeros="true">
        <input>
          <e type="operand">V</e>
          <e type="function" args="1">mdiff</e>
          <e type="operand">V</e>
          <e type="function" args="1">rows</e>
          <e type="operand">1</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">V</e>
          <e type="operand">0</e>
          <e type="function" args="2">stack</e>
          <e type="operand">0</e>
          <e type="operand">V</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">-</e>
          <e type="operand">2</e>
          <e type="operand">V</e>
          <e type="function" args="1">rows</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="function" args="5">submatrix</e>
          <e type="operand">V</e>
          <e type="operand">0</e>
          <e type="function" args="2">augment</e>
          <e type="operand">0</e>
          <e type="operand">V</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">-</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">V</e>
          <e type="function" args="1">cols</e>
          <e type="function" args="5">submatrix</e>
          <e type="function" args="3">if</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="468" top="324" width="69" height="100" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="operand">4</e>
          <e type="operand">2</e>
          <e type="operand">7</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="function" args="7">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="549" top="324" width="153" height="81" color="#000000" fontSize="10">
      <math decimalPlaces="1" trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="function" args="1">mdiff</e>
        </input>
        <result action="numeric">
          <e type="operand">2.0</e>
          <e type="operator" args="1">-</e>
          <e type="operand">5.0</e>
          <e type="operand">4.0</e>
          <e type="operator" args="1">-</e>
          <e type="operand">2.0</e>
          <e type="operator" args="1">-</e>
          <e type="operand">4</e>
          <e type="operand">1</e>
          <e type="function" args="6">mat</e>
        </result>
      </math>
    </region>
    <region left="306" top="351" width="139" height="27" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="operand">5</e>
          <e type="operand">8</e>
          <e type="operand">9</e>
          <e type="operand">4</e>
          <e type="operand">1</e>
          <e type="operand">6</e>
          <e type="function" args="8">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="99" top="360" width="87" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
      <text lang="eng">
        <p>Examples:</p>
      </text>
    </region>
    <region left="207" top="387" width="273" height="27" color="#000000" fontSize="10">
      <math decimalPlaces="1" trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="function" args="1">mdiff</e>
        </input>
        <result action="numeric">
          <e type="operand">2.0</e>
          <e type="operand">2.0</e>
          <e type="operand">3.0</e>
          <e type="operand">1.0</e>
          <e type="operand">5.0</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1</e>
          <e type="operand">5</e>
          <e type="function" args="7">mat</e>
        </result>
      </math>
    </region>
    <region left="0" top="432" width="735" height="73" border="true" color="#000000" bgColor="#f9fed8" fontSize="10">
      <text lang="eng">
        <p>Function index(x; cond)
Input: x: a vector (row or column). cond: expression evaluating to an array of T/F values.
Output: a vector of same nature of input array whose components are those corresponding
                to a TRUE value for the given condition. </p>
      </text>
    </region>
    <region left="0" top="513" width="321" height="243" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <description active="false" position="Top" lang="eng">
          <p>Function index(x; cond)
Input: x: a vector (row or column). cond: expression evaluating to an array of T/F values.
Output: a vector of same nature of input array whose components are those corresponding
                to a TRUE value for the given condition. </p>
        </description>
        <input>
          <e type="operand">V</e>
          <e type="operand">cond</e>
          <e type="function" args="2">index</e>
          <e type="operand">j</e>
          <e type="operand">0</e>
          <e type="operator" args="2">:</e>
          <e type="operand">R</e>
          <e type="operand">0</e>
          <e type="operator" args="2">:</e>
          <e type="operand">c</e>
          <e type="operand">cond</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">i</e>
          <e type="operand">1</e>
          <e type="operand">V</e>
          <e type="function" args="1">length</e>
          <e type="function" args="2">range</e>
          <e type="operand">c</e>
          <e type="operand">i</e>
          <e type="function" args="2">el</e>
          <e type="operand">j</e>
          <e type="operand">j</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">R</e>
          <e type="operand">j</e>
          <e type="function" args="2">el</e>
          <e type="operand">V</e>
          <e type="operand">i</e>
          <e type="function" args="2">el</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">continue</e>
          <e type="function" args="3">if</e>
          <e type="function" args="3">for</e>
          <e type="operand">V</e>
          <e type="function" args="1">rows</e>
          <e type="operand">1</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">R</e>
          <e type="operand">R</e>
          <e type="function" args="1">transpose</e>
          <e type="function" args="3">if</e>
          <e type="function" args="1">eval</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="423" top="522" width="87" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
      <text lang="eng">
        <p>Examples:</p>
      </text>
    </region>
    <region left="423" top="549" width="326" height="27" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="operand">z1</e>
          <e type="operand">4</e>
          <e type="operator" args="2">&gt;</e>
          <e type="function" args="2">index</e>
        </input>
        <result action="numeric">
          <e type="operand">5.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
        </result>
      </math>
    </region>
    <region left="423" top="585" width="276" height="81" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="operand">z1</e>
          <e type="function" args="1">mdiff</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&gt;</e>
          <e type="function" args="2">index</e>
        </input>
        <result action="numeric">
          <e type="operand">4.0000</e>
          <e type="operand">2.0000</e>
          <e type="operand">7.0000</e>
          <e type="operand">3.0000</e>
          <e type="operand">4</e>
          <e type="operand">1</e>
          <e type="function" args="6">mat</e>
        </result>
      </math>
    </region>
    <region left="0" top="774" width="327" height="40" border="true" color="#000000" bgColor="#f9fed8" fontSize="10">
      <text lang="eng">
        <p>Function plotG(x; y; char; size; color)
Thanks to Omorr!! :-)</p>
      </text>
    </region>
    <region left="864" top="855" width="632" height="60" color="#000000" fontSize="10">
      <math evaluate="false">
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="operand">char</e>
          <e type="operand">size</e>
          <e type="operand">color</e>
          <e type="function" args="5">plotG</e>
          <e type="operand">k</e>
          <e type="operand">1</e>
          <e type="operand">x</e>
          <e type="function" args="1">rows</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="operand">r3</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">char</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r4</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">size</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r5</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">color</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="5">augment</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="0" top="864" width="638" height="60" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">xy</e>
          <e type="operand">char</e>
          <e type="operand">size</e>
          <e type="operand">color</e>
          <e type="function" args="4">plotG</e>
          <e type="operand">k</e>
          <e type="operand">1</e>
          <e type="operand">xy</e>
          <e type="function" args="1">rows</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">xy</e>
          <e type="operand">r3</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">char</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r4</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">size</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r5</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">color</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="4">augment</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="9" top="1098" width="583" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p>"Scalar" (loop based) version of mwfind. Can be improved using findrow?</p>
      </text>
    </region>
    <region left="45" top="1170" width="432" height="411" color="#000000" fontSize="10">
      <math decimalPlaces="7" trailingZeros="true">
        <input>
          <e type="operand">M</e>
          <e type="function" args="1">find</e>
          <e type="operand">rm</e>
          <e type="operand">M</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">cm</e>
          <e type="operand">M</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">lm</e>
          <e type="operand">cm</e>
          <e type="operand">rm</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">:</e>
          <e type="operand">gtzM</e>
          <e type="operand">M</e>
          <e type="operand">0</e>
          <e type="operator" args="2">≠</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">:</e>
          <e type="operand">nzM</e>
          <e type="operand">gtzM</e>
          <e type="bracket">(</e>
          <e type="function" args="1">sum</e>
          <e type="operator" args="2">:</e>
          <e type="operand">R</e>
          <e type="operand">nzM</e>
          <e type="operand">1</e>
          <e type="function" args="2">matrix</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C</e>
          <e type="operand">R</e>
          <e type="operator" args="2">:</e>
          <e type="operand">V</e>
          <e type="operand">R</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">jj</e>
          <e type="operand">1</e>
          <e type="operator" args="2">:</e>
          <e type="operand">ii</e>
          <e type="operand">1</e>
          <e type="operand">lm</e>
          <e type="function" args="2">range</e>
          <e type="operand">gtzM</e>
          <e type="operand">ii</e>
          <e type="function" args="2">el</e>
          <e type="operand">t</e>
          <e type="operand">ii</e>
          <e type="operand">cm</e>
          <e type="function" args="2">mod</e>
          <e type="operator" args="2">:</e>
          <e type="operand">R</e>
          <e type="operand">jj</e>
          <e type="function" args="2">el</e>
          <e type="operand">ii</e>
          <e type="operand">cm</e>
          <e type="operator" args="2">/</e>
          <e type="function" args="1">Ceil</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C</e>
          <e type="operand">jj</e>
          <e type="function" args="2">el</e>
          <e type="operand">t</e>
          <e type="operand">0</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">cm</e>
          <e type="operand">t</e>
          <e type="function" args="3">if</e>
          <e type="operator" args="2">:</e>
          <e type="operand">V</e>
          <e type="operand">jj</e>
          <e type="function" args="2">el</e>
          <e type="operand">M</e>
          <e type="operand">ii</e>
          <e type="function" args="2">el</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">jj</e>
          <e type="operand">jj</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</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">0</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="function" args="3">for</e>
          <e type="operand">R</e>
          <e type="operand">C</e>
          <e type="operand">V</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">mat</e>
          <e type="operand">9</e>
          <e type="operand">1</e>
          <e type="function" args="11">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="0" top="1674" width="713" height="96" border="true" color="#000000" bgColor="#f9fed8" fontSize="9">
      <text lang="eng">
        <p>Function map(x; y; fun(2))
Input: x, y: vectors or matrices with compatible sizes. fun: a function of 2 argumens
Output: vector or matrix whose elements are fun(el(x);el(y))
Apply a given function to corresponding elements of compatible arrays.
For info on the Matlab concept of "arrays of compatible sizes" please refer to:
https://it.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-operations.html</p>
      </text>
    </region>
    <region left="765" top="1755" width="647" height="24" color="#000000" fontSize="10">
      <text lang="eng">
        <p>Complete version, with error checking, but the other it's just a little faster.</p>
      </text>
    </region>
    <region left="765" top="1782" width="543" height="399" color="#000000" fontSize="10">
      <math evaluate="false" optimize="2" trailingZeros="true">
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="operand">2</e>
          <e type="function" args="1">fun</e>
          <e type="function" args="3">map</e>
          <e type="operand">xh</e>
          <e type="operand">x</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">xv</e>
          <e type="operand">x</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yh</e>
          <e type="operand">y</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yv</e>
          <e type="operand">y</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">2</e>
          <e type="operand">2</e>
          <e type="function" args="6">mat</e>
          <e type="operand">okx</e>
          <e type="operand">xh</e>
          <e type="operand">yh</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</e>
          <e type="operand">xh</e>
          <e type="operand">1</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</e>
          <e type="operand">yh</e>
          <e type="operand">1</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</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="operand">oky</e>
          <e type="operand">xv</e>
          <e type="operand">yv</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</e>
          <e type="operand">xv</e>
          <e type="operand">1</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</e>
          <e type="operand">yv</e>
          <e type="operand">1</e>
          <e type="operator" args="2">≡</e>
          <e type="bracket">(</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="operand">okx</e>
          <e type="operand">oky</e>
          <e type="operator" args="2">&amp;</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">y</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">xh</e>
          <e type="operand">yh</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">κ</e>
          <e type="operand">2</e>
          <e type="operand">yh</e>
          <e type="function" args="2">range</e>
          <e type="operand">X</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operand">xh</e>
          <e type="operand">yh</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">κ</e>
          <e type="operand">2</e>
          <e type="operand">xh</e>
          <e type="function" args="2">range</e>
          <e type="operand">Y</e>
          <e type="operand">Y</e>
          <e type="operand">y</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operand">1</e>
          <e type="function" args="3">if</e>
          <e type="function" args="3">if</e>
          <e type="operand">xv</e>
          <e type="operand">yv</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">κ</e>
          <e type="operand">2</e>
          <e type="operand">yv</e>
          <e type="function" args="2">range</e>
          <e type="operand">X</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operand">xv</e>
          <e type="operand">yv</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">κ</e>
          <e type="operand">2</e>
          <e type="operand">xv</e>
          <e type="function" args="2">range</e>
          <e type="operand">Y</e>
          <e type="operand">Y</e>
          <e type="operand">y</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
          <e type="operand">1</e>
          <e type="function" args="3">if</e>
          <e type="function" args="3">if</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="function" args="4">mat</e>
          <e type="operand">X</e>
          <e type="operand">Y</e>
          <e type="function" args="2">fun</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="operand" style="string">Incompatible sizes</e>
          <e type="function" args="1">error</e>
          <e type="function" args="3">if</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="1413" top="1782" width="256" height="279" color="#000000" fontSize="10">
      <math evaluate="false" trailingZeros="true">
        <input>
          <e type="operand">xc</e>
          <e type="operand">x</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">xr</e>
          <e type="operand">x</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yc</e>
          <e type="operand">y</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yr</e>
          <e type="operand">y</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">2</e>
          <e type="operand">2</e>
          <e type="function" args="6">mat</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">y</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">r</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="function" args="2">Max</e>
          <e type="operator" args="2">:</e>
          <e type="operand">c</e>
          <e type="operand">xc</e>
          <e type="operand">yc</e>
          <e type="function" args="2">Max</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">X</e>
          <e type="function" args="1">cols</e>
          <e type="operand">c</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">X</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="2">while</e>
          <e type="operand">Y</e>
          <e type="function" args="1">cols</e>
          <e type="operand">c</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">Y</e>
          <e type="operand">Y</e>
          <e type="operand">y</e>
          <e type="function" args="2">augment</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="2">while</e>
          <e type="operand">X</e>
          <e type="function" args="1">rows</e>
          <e type="operand">r</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">X</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="2">while</e>
          <e type="operand">Y</e>
          <e type="function" args="1">rows</e>
          <e type="operand">r</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">Y</e>
          <e type="operand">Y</e>
          <e type="operand">y</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="2">while</e>
          <e type="operand">X</e>
          <e type="function" args="1">eval</e>
          <e type="operand">Y</e>
          <e type="function" args="1">eval</e>
          <e type="function" args="2">fun</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="1">eval</e>
          <e type="operand">8</e>
          <e type="operand">1</e>
          <e type="function" args="10">line</e>
        </input>
      </math>
    </region>
    <region left="9" top="1800" width="417" height="562" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="operand">2</e>
          <e type="function" args="1">fun</e>
          <e type="function" args="3">map</e>
          <e type="operand">xc</e>
          <e type="operand">x</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">xr</e>
          <e type="operand">x</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yc</e>
          <e type="operand">y</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">yr</e>
          <e type="operand">y</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">2</e>
          <e type="operand">2</e>
          <e type="function" args="6">mat</e>
          <e type="operand">X</e>
          <e type="operand">x</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">y</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">xc</e>
          <e type="operand">yc</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">0</e>
          <e type="operand">xc</e>
          <e type="operand">yc</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">c</e>
          <e type="operand">1</e>
          <e type="operand">xc</e>
          <e type="operand">yc</e>
          <e type="operator" args="2">*</e>
          <e type="bracket">(</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">xr</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">X</e>
          <e type="operand">r</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</e>
          <e type="operand">X</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">c</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">xc</e>
          <e type="function" args="2">mod</e>
          <e type="operator" args="2">+</e>
          <e type="function" args="3">el</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">c</e>
          <e type="operand">1</e>
          <e type="operand">xc</e>
          <e type="operand">yc</e>
          <e type="operator" args="2">*</e>
          <e type="bracket">(</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">yr</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">r</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</e>
          <e type="operand">Y</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">c</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">yc</e>
          <e type="function" args="2">mod</e>
          <e type="operator" args="2">+</e>
          <e type="function" args="3">el</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">if</e>
          <e type="function" args="3">if</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">0</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">c</e>
          <e type="operand">1</e>
          <e type="operand">X</e>
          <e type="function" args="1">cols</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="operator" args="2">*</e>
          <e type="bracket">(</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">X</e>
          <e type="operand">r</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</e>
          <e type="operand">X</e>
          <e type="operand">1</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">xr</e>
          <e type="function" args="2">mod</e>
          <e type="operator" args="2">+</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</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">c</e>
          <e type="operand">1</e>
          <e type="operand">Y</e>
          <e type="function" args="1">cols</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="operator" args="2">*</e>
          <e type="bracket">(</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">r</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</e>
          <e type="operand">Y</e>
          <e type="operand">1</e>
          <e type="operand">r</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">yr</e>
          <e type="function" args="2">mod</e>
          <e type="operator" args="2">+</e>
          <e type="operand">c</e>
          <e type="function" args="3">el</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">if</e>
          <e type="function" args="3">if</e>
          <e type="operand">X</e>
          <e type="operand">Y</e>
          <e type="function" args="2">fun</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="1">eval</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="function" args="7">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="468" top="1827" width="146" height="26" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">plus</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="468" top="1863" width="146" height="26" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">times</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="468" top="1908" width="152" height="26" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">minus</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operator" args="2">-</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="468" top="1953" width="139" height="41" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">divide</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operator" args="2">/</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="1026" top="2322" width="339" height="103" border="true" color="#000000" bgColor="#ffff80" fontSize="10">
      <math evaluate="false" optimize="2" trailingZeros="true">
        <input>
          <e type="operand">X</e>
          <e type="operand">Y</e>
          <e type="function" args="2">fun</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">r</e>
          <e type="operand">xr</e>
          <e type="operand">yr</e>
          <e type="function" args="2">Max</e>
          <e type="operator" args="2">:</e>
          <e type="operand">c</e>
          <e type="operand">xc</e>
          <e type="operand">yc</e>
          <e type="function" args="2">Max</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">ρ</e>
          <e type="operand">1</e>
          <e type="operand">r</e>
          <e type="function" args="2">range</e>
          <e type="operand">χ</e>
          <e type="operand">1</e>
          <e type="operand">c</e>
          <e type="function" args="2">range</e>
          <e type="operand">Z</e>
          <e type="operand">ρ</e>
          <e type="operand">χ</e>
          <e type="function" args="3">el</e>
          <e type="operand">X</e>
          <e type="operand">ρ</e>
          <e type="operand">χ</e>
          <e type="function" args="3">el</e>
          <e type="operand">Y</e>
          <e type="operand">ρ</e>
          <e type="operand">χ</e>
          <e type="function" args="3">el</e>
          <e type="function" args="2">fun</e>
          <e type="operator" args="2">:</e>
          <e type="function" args="3">for</e>
          <e type="function" args="3">for</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="45" top="2394" width="87" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
      <text lang="eng">
        <p>Examples:</p>
      </text>
    </region>
    <region left="45" top="2430" width="590" height="100" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="operand">z2</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">times</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">4.0000</e>
          <e type="operand">12.0000</e>
          <e type="operand">20.0000</e>
          <e type="operand">32.0000</e>
          <e type="operand">36.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">2.0000</e>
          <e type="operand">6.0000</e>
          <e type="operand">10.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">18.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">7.0000</e>
          <e type="operand">21.0000</e>
          <e type="operand">35.0000</e>
          <e type="operand">56.0000</e>
          <e type="operand">63.0000</e>
          <e type="operand">28.0000</e>
          <e type="operand">3.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">15.0000</e>
          <e type="operand">24.0000</e>
          <e type="operand">27.0000</e>
          <e type="operand">12.0000</e>
          <e type="operand">1.0000</e>
          <e type="operand">3.0000</e>
          <e type="operand">5.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">4.0000</e>
          <e type="operand">5</e>
          <e type="operand">6</e>
          <e type="function" args="32">mat</e>
        </result>
      </math>
    </region>
    <region left="702" top="2430" width="590" height="100" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="operand">z1</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">times</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">4.0000</e>
          <e type="operand">12.0000</e>
          <e type="operand">20.0000</e>
          <e type="operand">32.0000</e>
          <e type="operand">36.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">2.0000</e>
          <e type="operand">6.0000</e>
          <e type="operand">10.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">18.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">7.0000</e>
          <e type="operand">21.0000</e>
          <e type="operand">35.0000</e>
          <e type="operand">56.0000</e>
          <e type="operand">63.0000</e>
          <e type="operand">28.0000</e>
          <e type="operand">3.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">15.0000</e>
          <e type="operand">24.0000</e>
          <e type="operand">27.0000</e>
          <e type="operand">12.0000</e>
          <e type="operand">1.0000</e>
          <e type="operand">3.0000</e>
          <e type="operand">5.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">4.0000</e>
          <e type="operand">5</e>
          <e type="operand">6</e>
          <e type="function" args="32">mat</e>
        </result>
      </math>
    </region>
    <region left="45" top="2529" width="288" height="100" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="operand">z2</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">times</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">16.0000</e>
          <e type="operand">4.0000</e>
          <e type="operand">49.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">1.0000</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="function" args="7">mat</e>
        </result>
      </math>
    </region>
    <region left="405" top="2556" width="582" height="28" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="operand">z1</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">times</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">1.0000</e>
          <e type="operand">9.0000</e>
          <e type="operand">25.0000</e>
          <e type="operand">64.0000</e>
          <e type="operand">81.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">1</e>
          <e type="operand">6</e>
          <e type="function" args="8">mat</e>
        </result>
      </math>
    </region>
    <region left="45" top="2628" width="566" height="28" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z1</e>
          <e type="operand">z1</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">plus</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">2.0000</e>
          <e type="operand">6.0000</e>
          <e type="operand">10.0000</e>
          <e type="operand">16.0000</e>
          <e type="operand">18.0000</e>
          <e type="operand">8.0000</e>
          <e type="operand">1</e>
          <e type="operand">6</e>
          <e type="function" args="8">mat</e>
        </result>
      </math>
    </region>
    <region left="396" top="2628" width="280" height="100" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">z2</e>
          <e type="operand">z2</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">plus</e>
          <e type="function" args="3">map</e>
        </input>
        <result action="numeric">
          <e type="operand">8.0000</e>
          <e type="operand">4.0000</e>
          <e type="operand">14.0000</e>
          <e type="operand">6.0000</e>
          <e type="operand">2.0000</e>
          <e type="operand">5</e>
          <e type="operand">1</e>
          <e type="function" args="7">mat</e>
        </result>
      </math>
    </region>
    <region left="18" top="2745" width="607" height="57" border="true" color="#000000" bgColor="#f9fed8" fontSize="10">
      <text lang="eng">
        <p>Function InterX(L1; L2)
Input: L1; L2 : 2-rows matrices of coords (Row1 = x-coord; Row2 = y-coord)
Output: 2-rows matricx of coords of intersecting points</p>
      </text>
    </region>
    <region left="18" top="2808" width="681" height="670" color="#000000" fontSize="9">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">L1</e>
          <e type="operand">L2</e>
          <e type="function" args="2">InterX</e>
          <e type="operand">x1</e>
          <e type="operand">L1</e>
          <e type="operand">1</e>
          <e type="function" args="2">row</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x2</e>
          <e type="operand">L2</e>
          <e type="operand">1</e>
          <e type="function" args="2">row</e>
          <e type="operator" args="2">:</e>
          <e type="operand">y1</e>
          <e type="operand">L1</e>
          <e type="operand">2</e>
          <e type="function" args="2">row</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
          <e type="operand">y2</e>
          <e type="operand">L2</e>
          <e type="operand">2</e>
          <e type="function" args="2">row</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">dx1</e>
          <e type="operand">x1</e>
          <e type="function" args="1">mdiff</e>
          <e type="operator" args="2">:</e>
          <e type="operand">dy1</e>
          <e type="operand">y1</e>
          <e type="function" args="1">mdiff</e>
          <e type="operator" args="2">:</e>
          <e type="operand">dx2</e>
          <e type="operand">x2</e>
          <e type="function" args="1">mdiff</e>
          <e type="operator" args="2">:</e>
          <e type="operand">dy2</e>
          <e type="operand">y2</e>
          <e type="function" args="1">mdiff</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">k</e>
          <e type="operand">1</e>
          <e type="operand">dx1</e>
          <e type="function" args="1">length</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">S1</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">dx1</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">y1</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operator" args="2">*</e>
          <e type="operand">dy1</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">x1</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">-</e>
          <e type="operator" args="2">:</e>
          <e type="operand">k</e>
          <e type="operand">1</e>
          <e type="operand">dx2</e>
          <e type="function" args="1">length</e>
          <e type="function" args="2">range</e>
          <e type="operator" args="2">:</e>
          <e type="operand">S2</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">dx2</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">y2</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operator" args="2">*</e>
          <e type="operand">dy2</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operand">x2</e>
          <e type="operand">k</e>
          <e type="function" args="2">el</e>
          <e type="operator" args="2">*</e>
          <e type="operator" args="2">-</e>
          <e type="operator" args="2">:</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">t</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">times</e>
          <e type="function" args="3">map</e>
          <e type="operator" args="2">:</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="operand">c</e>
          <e type="operand">d</e>
          <e type="function" args="4">T</e>
          <e type="operand">a</e>
          <e type="operand">b</e>
          <e type="function" args="2">t</e>
          <e type="operand">c</e>
          <e type="operand">d</e>
          <e type="function" args="2">t</e>
          <e type="operator" args="2">-</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="operand">y</e>
          <e type="function" args="2">D</e>
          <e type="operand">r</e>
          <e type="operand">x</e>
          <e type="function" args="1">rows</e>
          <e type="operator" args="2">:</e>
          <e type="operand">c</e>
          <e type="operand">x</e>
          <e type="function" args="1">cols</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">X</e>
          <e type="operand">x</e>
          <e type="operand">1</e>
          <e type="operand">r</e>
          <e type="function" args="2">range</e>
          <e type="operand">1</e>
          <e type="operand">c</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="bracket">(</e>
          <e type="function" args="2">range</e>
          <e type="function" args="3">el</e>
          <e type="operand">y</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">minus</e>
          <e type="function" args="3">map</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Y</e>
          <e type="operand">x</e>
          <e type="operand">1</e>
          <e type="operand">r</e>
          <e type="function" args="2">range</e>
          <e type="operand">2</e>
          <e type="operand">c</e>
          <e type="function" args="2">range</e>
          <e type="function" args="3">el</e>
          <e type="operand">y</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">minus</e>
          <e type="function" args="3">map</e>
          <e type="operator" args="2">:</e>
          <e type="operand">X</e>
          <e type="operand">Y</e>
          <e type="function" args="2">t</e>
          <e type="operand">4</e>
          <e type="operand">1</e>
          <e type="function" args="6">line</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C1</e>
          <e type="operand">dx1</e>
          <e type="operand">y2</e>
          <e type="operand">dy1</e>
          <e type="operand">x2</e>
          <e type="function" args="4">T</e>
          <e type="operand">S1</e>
          <e type="function" args="2">D</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C2</e>
          <e type="operand">y1</e>
          <e type="operand">dx2</e>
          <e type="operand">x1</e>
          <e type="operand">dy2</e>
          <e type="function" args="4">T</e>
          <e type="function" args="1">transpose</e>
          <e type="operand">S2</e>
          <e type="function" args="2">D</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C1</e>
          <e type="operand">C1</e>
          <e type="operand">0</e>
          <e type="operator" args="2">≤</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">:</e>
          <e type="operand">C2</e>
          <e type="operand">C2</e>
          <e type="operand">0</e>
          <e type="operator" args="2">≤</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="1">transpose</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">m</e>
          <e type="operand">n</e>
          <e type="operand">vals</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">C1</e>
          <e type="operand">C2</e>
          <e type="operator" args="2">&amp;</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="1">find</e>
          <e type="function" args="1">transpose</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">m</e>
          <e type="operand">m</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
          <e type="operand">dx2</e>
          <e type="operand">dx2</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
          <e type="operand">dy2</e>
          <e type="operand">dy2</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">L</e>
          <e type="operand">dy2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="operand">dx1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">dy1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">dx2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="function" args="4">T</e>
          <e type="operator" args="2">:</e>
          <e type="operand">Lo</e>
          <e type="operand">L</e>
          <e type="function" args="1">find</e>
          <e type="operand">1</e>
          <e type="function" args="2">el</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">m</e>
          <e type="operand">m</e>
          <e type="operand">Lo</e>
          <e type="function" args="2">el</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">n</e>
          <e type="operand">n</e>
          <e type="operand">Lo</e>
          <e type="function" args="2">el</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">L</e>
          <e type="operand">L</e>
          <e type="operand">Lo</e>
          <e type="function" args="2">el</e>
          <e type="function" args="1">eval</e>
          <e type="operator" args="2">:</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="function" args="5">mat</e>
          <e type="operand">P1</e>
          <e type="operand">dx2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="operand">S1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">dx1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">S2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="function" args="4">T</e>
          <e type="operator" args="2">:</e>
          <e type="operand">P2</e>
          <e type="operand">dy2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="operand">S1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">dy1</e>
          <e type="operand">m</e>
          <e type="function" args="2">el</e>
          <e type="operand">S2</e>
          <e type="operand">n</e>
          <e type="function" args="2">el</e>
          <e type="function" args="4">T</e>
          <e type="operator" args="2">:</e>
          <e type="operand">lc</e>
          <e type="operand">L</e>
          <e type="function" args="1">cols</e>
          <e type="operator" args="2">:</e>
          <e type="operand">P1</e>
          <e type="operand">P2</e>
          <e type="function" args="2">augment</e>
          <e type="operand">L</e>
          <e type="operand">1</e>
          <e type="operand">L</e>
          <e type="function" args="1">rows</e>
          <e type="function" args="2">range</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="operand">lc</e>
          <e type="function" args="2">range</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">lc</e>
          <e type="function" args="2">mod</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">+</e>
          <e type="function" args="3">el</e>
          <e type="operand">A</e>
          <e type="operand">B</e>
          <e type="function" args="2">divide</e>
          <e type="function" args="3">map</e>
          <e type="operand">9</e>
          <e type="operand">1</e>
          <e type="function" args="11">line</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="2">Zeros</e>
          <e type="function" args="2">try</e>
          <e type="operand">13</e>
          <e type="operand">1</e>
          <e type="function" args="15">line</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="783" top="2997" width="319" height="40" border="true" color="#000000" bgColor="#f9fed8" fontSize="10">
      <text lang="eng">
        <p>Function D(x; y)
Helper function for InterX. See below.</p>
      </text>
    </region>
    <region left="774" top="3438" width="101" height="26" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">to</e>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="9" top="3474" width="303" height="24" border="true" color="#000000" bgColor="#80ff80" fontSize="10">
      <text lang="eng">
        <p>Let's test it with a simple example:</p>
      </text>
    </region>
    <region left="9" top="3501" width="183" height="45" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">L1</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">3</e>
          <e type="operand">4</e>
          <e type="operand">5</e>
          <e type="operand">6</e>
          <e type="operand">8</e>
          <e type="operand">9</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">1</e>
          <e type="operand">2</e>
          <e type="operand">2</e>
          <e type="operand">0</e>
          <e type="operand">3</e>
          <e type="operand">0.5</e>
          <e type="operand">2</e>
          <e type="operand">8</e>
          <e type="function" args="18">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="252" top="3501" width="181" height="45" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">L2</e>
          <e type="operand">3</e>
          <e type="operand">4</e>
          <e type="operand">5</e>
          <e type="operand">6</e>
          <e type="operand">6</e>
          <e type="operand">5</e>
          <e type="operand">7</e>
          <e type="operand">9</e>
          <e type="operand">7</e>
          <e type="operand">0</e>
          <e type="operand">1</e>
          <e type="operand">3</e>
          <e type="operand">3</e>
          <e type="operand">2</e>
          <e type="operand">0</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="operand">4</e>
          <e type="operand">2</e>
          <e type="operand">9</e>
          <e type="function" args="20">mat</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="774" top="3501" width="293" height="136" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">tt</e>
          <e type="operand">L1</e>
          <e type="operand">L2</e>
          <e type="function" args="2">InterX</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="numeric">
          <e type="operand">4.5000</e>
          <e type="operand">2.0000</e>
          <e type="operand">5.5000</e>
          <e type="operand">1.0000</e>
          <e type="operand">5.6667</e>
          <e type="operand">0.6667</e>
          <e type="operand">7.2500</e>
          <e type="operand">1.8750</e>
          <e type="operand">7.8333</e>
          <e type="operand">2.7500</e>
          <e type="operand">8.7500</e>
          <e type="operand">1.1250</e>
          <e type="operand">8.5000</e>
          <e type="operand">1.7500</e>
          <e type="operand">7</e>
          <e type="operand">2</e>
          <e type="function" args="16">mat</e>
        </result>
      </math>
    </region>
    <region left="18" top="3564" width="373" height="28" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">plot1</e>
          <e type="operand">L1</e>
          <e type="operand">L2</e>
          <e type="function" args="2">InterX</e>
          <e type="operand" style="string">o</e>
          <e type="operand">12</e>
          <e type="operand" style="string">Green</e>
          <e type="function" args="4">plotG</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="18" top="3600" width="702" height="252" color="#000000" fontSize="10" showInputData="false">
      <plot type="2d" render="lines" scale_x="3.13631992578674" scale_y="3.13631992578674" scale_z="3.13631992578674" rotate_x="0" rotate_y="0" rotate_z="0" transpose_x="-315" transpose_y="-109" transpose_z="0">
        <input>
          <e type="operand">L1</e>
          <e type="function" args="1">transpose</e>
          <e type="operand">L2</e>
          <e type="function" args="1">transpose</e>
          <e type="operand">plot1</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">sys</e>
        </input>
      </plot>
    </region>
    <region left="9" top="3879" width="255" height="24" border="true" color="#000000" bgColor="#80ff80" fontSize="10">
      <text lang="eng">
        <p>and a bit more complicate one:</p>
      </text>
    </region>
    <region left="9" top="3906" width="180" height="52" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">t</e>
          <e type="operand">0</e>
          <e type="operand">2</e>
          <e type="operand">π</e>
          <e type="operator" args="2">*</e>
          <e type="bracket">(</e>
          <e type="operand">2</e>
          <e type="operand">π</e>
          <e type="operand">100</e>
          <e type="operator" args="2">/</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="3">range</e>
          <e type="function" args="1">transpose</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="252" top="3906" width="136" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">r1</e>
          <e type="operand">4</e>
          <e type="operand">t</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">sin</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">2</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="477" top="3906" width="136" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">r2</e>
          <e type="operand">8</e>
          <e type="operand">t</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">sin</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">2</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="9" top="3960" width="87" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">c</e>
          <e type="operand">t</e>
          <e type="function" args="1">cos</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="135" top="3960" width="87" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">s</e>
          <e type="operand">t</e>
          <e type="function" args="1">sin</e>
          <e type="function" args="1">vectorize</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="252" top="3960" width="195" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">xy1</e>
          <e type="operand">r1</e>
          <e type="operand">c</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">r1</e>
          <e type="operand">s</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="477" top="3960" width="195" height="32" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">xy2</e>
          <e type="operand">r2</e>
          <e type="operand">c</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">vectorize</e>
          <e type="operand">r2</e>
          <e type="operand">s</e>
          <e type="operator" args="2">*</e>
          <e type="function" args="1">vectorize</e>
          <e type="function" args="2">stack</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="9" top="4014" width="175" height="26" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">XY</e>
          <e type="operand">xy1</e>
          <e type="operand">xy2</e>
          <e type="function" args="2">InterX</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="360" top="4014" width="277" height="26" color="#000000" fontSize="10">
      <math optimize="2" trailingZeros="true">
        <input>
          <e type="operand">plot2</e>
          <e type="operand">XY</e>
          <e type="operand" style="string">o</e>
          <e type="operand">12</e>
          <e type="operand" style="string">Green</e>
          <e type="function" args="4">plotG</e>
          <e type="operator" args="2">:</e>
        </input>
      </math>
    </region>
    <region left="9" top="4050" width="715" height="319" color="#000000" fontSize="10">
      <plot type="2d" render="lines" scale_x="3.74005008361004" scale_y="7.21541655725944" scale_z="7.93695821298538" rotate_x="0" rotate_y="0" rotate_z="0" transpose_x="-6" transpose_y="5" transpose_z="0">
        <input>
          <e type="operand">xy1</e>
          <e type="function" args="1">transpose</e>
          <e type="operand">xy2</e>
          <e type="function" args="1">transpose</e>
          <e type="operand">plot2</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">sys</e>
        </input>
      </plot>
    </region>
    <region left="801" top="4086" width="186" height="299" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">XY</e>
        </input>
        <result action="numeric">
          <e type="operand">2</e>
          <e type="operand">0</e>
          <e type="operand">2.7616</e>
          <e type="operand">0.7338</e>
          <e type="operand">1.3998</e>
          <e type="operand">1.4052</e>
          <e type="operand">0.2939</e>
          <e type="operand">1.0978</e>
          <e type="operand">0</e>
          <e type="operand">2</e>
          <e type="operand">0.7338</e>
          <e type="operator" args="1">-</e>
          <e type="operand">2.7616</e>
          <e type="operand">1.4052</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.3998</e>
          <e type="operand">1.0978</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0.2939</e>
          <e type="operand">2</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0</e>
          <e type="operand">2.7616</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0.7338</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.3998</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.4052</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0.2939</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.0978</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0</e>
          <e type="operand">2</e>
          <e type="operator" args="1">-</e>
          <e type="operand">0.7338</e>
          <e type="operand">2.7616</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.4052</e>
          <e type="operand">1.3998</e>
          <e type="operator" args="1">-</e>
          <e type="operand">1.0978</e>
          <e type="operand">0.2939</e>
          <e type="operator" args="1">-</e>
          <e type="operand">16</e>
          <e type="operand">2</e>
          <e type="function" args="34">mat</e>
        </result>
      </math>
    </region>
    <region left="792" top="4392" width="183" height="26" color="#000000" fontSize="10">
      <math trailingZeros="true">
        <input>
          <e type="operand">0</e>
          <e type="function" args="1">time</e>
          <e type="operand">to</e>
          <e type="operator" args="2">-</e>
        </input>
        <result action="numeric">
          <e type="operand">11.9310</e>
          <e type="operand" style="unit">s</e>
          <e type="operator" args="2">*</e>
        </result>
      </math>
    </region>
  </regions>
</worksheet>