public double [] GF(int n,double []x,double ele[],double []z,double []sd,double []la,double []yy,double []ydist,double ddx,double t,double []gc) {

		double xx = 0,z2 = 0,y1 = 0,gff,ggc=0;
		double []effy = new double [3]; 
		double []gg2 = new double [3];
		double z1 = 0.0;
		double GK = 13.3333;
		for(int JJ = 1 ; JJ <= n ;JJ++){
			gc[JJ]=0.0;
		}      
		for(int II = 1 ; II <= n ; II++){
			for(int LL = 1 ; LL <= n; LL++) {
				xx = x[II] - x[LL];
				z2 = z[LL];
				effy[1] = yy[LL] - ydist[LL];
				effy[2] = yy[LL] + ydist[LL];
				double dx = ddx/10;
				double zb = z2 - z1;
				double dz = 0,dc = 0; 
				double []zk = new double[1000];
				double []gs = new double[1000];

				int nd = (int)(zb / dx) + 1;
				int n1 = nd / 2;
				if (nd - (2 * n1 ) < 0 || nd - ( 2 * n1 ) > 0) {
					nd = nd + 1;
				}
				dz = zb / nd;
				int n2 = nd + 1;
				for (int JZ = 1 ; JZ <= n2; JZ++) {
					zk[JZ] = z1 + dz * (JZ - 1);
				}      
				for (int JZ = 1; JZ <= n2; JZ++) {
					dc = (sd[LL] * Math.exp(la[LL] * zk[JZ])); 
					for (int LK = 1 ; LK <= 2; LK++) {
						y1 = effy[LK];
						double t1 = GK * dc;
						double t2 = Math.atan((y1 * (xx + t)) / (Math.sqrt(Math.pow((xx + t), 2) + Math.pow(y1, 2) + Math.pow(zk[JZ]-ele[II], 2)) * (zk[JZ]-ele[II])));
						double t3 = Math.atan((y1 * (xx - t)) / (Math.sqrt(Math.pow((xx - t), 2) + Math.pow(y1, 2) + Math.pow(zk[JZ]-ele[II], 2))* (zk[JZ]-ele[II])));
						gg2[LK] = t1 * (t2 - t3);
					}
					gs[JZ] = (gg2[1] + gg2[2]) / 2.0;
				}      
				gff = SIMP(gs,zk,n2,ggc);
				gc[II] = gc[II] + gff;

			}
		}
		return gc;
	}