> The other method was creating the extra parenthesis for negative numbers (-(f(x+c))
format)
You can change that using
Context()->operators->set(fn => {parenPrecedence => 6.5});
If you want students to be able to provide answers that include function like f(x)
, then you probably want to use parserFunction.pl
to define the function so that it can be used in student answers. For example
parserFunction(f => "sqrt(sin(3x) + 1)");
Use a function that is unlikely to be something they student will enter by accident.
You may need to set
Context()->flags->set( reduceConstantFunctions => 0, formatStudentAnswer => 'parsed' );
so that the student's answer will not produce a strange-looking number if they enter something like f(3)
.