# Combining Like Terms

Hello All,
Very new to the CL but see many opportunities!

I would like to use the graphing component to validate students understanding of simplifying equations. It seems like I could just check the slope and intercept of any equation they enter and confirm whether their equation is equivalent or not to some target equation. But I want to turn off the graph and only expose the equation part of the calculator. Is that possible?

Thank You,
Mike

I hope I understood your question.
You can always hide graph and still use it as calculator even though it is hidden.

You can’t have the expression list only for a graph, only vice versa. You may want to use a table instead, using parseEquation( ).differenceFunction( ) to either import into a hidden graph for comparing functions, or using evaluateAt(equation solution)=0 in the CL.

Thank you for your help. I ended up using xyline in a table component. I obviously need to do more checks and make sure there is only 1 x term etc… but this will work eventually.

You didn’t publish yet, so it’s a blank activity.

Look into `countNumberUsage` for checking for specific numbers

Thank you. I tried countNumberUsage but there is no way to check for the number of x or y terms in the equation. I think I need RegEx or one of the patter functions that aren’t public yet.

If you pair xyLine with countNumberUsage, you should have all the checking that you need. You may even use simpleFunction with evaluateAt.

countNumberUsage doesn’t look for number of terms, it searches for how many of a particular value (or how many numbers total are used). For example, 3x-5x+4 vs -2x+4.

``````f=simpleFunction(this.latex)
correct=f.evaluateAt(4)=-8 and f.evaluateAt(0)=4
and countNumberUsage(this.latex)=2  #checks that there are only 2 numbers used
#you can also use inequalities (perhaps for x vs 1x)
and countNumberUsage(this.latex,2)=1 #checks for the presence of one 2 (doesn't matter that it's negative)
and countNumberUsage(this.latex,4)=1 #checks for one 4
``````

3x-5x+4 would be marked incorrect due to the lack of a 2. You can use variables for the second parameter, but would need to make sure you account for the case where the coefficient and constant are equivalent.

Thanks for your help. This is an evolving project but I did want to update everyone. There are some obvious bugs (string spaces?!) and more relevant feedback to the student. I am making use of evaluateAt for the expressions in x and y along with counterNumberUsage to check the number of terms. And I am using xyline for the equations of a line and also checking the LHS is y.

I have different templates for evaluating input expressions and equations. I will keep extending this to different forms of a line and adding more input. I do wish there was some sort of a loop variable to avoid repeating the same line of code n times but this will work.

Thank you,
Mike

In reference to latex? You can use backticks instead.