$a = Formula(" $n1 / $d1");
casts $a as a formula, which is treated as a function of whatever variables are allowed in the current context, which by default is just x. That means that WeBWorK won't complain if students enter a function of x as their answer.
You should probably have the following instead:
$a = Compute(" $n1 / $d1" );
This should recognize the correct answer as being a real number, which means that students will get a warning message if they enter a function of x, telling them that it is expecting a number.
Using "Compute" rather than "Real" has the advantage of preserving the formatting of the answer as you entered it, i.e. leaving it as a fraction rather than storing the decimal version.