Sqrt2f21e.cin

From TORI
Jump to: navigation, search

// Sqrt2f21e.cin suggests routine F21E for evaluation of tetration to base \(b\!=\!\sqrt{2}\).

//In order to evaluate \(\mathrm{tet}_{\sqrt{2}}(z)\), the routine should be called as F21E(z)


 z_type f21E(z_type z){int n; z_type e,s;
 DB coef[24]= { 1., // 0 (fitst power coeff)
 0.56472283831773236365, 0.33817758685118329988, // 2
 0.21033130213862776975, 0.13445487905210979672, // 4
 0.087784388601219137357, 0.058288093083094691542, // 6
 0.039240711783727838328, 0.026723286034298143846, // 8
 0.018376520597637595915, 0.012742089846776647861, //10
 0.0088986329515697318595,0.0062531995639748853846, //12
 0.0044181328624396520598,0.0031365295362695967035, //14
 0.0022361213774486947923,0.0016001999145218074082, //16
 0.0011489818761273047343,0.00082749213843167597835, //18
 0.00059758321720686253893,.00043261919624398863166, //20
0.0003185 ,.000218 , .00021 //last 2 are doubtful.
};
//f[20] := 0.59758321720686253893e-3
//f[21] := 0.43261919624398863166e-3
  e=exp(-0.36651292058166432701*(z+1.251551478822188));
  s=coef[22];
  for(n=21;n>=0;n--) { s*=e; s+=coef[n]; }
  return 2.-s*e;
  }

 z_type F21E(z_type z){ if(Re(z)>2.) return f21E(z);
   return log(F21E(z+1.))/log(sqrt(2.));
  }

/**/