simpleFunctions vs. xyLine vs. parseEquation

Can someone explain the difference between simpleFunction, xyLine, and parseEquation? And under what circumstances I would use each one. I read over the definitions in Computation Layer Documentation, but I’m still not getting it. Perhaps all the vocabulary is still too new for me. Any insight would be greatly appreciated!!

Each of these can be used to check whether an expression and/or equation is “correct”. These methods are more stable than trying to match latex or strings.

  1. simpleFunction creates a function, default is in terms of x, but you can use any variables if you specify what they are. You can use it as input for the function sink in a graph component, or in the CL of any type of component. You can use it to create functions from student input to display in graphs, or to .evaluateAt( ) a variety of values to check equivalence, but not limited to these purposes.

  2. xyLine creates a line object, most usefully from an input or table. It will take a linear equation in any form. You can then access the .slope, .yIntercept, .xIntercept, .isHorizontal, and .isVertical methods which you can use to check students for correctness for example.

  3. parseEquation creates equation object. You can access the lefthand side (.lhs), the righthand side (.rhs), or create a .differenceFunction which is the lhs - rhs.

There are many ways each can be used. The first, I think, is the most useful to start, but the others have their places where simpleFunction won’t work.

Let me know if you have specific questions about syntax. parseEquation in particular can be tricky sometimes.

5 Likes