Question: How do I program Maple to display consective numbers?

For the t output I need to show 1, 1.2, 1.4....2, my attempt is highlighted in green below

Can anyone assist please?

#Clear memory and load packages.
restart;
with(plots):
with(Statistics):

#Define vectors and variables.
actual:=<2,3.5136,5.8016,9.1136,13.7376,20>:
t:=<1,1.2,1.4,1.6,1.8,2>:
n:=6:
RMSE:=0:

#Perform a simple linear regression on the data.
P:=LinearFit([1,x],t,actual,x);

#Display the model errors.
printf("t    Actual P  Model P  Error\n");
for i from 1 to n do
   model:=subs(x=t[i],P):
   err:=actual[i]-model:
   RMSE:=RMSE+err^2:
   printf("%2d %7.4f% 10.4f% 9.4f\n",(i+(1/5)),actual[i],model,err);
end do:

#Display the root mean square error.
RMSE:=sqrt(RMSE/n);

#Plot the points and the model.
p1:=plot(t,actual,style=point,view=[0..7,8..26]):
p2:=plot(P,view=[0..7,8..26]):
display(p1,p2);

-HFloat(17.540266666666668)+HFloat(17.712)*x

 

t    Actual P  Model P  Error

 

Error, (in fprintf) integer expected for integer format

 

HFloat(0.7463867411787324)

 

 

NULL

Download Asst_4_Question_1f.mw

Please Wait...