solve.frink

View or download solve.frink in plain text format


// Program to demonstrate solving using the solvingTransformations.frink file.
// This wee program will do your algebra for you.

use allTransforms.frink

showApproximations[false]
symbolicMode[true]
while (text = input["Enter expression: "])
{
   expr = parseToExpression[text]

//   println["expr is $expr"]
// This version shows without trace.
//   res = transformExpression[expr]
//   println["\n$res"]

   // This version shows trace
   res = transformExpressionTrace[expr]
   println["\n" + join["\n",res]]
   last = res@(length[res]-1)

   // Evaluate right-hand sides of solved expressions like a === solution
   for eq = toArray[last]
   {
      if structureEquals[_a === _b, eq]
      {
         println["\nSymbolic: " + eq]
         println["Numeric:  " + getChild[eq, 0] + " = " + eval[getChild[eq, 1]]]
      } else
         println[eval[eq]]
   }

 


View or download solve.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 18176 days, 22 hours, 18 minutes ago.