1 | /* quelques fonctions mathematiques et constantes utiles */
|
---|
2 | /* cmv 23/06/94 */
|
---|
3 | #ifndef NBMATH_H_SEEN
|
---|
4 | #define NBMATH_H_SEEN
|
---|
5 |
|
---|
6 | #include <machine.h>
|
---|
7 |
|
---|
8 | #ifdef __cplusplus
|
---|
9 | extern "C" {
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | /* EA conflit entre les diverses copies de nbmath.h, nbconst.h... A nettoyer... */
|
---|
13 | #undef Pi
|
---|
14 | #undef Pis2
|
---|
15 | #undef DeuxPi
|
---|
16 | #undef SPi
|
---|
17 | #undef S2Pi
|
---|
18 | #undef Rac2
|
---|
19 | #undef Log2
|
---|
20 | #undef LnPi
|
---|
21 | #undef LgPi
|
---|
22 | #undef Ln10
|
---|
23 | #undef DftoDm
|
---|
24 | #undef Hln2pi
|
---|
25 | #undef JourSec
|
---|
26 | #undef AnSec
|
---|
27 |
|
---|
28 | #undef GRAND
|
---|
29 | #undef GRAND2
|
---|
30 | #undef IGRAND
|
---|
31 |
|
---|
32 | #define Pi (double) ( 3.14159265358979310e+00) /* c'est Pi */
|
---|
33 | #define Pis2 (double) (1.57079632679489655) /* c'est Pi/2 */
|
---|
34 | #define DeuxPi (double) ( 6.28318530717958620e+00) /* c'est 2*Pi */
|
---|
35 | #define SPi (double) ( 1.77245385090551590e+00) /* c'est sqrt(Pi) */
|
---|
36 | #define S2Pi (double) ( 2.50662827463100020e+00) /* c'est sqrt(2*Pi) */
|
---|
37 | #define Rac2 (double) ( 1.41421356237309510e+00) /* c'est sqrt(2) */
|
---|
38 | #define Log2 (double) ( 3.01029995663981200e-01) /* c'est log10(2) */
|
---|
39 | #define LnPi (double) ( 1.14472988584940020e+00) /* c'est ln(Pi) */
|
---|
40 | #define LgPi (double) ( 4.97149872694133850e-01) /* c'est log10(Pi) */
|
---|
41 | #define Ln10 (double) ( 2.30258509299404590e+00) /* c'est ln(10) */
|
---|
42 | #define DftoDm (double) ( 1.08573620475812940e+00) /* c'est 2.5/ln(10) */
|
---|
43 | #define Hln2pi (double) ( 9.18938533204672670e-01) /* c'est Ln(2*pi)/2 */
|
---|
44 |
|
---|
45 | #define JourSec (float) (86400.000000) /* nombre de secondes dans 24H */
|
---|
46 | #define AnSec (int) (31557600) /* nombre de secondes dans 365.25 jours */
|
---|
47 |
|
---|
48 | #define GRAND (float) (1.e+35)
|
---|
49 | #define GRAND2 (double) (1.e+35)
|
---|
50 | #define IGRAND (int_4) (2147483647)
|
---|
51 |
|
---|
52 | /* pour le fit 1-dim */
|
---|
53 | #define NPAR_FITFUN 10
|
---|
54 | #define FITFUN_FLOAT 1
|
---|
55 | #define FITFUN_DOUBLE 2
|
---|
56 | union FloatDouble { float *fx; double *dx; };
|
---|
57 | typedef union FloatDouble FLOATDOUBLE;
|
---|
58 |
|
---|
59 | double FitFun( double (*FunFit) (double ,double *,double *) ,int_4 type
|
---|
60 | ,FLOATDOUBLE temps,FLOATDOUBLE mag,FLOATDOUBLE err
|
---|
61 | ,int_4 *ndata,int_4 I1,int_4 I2
|
---|
62 | ,double *par,double *epar,double *stepar
|
---|
63 | ,double *minpar,double *maxpar,int_4 npar
|
---|
64 | ,double stochi2,int_4 NstepMX,int_4 deb);
|
---|
65 |
|
---|
66 | double GausPiv(double *A,int_4 nca,int_4 n,double *B,int_4 ncb,int_4 m,int_4 Inv);
|
---|
67 |
|
---|
68 | int_4 paramga(float sxin, float syin, float rhoin
|
---|
69 | , float *smax, float *axisrat, float *tiltdeg);
|
---|
70 | int_4 gaparam(float smax, float axisrat, float tiltdeg
|
---|
71 | , float *sxin, float *syin, float *rhoin);
|
---|
72 |
|
---|
73 | double nberfc(double x);
|
---|
74 | float probnb(float sci2,int_4 inddl,int_4 *ipass);
|
---|
75 | double nbgammln(double xx);
|
---|
76 | double nbgammq(double a,double x);
|
---|
77 | double nbgammp(double a,double x);
|
---|
78 |
|
---|
79 | void Set_Ihoq(int degre,int *mIhoqN,double *IhoqNX,double *IhoqNW);
|
---|
80 | int Get_Ihoq(int degre,double *IhoqNX,double *IhoqNW);
|
---|
81 | void nbgauleg(double x1,double x2,double *x,double *w,int n);
|
---|
82 | double Integ_Fun(double xmin,double xmax,double (*fonc)(double),int npas);
|
---|
83 | double Integ_Fun_2D(double (*fonc)(double x,double y)
|
---|
84 | ,double xmin,double xmax,double ymin,double ymax
|
---|
85 | ,int npasx,int npasy);
|
---|
86 |
|
---|
87 | void Set_FitFunDPol(int DPol);
|
---|
88 | double Gauss1DPolF(double x,double *Par,double *DgDpar);
|
---|
89 | double GaussI1DPol(double x,double *Par,double *DgDpar);
|
---|
90 | double Polyn1D(double x,double *Par,double *DgDpar);
|
---|
91 |
|
---|
92 | double FitProp(double *x,double *y,double *ey,int *n,double *a1);
|
---|
93 | double FitLin(double *x,double *y,double *ey,int *n
|
---|
94 | ,double *a0,double *a1);
|
---|
95 | double FitPar(double *x,double *y,double *ey,int *n
|
---|
96 | ,double *a0,double *a1,double *a2);
|
---|
97 | double FitParLin(double *xx,double *y,double *ey,int *n,double x0,int Deg_d
|
---|
98 | ,double *a0,double *a1,double *b1,double *b2);
|
---|
99 | double FitPropClean(double *x,double *y,double *ey,int *n
|
---|
100 | ,double per_clean,double *a1);
|
---|
101 | double FitLinClean(double *x,double *y,double *ey,int *n
|
---|
102 | ,double per_clean,double *a0,double *a1);
|
---|
103 | double FitParClean(double *x,double *y,double *ey,int *n
|
---|
104 | ,double per_clean,double *a0,double *a1,double *a2);
|
---|
105 |
|
---|
106 | float interpole(float x,int n,float *t1,float *t2);
|
---|
107 |
|
---|
108 | int_4 MeanSig(float *mag,float *err,int_4 *ndata,float nsigma,float *mean,float *sigma);
|
---|
109 | int Most_Probable( float *val, int nval, float binin, int nmoy
|
---|
110 | , float low, float high, float *most, int deb);
|
---|
111 | float Ajust_GaFn(int Ns,float *fcfr
|
---|
112 | ,float *haut,float *ehaut,float *mean,float *emean
|
---|
113 | ,float *sigma,float *esigma,float *fond,float *efond
|
---|
114 | ,int fixfond,int NBIN_RESOL
|
---|
115 | ,float perc_net,float frac_sgb,float dyn_sgb,int deb);
|
---|
116 | float HFit_GaFn(int Ns,float *fcfr
|
---|
117 | ,float *haut,float *ehaut,float *mean,float *emean
|
---|
118 | ,float *sigma,float *esigma,float *fond,float *efond
|
---|
119 | ,int fixfond,int nbin,float xmin,float xmax,int deb);
|
---|
120 | int Ajust_MnSg(int Ns,float *fcfr
|
---|
121 | ,float *mean,float *emean,float *sigma,float *esigma
|
---|
122 | ,float perc_net,float n_sigma,int deb);
|
---|
123 |
|
---|
124 | float Int3DCube(float(*fonction)(float, float, float), float step,
|
---|
125 | float precision);
|
---|
126 |
|
---|
127 | int IntFaisDr(int n,float *cs,float *sn,float *p,float *x0,float *y0
|
---|
128 | ,int npass,float perclean,int lp);
|
---|
129 |
|
---|
130 | #ifdef __cplusplus
|
---|
131 | }
|
---|
132 | #endif
|
---|
133 |
|
---|
134 | #endif
|
---|