Question: Help With prcLeastSquare

October 26 2012 Sheridonia 0
Maple

0

I wrote the following code but am stuck on how to Update prcLeastSquareLA, so it does what prcLeastSquare does.

I believe you have to add error estimate information in prcLeastSquareLA but I have tried to no avail.

 

prcLeastSquareLA:= proc(data,degree)
local vars,y,A,V,k,e,i,j,v,c,1stVars;

vars:= seq(ci, i=0..degree);
y:=unapply(‘+’(seq(ci*t^j, i=0..degree)),t);
for k to nops(data) do
  ek:=y(data[k][1])=data[k][2];
  vk:=[coeffs9lhs(ek))];
end do:

A:=convert([seq(vi,i=1..nops(data))],Matrix)
V:=convert([seq(data[1][2].i=1..nops(data))],Vector);
1stVars:=convert((A^(%T).A)^-1 . A^(%T).V,list);

for j to degree + 1 do
cj-1:=1stVarsj
end do;
return
y;
end proc





Any help would be appreicated

Please Wait...