Well, i should remember... A few years ago i saw a couple of tricky examples about this in a Maple programming demo.
The whole story is a bit more difficult.
I have to write a Sequence ("Sorozatok" in hungarian) package
Sorozatok := module()
export Sorozatok_q1, Sorozatok_q2, Sorozatok_q3,...
local solved, n, l, k, s_n, eq1, eq2, `a`, d, MO, ret_length:
solved := false:
while ( (not solved) or hasfun([MO], RootOf) ) do
n := RandomTools:-Generate(integer(range=5..20)):
l := RandomTools:-Generate(integer(range=2..n)):
k := RandomTools:-Generate(integer(range= 1..(l-1) )):
s_n := RandomTools:-Generate(integer(range=5..30)):
eq1 := abs( `a` +(k-1)*d ) = abs( `a`+(l-1)*d );
eq2 := n * ( `a` + (`a` + (n-1)*d) )/2 = s_n;
MO := solve( [eq1,eq2], [`a`,d], Explicit=true ):
if not ( MO =  ) then
solved := true:
ret_length := 4 + nops([MO]):
return [ret_length, n, k, l, s_n, MO];
local solved, a, b, c, eq1, eq2, eq3, x, `a`, d, MO, ret_length, ...
solved := false:
Each Sorozatok_q<j> proc belongs to a specific question of a Sequences question bank in MapleTA. It should generate suitable random parameters and solve the resulting equations.
MapleTA will evalute the output and compare it with the students answer.
The names of the indeterminates are fixed in the question text, and the output should contain them exactly. (Or they have to be transformed back to the original names - this would be an extra step.)
At first I thought that proc's without parameters would be the simplest solution, and the local declarations came from the fact that the different questions use a lot of parameters with similar names.
Should i make all unassigned names global and export them from my package?