Morias.cin

From TORI
Revision as of 07:03, 1 December 2018 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

// Morias.cin is complex double implementation in C++ of the asymptotic approximation morias of the Morinaga function for large values of the argument.

//


/*
// Example of the head of the code:
#include <stdio.h>
#include <stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
#include <complex>
typedef std::complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
//#include "korias.cin"
//#include "besselj0.cin"
//#include "korifit76.cin"
*/
DB L1=2.404825557695772768621631879326454643124;
z_type morias(z_type z){ int k,m,n; z_type s,c,t,x;
x=1./(z*z); t=-sqrt(2./M_PI/L1/z)/z/z;
DB F[16]={1., -0.021614383628830615865, 0.0019465899152260872595, -0.0010834984344719114778,
0.001464410164512283719,-0.00362887639961599366, 0.01431760830195380729,-0.0824438982874790057,
0.652747801052423657,-6.8037683807062433, 90.3226589049537271,-1487.942880868968812,
29785.50901270392374,-712115.985305068771, 2.004198475357888791e7,-6.55899833559605085e8};
DB G[16]={1.,0.989192808185584692068, 0.99228788615079417081, 0.989481317221334367489,
0.994709980602617872387, 0.97818700495778240956,1.0575251177784290263, 0.5188843197279991625,
5.432808917007474985, -52.5640507009104629, 807.429675670594971, -14844.4023379433794,
328204.367306340176, -8.58451015184984386e6,2.622743364093940316e8,-9.2571344891765297e9};
m=11; k=11;
s=F[m]*x; for(n=m-1;n>0;n--) {s+=F[n]; s*=x;}
c=G[k]*x; for(n=k-1;n>0;n--) {c+=G[n]; c*=x;}
return t * (1.+c) * cos( -M_PI/4. + L1*z*(1.+s) );
}
//

//