Here is the contextLimitedRadical.pl file after the edits Davide points out, and with some updating to the comments. Thanks Davide for your help; those two errors are really things that I should have caught.
Now setSqrt and setRoot can be set by the problem author, with default values of exp(1)/ln(2).
I was not able to make the root(n,x) function treat its inputs as perl reals rather than Math Objects as Davide suggests. My attempts to do so led to "Can't generate enough valid points for comparison" errors. So be careful with n or x very close to 0.
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day