//------------------------------------------------------------------- // fundamental constants // (from Fundamental physics constants, UFN 173 (2003) p.339) //-------------------------------------------------------------------- function Constants() { this.h2_mn = 41.80158761;// hbar^2/amu [MeV fm**2] this.hbar = 6.5821188926;// 10^(-22) MeV sec this.c = 299792458; // 10^(15) fm/sec this.mp = 938.27199838;// proton mass (MeV) this.mn = 939.56533038;// neutron mass (MeV) this.mN = 938.9186644; // (mp+mn)/2 (MeV) this.amu = 931.494028; // atomic mass unit (MeV) this.h_mn = 7.010318511; // h/mN/c^2 (10^(-23) sec) this.e2 = 1.4399764; // MeV*fm this.hc = 197.3269602; // MeV*fm this.small_add = 1.e-6; this.zerro = 1.e-13; this.radTodeg = 57.2957795130823208767982; this.degTorad = 0.01745329251994329576924; this.M_E = 2.71828182845904523536029; this.M_PI = 3.14159265358979323846264; this.M_1_PI = 0.31830988618379067153777; this.M_2_PI = 0.63661977236758134307554; this.M_SQRT_PI = 1.77245385090551602729817; this.M_1_SQRT_PI = 0.56418958354775628694808; this.M_SQRT_2 = 1.41421356237309504880169; } //------------------------------------------------------------------- function CommonFun() { //--------------------------------------------------------------- this.Const = new Constants(); this.w5 = [0.041666667,-0.16666667,0.25]; //--------------------------------------------------------------- this.chet = function(a) {return (a%2)?true:false;} //--------------------------------------------------------------------- this.Log10 = function(arg) { return Math.log10(arg); } //--------------------------------------------------------------------- this.stringInScientificFormat = function(Val,digits) { var val = Math.abs(Val), pw = Math.floor(Math.log10(1*val)), str = "0."+(Math.round(Math.pow(10,digits-1)*val*Math.pow(10,-pw))), sig = ''; if(Val < 0) sig = '-'; return sig+str+"E"+(1*pw+1); } //--------------------------------------------------------------------- this.stringInFormat = function(Val,digits) { var val = Math.abs(Val), v = Math.floor(val), pw = Math.floor(Math.log10(1*val-1*v)), zeros = '', sig = ''; if(Val < 0) sig = '-'; if(pw < -1*digits) pw = -1*digits; if(pw < -1) for(var iz=0;iz0 && ixXmax => extrapolation { ix = N-3; h = (x-X[ix])/dx; h2=h*h; h4=h2-4; h2=h2-1; nom2=this.w5[0]*h*h2; nom1=this.w5[1]*h*h4; nom0=this.w5[2]*h2*h4; res = nom2*F[ix-2]*(h-2) + nom1*F[ix-1]*(h-1) + nom0*F[ix] + nom1*F[ix+1]*(h+1) + nom2*F[ix+2]*(h+2); } else res=0.0; return res; } //------------------------------------------------------------------------------ this.LinearInterpolation = function(x,X,F,N) { var h, res = 0.0, ix = this.getIndex(x,X,N); if(ix>=0) // 2-point(linear) scheme { h = (x - X[ix])/(X[1*ix+1]-X[ix]); res = 1*F[ix] + h*(F[1*ix+1]-F[ix]); } return res; } //------------------------------------------------------------------------------ // vozvrashaet index i v massive takoi chto array[i] array[N-1]) return -2; var ii,i1=0,i2=N-1; while(i2-i1 > 1) { ii = Math.floor((1*i1 + 1*i2)/2.0); if(x > array[ii] || Math.abs(x-array[ii])=this.NucNames.length) return ""+z; return this.NucNames[z]; } this.getNucleusName = function(a,z) { if(a==1) if(z==0) return "n"; else return "p"; if(a==2 && z==1) return "d"; if(a==3 && z==1) return "t"; if(z>=this.NucNames.length) return (a+"["+z+"]"); return (a+""+this.NucNames[z]); } this.getHTMLNucleusName = function(a,z) { if(a==1) if(z==0) return "n"; else return "p"; if(a==2 && z==1) return "d"; if(a==3 && z==1) return "t"; if(z>=NucNames.length) return (""+a+""+z); return (""+a+""+this.NucNames[z]); } }