Your problem is in here:
for( double i = 0; i < nl; i++ )
{
double j=0;
double y = 0.25*(1-tanh(double(j-75)/5));
j+=Golf_dl;
pb(T_1)+y;
}
Consider the fact that the loop variable, i
, is not used anywhere inside the loop. Also, j
and y
do not retain their values between loops (they are not static
).