Solve: Error in PROGN [or a callee]: Bind stack overflow.
Subject: Solve: Error in PROGN [or a callee]: Bind stack overflow.
From: Leo Butler
Date: Tue, 23 Nov 2010 15:29:09 +0000 (GMT)
On Tue, 23 Nov 2010, Julian Andres Klode wrote:
< 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]);
Is there a reason you are trying to find an exact solution, when
your input data are floats? The lbfgs package provides an iterative
floating-point solver. The lsquares package also provides an interface
that you can use without needing to write lots of code. Both are
documented in the manual.
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.