# Checking format of a recursive function

I want the S’s to enter something like t(n+1)=t(n)+25. I am stuck on how to check for correctness with CL. I have tried using simpleFunction and parseEquation with “t(n)” as the variable, but can’t get that to work. I have tried using latex too (below). Not working. Ideas?

a2 = simpleFunction(parseEquation(this.cellContent(2,1)).rhs,"t\left(n\right)").evaluateAt(0)=25

Rather than t(n) as a single variable, use t and n as separate variables. It’s obviously not what the actual equation means, but it’s a means to an end:

parseEquation(this.cellContent(2,1)).differenceFunction(t,n).evaluateAt(1,1) = -24


differenceFunction is lhs - rhs. You may want a second evaluation to be more robust.

1 Like