﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?application progid="SMath Studio Desktop" version="0.99.7822.147"?>
<worksheet xmlns="http://smath.info/schemas/worksheet/1.0">
  <settings ppi="96">
    <identity>
      <id>97ceae7c-dc38-4574-a7d1-be9893d9bf3d</id>
      <revision>6</revision>
    </identity>
    <calculation>
      <precision>4</precision>
      <exponentialThreshold>5</exponentialThreshold>
      <trailingZeros>false</trailingZeros>
      <significantDigitsMode>false</significantDigitsMode>
      <roundingMode>0</roundingMode>
      <fractions>decimal</fractions>
    </calculation>
    <pageModel active="false" viewMode="2" printGrid="false" printAreas="true" simpleEqualsOnly="false" printBackgroundImages="true">
      <paper id="9" orientation="Portrait" width="827" height="1169" />
      <margins left="39" right="39" top="49" bottom="49" />
      <header alignment="Center" color="#a9a9a9">&amp;[DATE] &amp;[TIME] - &amp;[FILENAME]</header>
      <footer alignment="Center" color="#a9a9a9">&amp;[PAGENUM] / &amp;[COUNT]</footer>
      <backgrounds />
    </pageModel>
    <dependencies>
      <assembly name="SMath Studio Desktop" version="0.99.7822.147" guid="a37cba83-b69c-4c71-9992-55ff666763bd" />
      <assembly name="MathRegion" version="1.11.7822.147" guid="02f1ab51-215b-466e-a74d-5d8b1cf85e8d" />
      <assembly name="Custom Functions" version="1.1.7840.30466" guid="18dadffd-79a3-4cf9-aee1-d66deb0ea720" />
      <assembly name="SpecialFunctions" version="1.12.7822.147" guid="2814e667-4e12-48b1-8d51-194e480eabc5" />
      <assembly name="MaximaPlugin" version="1.98.7832.2744" guid="44011c1e-5d0d-4533-8e68-e32b5badce41" />
      <assembly name="TextRegion" version="1.11.7822.147" guid="485d28c5-349a-48b6-93be-12a35a1c1e39" />
      <assembly name="AreaRegion" version="1.11.7822.147" guid="4974b228-4974-44cf-8274-bf2936b4a766" />
      <assembly name="Writer Region" version="0.23.7806.17155" guid="5922d677-323f-4327-8c68-be902d8339ad" />
    </dependencies>
  </settings>
  <regions type="content">
    <region left="36" top="18" width="126" height="26" color="#000000" fontSize="12">
      <text lang="ita" fontFamily="Amiri" fontSize="10">
        <content>
          <p style="font-size: 12px; font-family: Arial Narrow;">Solve the equation:</p>
        </content>
      </text>
    </region>
    <region left="36" top="54" width="321" height="37" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">a</e>
          <e type="operand">x</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operand">9</e>
          <e type="operator" args="2">-</e>
          <e type="operand">x</e>
          <e type="function" args="2">Solve</e>
          <e type="bracket">(</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="symbolic">
          <e type="operand">9</e>
          <e type="operator" args="1">-</e>
          <e type="operand">x</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">+</e>
          <e type="operand">x</e>
          <e type="function" args="2">Solve</e>
        </result>
      </math>
    </region>
    <region left="450" top="54" width="91" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">a</e>
        </input>
        <result action="symbolic">
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">sys</e>
        </result>
      </math>
    </region>
    <region left="36" top="108" width="488" height="26" color="#000000" fontSize="12" isBreakable="false">
      <text lang="ita" fontFamily="Amiri" fontSize="10">
        <content>
          <p style="font-size: 12px; font-family: Arial Narrow;">I wanted to convert the system in an array to use in the for-loop, like the following:</p>
        </content>
      </text>
    </region>
    <region left="36" top="135" width="176" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
        </input>
        <result action="symbolic">
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="36" top="180" width="372" height="26" color="#000000">
      <writer lang="ita"><![CDATA[<span style="font-family: 'Arial'; font-size: 10pt; font-weight: normal; font-style: normal; color: windowtext; background-color: Transparent; vertical-align: baseline; text-align: left; margin-left: 0pt; text-indent: 0pt; line-height: 115%">
<div>But when I am trying to assign to a variable, it does not work:</div></span>]]></writer>
    </region>
    <region left="36" top="207" width="284" height="39" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">aa</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operator" args="2">:</e>
        </input>
        <result action="symbolic">
          <e type="operand">9</e>
          <e type="operator" args="1">-</e>
          <e type="operand">x</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operator" args="2">+</e>
          <e type="operand">x</e>
          <e type="function" args="2">Solve</e>
        </result>
      </math>
    </region>
    <region left="450" top="207" width="99" height="45" color="#000000" fontSize="10">
      <math>
        <input>
          <e type="operand">aa</e>
        </input>
        <result action="symbolic">
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">x</e>
          <e type="operand">3</e>
          <e type="operator" args="2">≡</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">sys</e>
        </result>
      </math>
    </region>
    <region left="36" top="270" width="229" height="26" color="#000000">
      <writer lang="ita"><![CDATA[<span style="font-family: 'Arial'; font-size: 10pt; font-weight: normal; font-style: normal; color: windowtext; background-color: Transparent; vertical-align: baseline; text-align: left; margin-left: 0pt; text-indent: 0pt; line-height: 115%">
<div>1) Method to convert all the solutions</div></span>]]></writer>
    </region>
    <region left="54" top="306" width="262" height="118" color="#000000" fontSize="10">
      <math optimize="2">
        <input>
          <e type="operand">u</e>
          <e type="operand">0</e>
          <e type="operator" args="2">:</e>
          <e type="operand">sol</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="function" args="1">Clear</e>
          <e type="operand">all_solutions</e>
          <e type="operand">u</e>
          <e type="function" args="2">el</e>
          <e type="operand">sol</e>
          <e type="function" args="1">Assign</e>
          <e type="operator" args="2">:</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="function" args="3">for</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">line</e>
        </input>
      </math>
    </region>
    <region left="423" top="378" width="168" height="45" color="#000000" fontSize="10">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>OK</p>
          </content>
        </description>
        <input>
          <e type="operand">all_solutions</e>
        </input>
        <result action="numeric">
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operand">3</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">mat</e>
        </result>
      </math>
    </region>
    <region left="36" top="450" width="314" height="26" color="#000000" isBreakable="false">
      <writer lang="ita"><![CDATA[<span style="font-family: 'Arial'; font-size: 10pt; font-weight: normal; font-style: normal; color: windowtext; background-color: Transparent; vertical-align: baseline; text-align: left; margin-left: 0pt; text-indent: 0pt; line-height: 115%">
<div>2) Method to filter the solutions the meet the criteria</div></span>]]></writer>
    </region>
    <region left="54" top="486" width="177" height="167" color="#000000" fontSize="10">
      <math>
        <description active="true" position="Top" lang="eng">
          <content>
            <p>filter the positive solution</p>
          </content>
        </description>
        <input>
          <e type="operand">sol</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="function" args="1">Clear</e>
          <e type="operand">s.pos</e>
          <e type="operand">sol</e>
          <e type="function" args="1">Assign</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.pos</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">break</e>
          <e type="operand" style="string">none</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="function" args="3">for</e>
        </input>
      </math>
    </region>
    <region left="288" top="522" width="74" height="34" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>OK</p>
          </content>
        </description>
        <input>
          <e type="operand">s.pos</e>
        </input>
        <result action="symbolic">
          <e type="operand">3</e>
        </result>
      </math>
    </region>
    <region left="288" top="558" width="53" height="27" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>shouldn't x be defined since the break happens after the assignmet?</p>
          </content>
        </description>
        <input>
          <e type="operand">x</e>
        </input>
        <result action="symbolic">
          <e type="operand">x</e>
        </result>
      </math>
    </region>
    <region left="54" top="693" width="177" height="167" color="#000000" fontSize="10">
      <math>
        <description active="true" position="Top" lang="eng">
          <content>
            <p>Filter the negative solution</p>
          </content>
        </description>
        <input>
          <e type="operand">sol</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">x</e>
          <e type="function" args="1">Clear</e>
          <e type="operand">s.neg</e>
          <e type="operand">sol</e>
          <e type="function" args="1">Assign</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.neg</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">break</e>
          <e type="operand" style="string">none</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="function" args="3">for</e>
        </input>
      </math>
    </region>
    <region left="279" top="720" width="89" height="34" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>OK</p>
          </content>
        </description>
        <input>
          <e type="operand">s.neg</e>
        </input>
        <result action="numeric">
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="279" top="756" width="53" height="27" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>shouldn't x be defined since the break happens after the assignmet?</p>
          </content>
        </description>
        <input>
          <e type="operand">x</e>
        </input>
        <result action="symbolic">
          <e type="operand">x</e>
        </result>
      </math>
    </region>
    <region top="891" color="#000000">
      <area single="true" collapsed="true" />
    </region>
    <region left="45" top="936" width="546" height="26" color="#000000" isBreakable="false">
      <writer lang="ita"><![CDATA[<span style="font-family: 'Arial'; font-size: 10pt; font-weight: normal; font-style: normal; color: windowtext; background-color: Transparent; vertical-align: baseline; text-align: left; margin-left: 0pt; text-indent: 0pt; line-height: 115%">
<div>3) Method to filter the solutions the meet the criteria without clearing <em>x</em>(not working properly)</div></span>]]></writer>
    </region>
    <region left="63" top="963" width="177" height="147" color="#000000" fontSize="10">
      <math>
        <description active="true" position="Top" lang="eng">
          <content>
            <p>filter the positive solution</p>
          </content>
        </description>
        <input>
          <e type="operand">sol</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.pos</e>
          <e type="operand">sol</e>
          <e type="function" args="1">Assign</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.pos</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">break</e>
          <e type="operand" style="string">none</e>
          <e type="function" args="3">if</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="function" args="3">for</e>
        </input>
      </math>
    </region>
    <region left="297" top="999" width="74" height="34" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>Since x was not cleared I think the Assign function at the second iteration tried to evaluate a boolean where both hand side where definene, resulting in false (0)</p>
          </content>
        </description>
        <input>
          <e type="operand">s.pos</e>
        </input>
        <result action="symbolic">
          <e type="operand">0</e>
        </result>
      </math>
    </region>
    <region left="378" top="1053" width="167" height="29" color="#000000" fontSize="12">
      <math>
        <input>
          <e type="operand">3</e>
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
          <e type="operator" args="2">≡</e>
          <e type="function" args="1">Assign</e>
        </input>
        <result action="numeric">
          <e type="operand">0</e>
        </result>
      </math>
    </region>
    <region left="297" top="1089" width="66" height="27" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p>x is not cleared</p>
          </content>
        </description>
        <input>
          <e type="operand">x</e>
        </input>
        <result action="symbolic">
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="72" top="1143" width="135" height="27" color="#000000" fontSize="12">
      <math>
        <input>
          <e type="operand">lastError</e>
        </input>
        <result action="numeric">
          <e type="operand" style="string"></e>
        </result>
      </math>
    </region>
    <region left="63" top="1179" width="173" height="147" color="#000000" fontSize="10">
      <math error="48" errorLocation="14">
        <description active="true" position="Top" lang="eng">
          <content>
            <p>Filter the negative solution</p>
          </content>
        </description>
        <input>
          <e type="operand">sol</e>
          <e type="operand">a</e>
          <e type="function" args="1">sys2mat.1</e>
          <e type="operand">u</e>
          <e type="operand">u</e>
          <e type="operand">1</e>
          <e type="operator" args="2">+</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.neg</e>
          <e type="operand">sol</e>
          <e type="function" args="1">Assign</e>
          <e type="operator" args="2">:</e>
          <e type="operand">s.neg</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&lt;</e>
          <e type="operand">break</e>
          <e type="operand" style="string">none</e>
          <e type="function" args="3">if</e>
          <e type="operand">3</e>
          <e type="operand">1</e>
          <e type="function" args="5">line</e>
          <e type="function" args="3">for</e>
        </input>
      </math>
    </region>
    <region left="288" top="1206" width="544" height="63" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng" width="21">
          <content>
            <p>not sure why is not evaluating like the example above</p>
          </content>
        </description>
        <input>
          <e type="operand">s.neg</e>
        </input>
        <result action="numeric">
          <e type="operand" style="string">solve: all variables must not be numbers.
 -- an error. To debug this try: debugmode(true);
