Question: Error (in fprintf)

Can anyone assist with this error please?

#Clear memory and load package.
restart;  
with(LinearAlgebra):

#Initialise variables,matrices and vectors.
b:=<<18>,<-2>>:
c:=<<1>,<1>>:
i:=0:
P:=<1.08,1.37,1.56,1.61>;
t:=<5,10,15,20>;
tol:=1e-6:

#Initialise Gauss-Newton matrices.
n:=Dimension(t):
f:=Matrix(n,1):
J:=Matrix(n,2):

#Display initial parameter values.
printf("Gauss-Newton Method\n");
printf("-------------------\n");
printf("Before iterations,A = %f and B = %f\n",b(1),b(2));

#Perform the Gauss-Newton method.
while max(abs(evalf(c)))>tol do
  i:=i+1;
  for r from 1 to n do
     f(r,1):=evalf((In(b(1)+t[r])+b(2))-P[r]);
     J(r,1):=evalf(1/b(1)+t[r]);
     J(r,2):=evalf(1);
end do;
c:=Multiply(MatrixInverse(Multiply(Transpose(J),J)),Multiply(Transpose(J),f));
b:=b-c;
printf("After iterations %d, A = %f and B = %f\n",i,b(1),b(2));
end do:

Vector(4, {(1) = 1.08, (2) = 1.37, (3) = 1.56, (4) = 1.61})

 

Vector[column](%id = 36893488152076174028)

 

Gauss-Newton Method
-------------------
Before iterations,A = 18.000000 and B = -2.000000
After iterations 1, A =

 

Error, (in fprintf) number expected for floating point format

 

NULL

Download Asst_3_Q4b.mw

Please Wait...