So newbie here, is there a way to evaluate a simple expression with a variable as a boolean form a math input? Can you check for an input 12x + 4 for example. I know it seems simple, but when I use latex it does NOT read any spaces.
If you’re looking for a specific expression, use
evaluateAt combined with
countNumberUsage. Matching latex doesn’t work well (there are many threads on this topic).
Example looking for
input= yourInputName.latex f=simpleFunction(input) check= f.evaluateAt(0)=4 and f.evaluateAt(1)=16 and countNumberUsage(input,12)=1 and countNumberUsage(input,4)=1
input just make
check a little shorter and easier to read. Linear expressions you’ll want to evaluate at a few values. Some people use graphs for their evaluations because it’s a little easier to check a whole table of values.
countNumberUsage can check the occurrences of individual numbers (not integers) as I checked for 12 and 4 above.
-4 would output the same count, but evaluating expression will help distinguish any differences. You can also check how many numbers are used total by leaving out the second parameter.