(%i30)</e>
        </result>
      </math>
    </region>
    <region left="288" top="1278" width="66" height="27" color="#000000" fontSize="12">
      <math>
        <description active="true" position="Right" lang="eng">
          <content>
            <p></p>
          </content>
        </description>
        <input>
          <e type="operand">x</e>
        </input>
        <result action="symbolic">
          <e type="operand">3</e>
          <e type="operator" args="1">-</e>
        </result>
      </math>
    </region>
    <region left="63" top="1377" width="596" height="27" color="#000000" fontSize="12">
      <math>
        <input>
          <e type="operand">lastError</e>
        </input>
        <result action="numeric">
          <e type="operand" style="string">Questa azione non può venire eseguita con testo.</e>
        </result>
      </math>
    </region>
    <region left="171" top="1404" width="327" height="26" color="#000000" fontSize="12">
      <text lang="ita" fontFamily="Arial Narrow" fontSize="12">
        <content>
          <p>translation: "this action cannot be performed with text"</p>
        </content>
      </text>
    </region>
    <region left="36" top="1503" width="137" height="26" color="#000000">
      <writer lang="ita"><![CDATA[<span style="font-family: 'Arial'; font-size: 10pt; font-weight: normal; font-style: normal; color: windowtext; background-color: Transparent; vertical-align: baseline; text-align: left; margin-left: 0pt; text-indent: 0pt; line-height: 115%">
<div>4) Trying to be clever</div></span>]]></writer>
    </region>
    <region left="36" top="1530" width="115" height="29" color="#000000" fontSize="12">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="function" args="1">Clear</e>
        </input>
        <result action="symbolic">
          <e type="operand">1</e>
        </result>
      </math>
    </region>
    <region left="36" top="1575" width="286" height="67" color="#000000" fontSize="12">
      <math>
        <input>
          <e type="operand">x</e>
          <e type="operand">2</e>
          <e type="operator" args="2">^</e>
          <e type="operand">1</e>
          <e type="operator" args="2">-</e>
          <e type="operand">x</e>
          <e type="operand">0</e>
          <e type="operator" args="2">&gt;</e>
          <e type="operand">2</e>
          <e type="operand">1</e>
          <e type="function" args="4">sys</e>
          <e type="operand">x</e>
          <e type="function" args="2">Solve</e>
        </input>
        <result action="symbolic">
          <e type="operand" style="string">no result</e>
        </result>
      </math>
    </region>
  </regions>
</worksheet>