Solve: Error in PROGN [or a callee]: Bind stack overflow.



When trying to run the code below, I get 
	Error in PROGN [or a callee]: Bind stack overflow.

The function preg() is doing regression, returning a term approximating
the points P. The term is based on 'term', with the variables in 'vars'
being replaced. When running on a term a^x, solve() results in a bind
stack overflow; for a * x it works perfectly.

Hope you can help, as I need this function to work.

-- Maxima version information:
Maxima version: 5.22.1
Maxima build date: 1:16 11/6/2010
Host type: x86_64-unknown-linux-gnu
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.7

-- Code:
preg(P, term, vars) := block([eqns, g, res, ratprint: false],
    g : sum((P[i][2] - subst(P[i][1], x, term))^2, i, 1, length(P)),
    eqns : makelist(diff(g,vars[i]), i, 1, length(vars)),
    subst(solve(eqns, vars)[1], term)
)$

P : [[1650, 0.545], [1750, 0.728], [1800, 0.906],
     [1850, 1.171], [1900, 1.608], [1950, 2.517]]$

preg(P, a ^ x * b, [a, b]);

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.