error function lsquares



> 2. This is wrong:
>
> M: matrix([1,2],[2,4],[3,9])$
> eq: y = A + B*x$
> i:0$
> lsquares_estimates(M,[y,x],eq,[A,B]);
> values;
>
> apply: no such "matrix" element: [0,1]#0:

Hi Ladislav, I have pushed a new version of lsquares.mac
which, I think, fixes the problem you noticed.
You can get the new version from maxima.git.sourceforge.net
(sorry, I don;t have a direct link at hand) or you can apply
the patch below.

Hope this helps!

Robert Dodier

PS. Here's the patch:

$ git diff share
diff --git a/share/contrib/lsquares.mac b/share/contrib/lsquares.mac
index 440eaa1..a8346f8 100644
--- a/share/contrib/lsquares.mac
+++ b/share/contrib/lsquares.mac
@@ -254,7 +254,7 @@ lsquares_mse ('data%, variables, equation) := block
    (if not atom (data%)
         then block ([temp : ?gentemp (sconcat ("$M"))], temp ::
data%, data% : temp),

-    makelist ('data% [i, j], j, 1, length (variables)),
+    makelist ('data% ['i, j], j, 1, length (variables)),
     map ("=", variables, %%),
     sublis (%%, (lhs (equation) - rhs (equation))^2),
     buildq
@@ -265,7 +265,7 @@ lsquares_mse ('data%, variables, equation) := block
 /* Some evaluation gyrations can be avoided by working with an array ...
  *
 lsquares_mse_with_array (data%,variables,equation):=block
-   (makelist(data%[i,j],j,0,length(variables)-1),
+   (makelist(data%['i,j],j,0,length(variables)-1),
     map("=",variables,%%),
     sublis(%%,(lhs(equation)-rhs(equation))^2),
     buildq([n:array_nrows(data%),summand:%%],