﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?application progid="SMath Studio Desktop" version="0.97.5581.25383"?>
<regions>
  <settings>
    <identity>
      <id>a592a616-7465-4627-b22e-98d2603eab9b</id>
      <revision>5</revision>
    </identity>
    <calculation>
      <precision>4</precision>
      <exponentialThreshold>5</exponentialThreshold>
      <fractions>decimal</fractions>
    </calculation>
    <pageModel active="true" printAreas="true" simpleEqualsOnly="false" printBackgroundImages="true">
      <paper id="1" orientation="Portrait" width="850" height="1100" />
      <margins left="39" right="39" top="39" bottom="39" />
      <header alignment="Center" color="#a9a9a9">&amp;[DATE] &amp;[TIME] - &amp;[FILENAME]</header>
      <footer alignment="Center" color="#a9a9a9">&amp;[PAGENUM] / &amp;[COUNT]</footer>
      <backgrounds />
    </pageModel>
    <dependences>
      <assembly name="SMath Studio Desktop" version="0.97.5581.25383" guid="a37cba83-b69c-4c71-9992-55ff666763bd" />
      <assembly name="Text Region" version="1.10.5581.23407" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
      <assembly name="Math Region" version="0.97.5581.25383" guid="02f1ab51-215b-466e-a74d-5d8b1cf85e8d" />
      <assembly name="Conditional Expression Evaluation, String to Hash, and .txt I/O" version="0.0.1.0" guid="e40eaef6-4622-4ef3-ad03-077e8f005bb1" />
      <assembly name="Special Functions" version="1.11.5581.23401" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
    </dependences>
  </settings>
  <region id="0" left="36" top="18" width="177" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" underline="true">Text I/O and Hashing</p>
    </text>
  </region>
  <region id="1" left="72" top="63" width="142" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">string</e>
        <e type="operand" style="string">string</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="2" left="234" top="63" width="167" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">txtPATH</e>
        <e type="operand" style="string">C:\1.txt</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="3" left="72" top="90" width="248" height="34" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">string</e>
        <e type="function" preserve="true" args="1">txt_HASH</e>
      </input>
      <result action="numeric">
        <e type="operand">5.3772</e>
        <e type="operand">10</e>
        <e type="operand">8</e>
        <e type="operator" args="2">^</e>
        <e type="operator" args="2">*</e>
      </result>
    </math>
  </region>
  <region id="4" left="342" top="99" width="257" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" italic="true">numeric hash value of a string</p>
    </text>
  </region>
  <region id="5" left="72" top="144" width="229" height="26" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">txtPATH</e>
        <e type="operand">string</e>
        <e type="function" preserve="true" args="2">txt_IN</e>
      </input>
      <result action="numeric">
        <e type="operand">1</e>
      </result>
    </math>
  </region>
  <region id="6" left="342" top="144" width="175" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" italic="true">write string to file</p>
    </text>
  </region>
  <region id="7" left="72" top="189" width="231" height="26" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">txtPATH</e>
        <e type="function" preserve="true" args="1">txt_OUT</e>
      </input>
      <result action="numeric">
        <e type="operand" style="string">string</e>
      </result>
    </math>
  </region>
  <region id="8" left="342" top="189" width="184" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" italic="true">read string from file</p>
    </text>
  </region>
  <region id="9" left="36" top="234" width="283" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" underline="true">Conditional Expression Evaluation</p>
    </text>
  </region>
  <region id="10" left="36" top="270" width="388" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>SMath workbook must be saved before proceeding</p>
    </text>
  </region>
  <region id="11" left="36" top="306" width="709" height="72" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>Let's say we would like to evaluate simple expression c:=a+b only if either a or b changed. In order to do that, every time expression is evaluated, a log entry will be created with its Expression ID (say ID#1), hash of the input (say a*b) and resultingoutput c:+a+b</p>
    </text>
  </region>
  <region id="12" left="72" top="387" width="175" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">ExpressionID</e>
        <e type="operand" style="string">ID#1</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="13" left="72" top="423" width="51" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">a</e>
        <e type="operand">45</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="14" left="162" top="423" width="51" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">b</e>
        <e type="operand">36</e>
        <e type="operator" args="2">:</e>
      </input>
    </math>
  </region>
  <region id="15" left="72" top="459" width="105" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">c</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">+</e>
        <e type="operator" args="2">:</e>
      </input>
      <result action="numeric">
        <e type="operand">81</e>
      </result>
    </math>
  </region>
  <region id="16" left="72" top="495" width="261" height="26" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="function" preserve="true" args="2">log_OUT</e>
      </input>
      <result action="numeric">
        <e type="operand">81</e>
      </result>
    </math>
  </region>
  <region id="17" left="36" top="531" width="667" height="40" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>log_OUT function tries to read log entry that starts with ID#1, does not find itand suggests that expression must be recalculated and log entry saved.</p>
    </text>
  </region>
  <region id="18" left="72" top="585" width="276" height="26" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="operand">c</e>
        <e type="function" preserve="true" args="3">log_IN</e>
      </input>
      <result action="numeric">
        <e type="operand">81</e>
      </result>
    </math>
  </region>
  <region id="19" left="36" top="621" width="684" height="56" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>log_IN fuction converts input a+b to hash code, and writes a log entry similar to:"ID#1"-#BREAK#-HASHCODE-#BREAK#-EXPRESSIONOUTPUT</p>
    </text>
  </region>
  <region id="20" left="36" top="693" width="635" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>Now log_OUT function can pick up stored output instead of evaluating c:=a+b.</p>
    </text>
  </region>
  <region id="21" left="72" top="729" width="261" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="function" preserve="true" args="2">log_OUT</e>
      </input>
      <result action="numeric">
        <e type="operand">81</e>
      </result>
    </math>
  </region>
  <region id="22" left="36" top="765" width="458" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>I will  clear the log file so the cycle can be repeated</p>
    </text>
  </region>
  <region id="23" left="72" top="801" width="295" height="26" color="#000000" bgColor="#ffffff" fontSize="10">
    <math>
      <input>
        <e type="operand" style="string">CondRecalc.sm.txt</e>
        <e type="operand" style="string" />
        <e type="function" preserve="true" args="2">txt_IN</e>
      </input>
      <result action="numeric">
        <e type="operand">1</e>
      </result>
    </math>
  </region>
  <region id="24" left="36" top="837" width="480" height="24" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p bold="true" underline="true">Condensed if() Loop for Conditional Expression Evaluation</p>
    </text>
  </region>
  <region id="25" left="36" top="873" width="723" height="40" color="#000000" bgColor="#ffffff" fontSize="10">
    <text lang="eng">
      <p>If() loop below will ONLY evaluate if it cannot find logged function output for a givenexpression ID and input value</p>
    </text>
  </region>
  <region id="26" left="36" top="918" width="406" height="78" color="#000000" bgColor="#80ffff" fontSize="10">
    <math>
      <input>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="function" preserve="true" args="2">log_OUT</e>
        <e type="operand" style="string">recalculate</e>
        <e type="operator" args="2">≡</e>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="operand">c</e>
        <e type="function" preserve="true" args="3">log_IN</e>
        <e type="operand">ExpressionID</e>
        <e type="operand">a</e>
        <e type="operand">b</e>
        <e type="operator" args="2">*</e>
        <e type="function" preserve="true" args="2">log_OUT</e>
        <e type="function" preserve="true" args="3">if</e>
      </input>
      <result action="numeric">
        <e type="operand">81</e>
      </result>
    </math>
  </region>
</regions>