﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?application progid="SMath Studio Desktop" version="0.98.6484.11448"?>
<regions xmlns="http://smath.info/schemas/worksheet/1.0">
  <settings>
    <identity>
      <id>8756e0b0-4786-49cc-b282-8d7a293f7675</id>
      <revision>91</revision>
    </identity>
    <metadata lang="eng">
      <title>Functions for line intersections</title>
      <author>Marco Bernacca</author>
    </metadata>
    <calculation>
      <precision>4</precision>
      <exponentialThreshold>5</exponentialThreshold>
      <fractions>decimal</fractions>
    </calculation>
    <pageModel active="true" 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.98.6484.11448" guid="a37cba83-b69c-4c71-9992-55ff666763bd" />
      <assembly name="Math Region" version="0.98.6484.11448" guid="02f1ab51-215b-466e-a74d-5d8b1cf85e8d" />
      <assembly name="Special Functions" version="1.11.6484.11450" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
      <assembly name="Text Region" version="1.10.6484.11451" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
      <assembly name="Plot Region" version="1.9.6484.11451" guid="c451c2b5-798b-4f08-b9ec-b90963d1ddaa" />
    </dependencies>
  </settings>
  <region id="0" left="0" top="0" width="729" height="88" color="#000000" bgColor="#ffffff" 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 id="1" left="9" top="108" width="657" height="72" 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 id="2" left="9" top="189" width="495" height="95" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <description active="false" position="Top" 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).</p>
      </description>
      <input>
        <e type="operand">V</e>
        <e type="function" args="1">mdiff</e>
        <e type="operand">R</e>
        <e type="operand">V</e>
        <e type="function" args="1">rows</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="bracket">(</e>
        <e type="operator" args="2">-</e>
        <e type="operand">V</e>
        <e type="function" args="1">cols</e>
        <e type="operand">V</e>
        <e type="function" args="1">cols</e>
        <e type="operand">1</e>
        <e type="operator" args="2">&gt;</e>
        <e type="bracket">(</e>
        <e type="operator" args="2">-</e>
        <e type="function" args="2">matrix</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ii</e>
        <e type="operand">1</e>
        <e type="operand">R</e>
        <e type="function" args="1">length</e>
        <e type="function" args="2">range</e>
        <e type="operand">R</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">V</e>
        <e type="operand">ii</e>
        <e type="operand">1</e>
        <e type="operator" args="2">+</e>
        <e type="function" args="2">el</e>
        <e type="operand">V</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operator" args="2">-</e>
        <e type="operator" args="2">:</e>
        <e type="function" args="3">for</e>
        <e type="operand">R</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 id="3" left="513" top="225" width="86" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
    <text lang="eng">
      <p>Examples:</p>
    </text>
  </region>
  <region id="4" left="558" top="252" width="61" height="99" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="5" left="621" top="261" width="133" height="81" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">z2</e>
        <e type="function" args="1">mdiff</e>
      </input>
      <result action="numeric">
        <e type="operand">2</e>
        <e type="operator" args="1">-</e>
        <e type="operand">5</e>
        <e type="operand">4</e>
        <e type="operator" args="1">-</e>
        <e type="operand">2</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 id="6" left="396" top="270" width="141" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="7" left="351" top="297" width="197" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">z1</e>
        <e type="function" args="1">mdiff</e>
      </input>
      <result action="numeric">
        <e type="operand">2</e>
        <e type="operand">2</e>
        <e type="operand">3</e>
        <e type="operand">1</e>
        <e type="operand">5</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 id="8" left="0" top="360" width="746" height="72" 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 id="9" left="9" top="441" width="354" height="268" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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">R</e>
        <e type="operand">V</e>
        <e type="function" args="1">rows</e>
        <e type="operand">V</e>
        <e type="function" args="1">cols</e>
        <e type="function" args="2">matrix</e>
        <e type="operator" args="2">:</e>
        <e type="operand">j</e>
        <e type="operand">0</e>
        <e type="operator" args="2">:</e>
        <e type="operand">V.end</e>
        <e type="operand">V</e>
        <e type="function" args="1">length</e>
        <e type="operator" args="2">:</e>
        <e type="operand">1</e>
        <e type="operand">2</e>
        <e type="function" args="4">mat</e>
        <e type="operand">i</e>
        <e type="operand">1</e>
        <e type="operand">V.end</e>
        <e type="function" args="2">range</e>
        <e type="operand">cond</e>
        <e type="function" args="1">vectorize</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">R</e>
        <e type="function" args="1">rows</e>
        <e type="operand">1</e>
        <e type="operator" args="2">&gt;</e>
        <e type="bracket">(</e>
        <e type="operand">R</e>
        <e type="operand">1</e>
        <e type="operand">j</e>
        <e type="operand">1</e>
        <e type="operand">1</e>
        <e type="function" args="5">submatrix</e>
        <e type="operand">R</e>
        <e type="operand">1</e>
        <e type="operand">1</e>
        <e type="operand">1</e>
        <e type="operand">j</e>
        <e type="function" args="5">submatrix</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 id="10" left="504" top="459" width="86" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
    <text lang="eng">
      <p>Examples:</p>
    </text>
  </region>
  <region id="11" left="504" top="486" width="209" height="27" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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</e>
        <e type="operand">8</e>
        <e type="operand">9</e>
        <e type="operand">1</e>
        <e type="operand">3</e>
        <e type="function" args="5">mat</e>
      </result>
    </math>
  </region>
  <region id="12" left="504" top="522" width="230" height="81" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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</e>
        <e type="operand">2</e>
        <e type="operand">7</e>
        <e type="operand">3</e>
        <e type="operand">4</e>
        <e type="operand">1</e>
        <e type="function" args="6">mat</e>
      </result>
    </math>
  </region>
  <region id="13" left="0" top="747" width="331" height="56" 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 id="14" left="0" top="801" width="729" height="121" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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">n</e>
        <e type="operand">x</e>
        <e type="function" args="1">length</e>
        <e type="operator" args="2">:</e>
        <e type="operand">plot</e>
        <e type="operand">x</e>
        <e type="operand">1</e>
        <e type="function" args="2">el</e>
        <e type="operand">y</e>
        <e type="operand">1</e>
        <e type="function" args="2">el</e>
        <e type="operand">char</e>
        <e type="operand">size</e>
        <e type="operand">color</e>
        <e type="function" args="5">augment</e>
        <e type="operator" args="2">:</e>
        <e type="operand">i</e>
        <e type="operand">2</e>
        <e type="operand">n</e>
        <e type="function" args="2">range</e>
        <e type="operand">plot</e>
        <e type="operand">plot</e>
        <e type="operand">x</e>
        <e type="operand">i</e>
        <e type="function" args="2">el</e>
        <e type="operand">y</e>
        <e type="operand">i</e>
        <e type="function" args="2">el</e>
        <e type="operand">char</e>
        <e type="operand">size</e>
        <e type="operand">color</e>
        <e type="function" args="5">augment</e>
        <e type="function" args="2">stack</e>
        <e type="operator" args="2">:</e>
        <e type="function" args="3">for</e>
        <e type="operand">plot</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 id="15" left="0" top="1071" width="731" height="98" 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 id="16" left="9" top="1170" width="133" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="17" left="153" top="1170" width="135" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="18" left="297" top="1170" width="141" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="19" left="450" top="1170" width="132" height="41" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="20" left="9" top="1197" width="475" height="591" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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="bracket">(</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="bracket">(</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">xx</e>
        <e type="operand">x</e>
        <e type="operator" args="2">:</e>
        <e type="operand">yy</e>
        <e type="operand">y</e>
        <e type="operator" args="2">:</e>
        <e type="operand">xh</e>
        <e type="operand">yh</e>
        <e type="operator" args="2">&lt;</e>
        <e type="operand">ii</e>
        <e type="operand">2</e>
        <e type="operand">yh</e>
        <e type="function" args="2">range</e>
        <e type="operand">xx</e>
        <e type="operand">xx</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">xh</e>
        <e type="operand">yh</e>
        <e type="operator" args="2">&gt;</e>
        <e type="operand">ii</e>
        <e type="operand">2</e>
        <e type="operand">xh</e>
        <e type="function" args="2">range</e>
        <e type="operand">yy</e>
        <e type="operand">yy</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="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">ii</e>
        <e type="operand">2</e>
        <e type="operand">yv</e>
        <e type="function" args="2">range</e>
        <e type="operand">xx</e>
        <e type="operand">xx</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">xv</e>
        <e type="operand">yv</e>
        <e type="operator" args="2">&gt;</e>
        <e type="operand">ii</e>
        <e type="operand">2</e>
        <e type="operand">xv</e>
        <e type="function" args="2">range</e>
        <e type="operand">yy</e>
        <e type="operand">yy</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="function" args="3">if</e>
        <e type="function" args="3">if</e>
        <e type="operand">hv</e>
        <e type="operand">xv</e>
        <e type="operand">yv</e>
        <e type="function" args="2">Max</e>
        <e type="operator" args="2">:</e>
        <e type="operand">hx</e>
        <e type="operand">xh</e>
        <e type="operand">yh</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">ii</e>
        <e type="operand">1</e>
        <e type="operand">hv</e>
        <e type="function" args="2">range</e>
        <e type="operand">jj</e>
        <e type="operand">1</e>
        <e type="operand">hx</e>
        <e type="function" args="2">range</e>
        <e type="operand">zz</e>
        <e type="operand">ii</e>
        <e type="operand">jj</e>
        <e type="function" args="3">el</e>
        <e type="operand">xx</e>
        <e type="operand">ii</e>
        <e type="operand">jj</e>
        <e type="function" args="3">el</e>
        <e type="operand">yy</e>
        <e type="operand">ii</e>
        <e type="operand">jj</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">zz</e>
        <e type="operand">7</e>
        <e type="operand">1</e>
        <e type="function" args="9">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 id="21" left="405" top="1791" width="361" height="99" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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</e>
        <e type="operand">12</e>
        <e type="operand">20</e>
        <e type="operand">32</e>
        <e type="operand">36</e>
        <e type="operand">16</e>
        <e type="operand">2</e>
        <e type="operand">6</e>
        <e type="operand">10</e>
        <e type="operand">16</e>
        <e type="operand">18</e>
        <e type="operand">8</e>
        <e type="operand">7</e>
        <e type="operand">21</e>
        <e type="operand">35</e>
        <e type="operand">56</e>
        <e type="operand">63</e>
        <e type="operand">28</e>
        <e type="operand">3</e>
        <e type="operand">9</e>
        <e type="operand">15</e>
        <e type="operand">24</e>
        <e type="operand">27</e>
        <e type="operand">12</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">5</e>
        <e type="operand">6</e>
        <e type="function" args="32">mat</e>
      </result>
    </math>
  </region>
  <region id="22" left="477" top="1800" width="86" height="24" color="#000000" bgColor="#80ff80" fontSize="10">
    <text lang="eng">
      <p>Examples:</p>
    </text>
  </region>
  <region id="23" left="414" top="1890" width="337" height="28" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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</e>
        <e type="operand">6</e>
        <e type="operand">10</e>
        <e type="operand">16</e>
        <e type="operand">18</e>
        <e type="operand">8</e>
        <e type="operand">1</e>
        <e type="operand">6</e>
        <e type="function" args="8">mat</e>
      </result>
    </math>
  </region>
  <region id="24" left="414" top="1917" width="241" height="99" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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</e>
        <e type="operand">4</e>
        <e type="operand">14</e>
        <e type="operand">6</e>
        <e type="operand">2</e>
        <e type="operand">5</e>
        <e type="operand">1</e>
        <e type="function" args="7">mat</e>
      </result>
    </math>
  </region>
  <region id="25" left="0" top="2016" width="324" 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 id="26" left="0" top="2061" width="1138" height="32" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">x</e>
        <e type="operand">y</e>
        <e type="function" args="2">D</e>
        <e type="operand">x</e>
        <e type="operand">1</e>
        <e type="operand">x</e>
        <e type="function" args="1">rows</e>
        <e type="operand">1</e>
        <e type="operand">x</e>
        <e type="function" args="1">cols</e>
        <e type="operand">1</e>
        <e type="operator" args="2">-</e>
        <e type="function" args="5">submatrix</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="operand">x</e>
        <e type="operand">1</e>
        <e type="operand">x</e>
        <e type="function" args="1">rows</e>
        <e type="operand">2</e>
        <e type="operand">x</e>
        <e type="function" args="1">cols</e>
        <e type="function" args="5">submatrix</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="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>
      </input>
    </math>
  </region>
  <region id="27" left="9" top="2142" width="616" height="56" 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 id="28" left="0" top="2205" width="728" height="788" color="#000000" bgColor="#ffffff" fontSize="9">
    <math>
      <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">dx1</e>
        <e type="operand">x1</e>
        <e type="function" args="1">mdiff</e>
        <e type="function" args="1">eval</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="function" args="1">eval</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="function" args="1">eval</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ii</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="operand">S1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">dx1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">y1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operator" args="2">*</e>
        <e type="operand">dy1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">x1</e>
        <e type="operand">ii</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="function" args="3">for</e>
        <e type="operand">ii</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="operand">S2</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">dx2</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">y2</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operator" args="2">*</e>
        <e type="operand">dy2</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">x2</e>
        <e type="operand">ii</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="function" args="3">for</e>
        <e type="operand">S2</e>
        <e type="operand">S2</e>
        <e type="function" args="1">transpose</e>
        <e type="function" args="1">eval</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">A</e>
        <e type="operand">B</e>
        <e type="function" args="2">times</e>
        <e type="function" args="3">map</e>
        <e type="operand">dy1</e>
        <e type="operand">x2</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">S1</e>
        <e type="function" args="2">D</e>
        <e type="operand">0</e>
        <e type="function" args="2">mwle</e>
        <e type="function" args="1">eval</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">A</e>
        <e type="operand">B</e>
        <e type="function" args="2">times</e>
        <e type="function" args="3">map</e>
        <e type="operand">x1</e>
        <e type="operand">dy2</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="bracket">(</e>
        <e type="function" args="1">transpose</e>
        <e type="operand">S2</e>
        <e type="function" args="1">transpose</e>
        <e type="function" args="2">D</e>
        <e type="operand">0</e>
        <e type="function" args="2">mwle</e>
        <e type="function" args="1">transpose</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ff</e>
        <e type="operand">C1</e>
        <e type="operand">C2</e>
        <e type="function" args="2">mwand</e>
        <e type="function" args="1">mwfind</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ii</e>
        <e type="operand">ff</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">jj</e>
        <e type="operand">ff</e>
        <e type="operand">2</e>
        <e type="function" args="2">el</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ii</e>
        <e type="function" args="1">length</e>
        <e type="operand">0</e>
        <e type="operator" args="2">≡</e>
        <e type="operand">2</e>
        <e type="operand">1</e>
        <e type="function" args="2">Zeros</e>
        <e type="operand">ii</e>
        <e type="operand">ii</e>
        <e type="function" args="1">transpose</e>
        <e type="function" args="1">eval</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="function" args="1">eval</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">S2</e>
        <e type="operand">S2</e>
        <e type="function" args="1">transpose</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">L</e>
        <e type="operand">dy2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</e>
        <e type="operand">dx1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</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="operand">dy1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">dx2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">ii</e>
        <e type="operand">ii</e>
        <e type="operand">L</e>
        <e type="operand">0</e>
        <e type="operator" args="2">≠</e>
        <e type="function" args="2">index</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">jj</e>
        <e type="operand">jj</e>
        <e type="operand">L</e>
        <e type="operand">0</e>
        <e type="operator" args="2">≠</e>
        <e type="function" args="2">index</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">L</e>
        <e type="operand">0</e>
        <e type="operator" args="2">≠</e>
        <e type="function" args="2">index</e>
        <e type="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">PP1</e>
        <e type="operand">dx2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</e>
        <e type="operand">S1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</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="operand">dx1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">S2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">PP2</e>
        <e type="operand">dy2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</e>
        <e type="operand">S1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</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="operand">dy1</e>
        <e type="operand">ii</e>
        <e type="function" args="2">el</e>
        <e type="operand">S2</e>
        <e type="operand">jj</e>
        <e type="function" args="2">el</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">PP</e>
        <e type="operand">PP1</e>
        <e type="operand">PP2</e>
        <e type="function" args="2">augment</e>
        <e type="operand">L</e>
        <e type="operand">L</e>
        <e type="function" args="2">augment</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="function" args="1">eval</e>
        <e type="operator" args="2">:</e>
        <e type="operand">PP</e>
        <e type="operand">12</e>
        <e type="operand">1</e>
        <e type="function" args="14">line</e>
        <e type="function" args="3">if</e>
        <e type="operand">17</e>
        <e type="operand">1</e>
        <e type="function" args="19">line</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="29" left="9" top="3006" width="306" 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 id="30" left="9" top="3033" width="190" height="45" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="31" left="279" top="3033" width="189" height="45" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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 id="32" left="450" top="3069" width="293" height="135" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <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.5</e>
        <e type="operand">2</e>
        <e type="operand">5.5</e>
        <e type="operand">1</e>
        <e type="operand">5.6667</e>
        <e type="operand">0.6667</e>
        <e type="operand">7.25</e>
        <e type="operand">1.875</e>
        <e type="operand">8.75</e>
        <e type="operand">1.125</e>
        <e type="operand">7.8333</e>
        <e type="operand">2.75</e>
        <e type="operand">8.5</e>
        <e type="operand">1.75</e>
        <e type="operand">7</e>
        <e type="operand">2</e>
        <e type="function" args="16">mat</e>
      </result>
    </math>
  </region>
  <region id="33" left="18" top="3168" width="438" height="28" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">plot1</e>
        <e type="operand">tt</e>
        <e type="operand">1</e>
        <e type="function" args="2">col</e>
        <e type="operand">tt</e>
        <e type="operand">2</e>
        <e type="function" args="2">col</e>
        <e type="operand" style="string">o</e>
        <e type="operand">12</e>
        <e type="operand" style="string">Green</e>
        <e type="function" args="5">plotG</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="34" left="27" top="3222" width="702" height="252" color="#000000" bgColor="#ffffff" 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="-308" transpose_y="-100" 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>
</regions>