Animation to run, stop, reset

I am just spinning my wheels on this! I want to model the result of the function the student enters and just can’t seem to get it!

The error in the otherwise line can be fixed with:

otherwise studentfunction.evaluateAt(T)

but that leads to another error (“Mismatched types…”) because the whens output functions and the otherwise outputs a number.