< Back to Snippets

solve

Compute \(\text{solve}\left ( f_{1}= f_{2}, v, x \right )\) where \(f_{1}\) is in the t register, \(f_{2}\) is in the z register, \(v\) (the variable to solve for) is in the y register, and the initial guess for an answer is in the x register.


<root>
  ...
  <values>
    ...
    <subroutine ID="solve" parameters="4">
      <StackBox.ApplyConsole/>
      <StackBox.Roll4Up/>
      <StackBox.Roll4Up/>
      <MathEquals.Action/>
      <StackBox.Roll3Down/>
      <function ref="solveFunc"/>
    </subroutine>

    <!-- No one should call solveFunc except solve -->
    <function ID="solveFunc" label="solve" parameters="3">
      <StackBox.Roll3Up/>
      <StackBox.Explode/>
      <MathSubtract.Action/>
      <StackBox.Roll3Down/>
      <MathZero.Action/>
    </function>
    ...
  </values>
</root>