public class IntegralTrapesium{ // xf = x yg dicari // n = jumlah elemen // n-1 = index paling maksimum dari array elemen // // i x[i] y[i] dxf[i] dx[i][j] dx[1][i] dx[n-1][i] // prg: i=0 j=i prg: i=1 j=i ... prg: i=n-1 j=i // === ====== ====== ========= ============ ============ ============== // 0 x[0] y[0] xf-x[0] force 1 x[1]-x[0] ... x[n-1]-x[0] // 1 x[1] y[1] xf-x[1] x[0]-x[1] force 1 ... x[n-1]-x[1] // 2 x[2] y[2] xf-x[2] x[0]-x[2] x[1]-x[2] ... x[n-1]-x[2] // 3 x[3] y[3] xf-x[3] x[0]-x[3] x[1]-x[3] x[n-1]-x[3] // . . . . . . . // . . . . . . . // n-2 x[n-2] y[n-2] xf-x[n-2] x[0]-x[n-2] x[1]-x[n-2] x[n-1]-x[n-2] // n-1 x[n-1] y[n-1] xf-x[n-1] x[0]-x[n-1] x[1]-x[n-1] ... force 1 // --- ------ ------ -------(*) --------(*) ---------(*) ------------(*) // n dxf[n] dx[0][n] dx[1][n] ... dx[n-1][n] // // public static void main(String[] args) { double[] x={1.0, 1.1, 1.2, 1.3, 1.4}; double[] y={2.0, 2.1, 2.3, 2.7, 3.5}; int n=x.length; double[][] dx=new double[n][n+1]; double xf=1.05; double[] dxf= new double[n+1]; //persiapan tabel; dxf[5]=1; for (int i=0; i