## Sistema de ecuaciones lineales

 public class Vector { public int n; //dimensión public double[] x; public Vector(int n) { this.n=n; x=new double[n]; for(int i=0; i=0; i--){ c.x[i][s]=b.x[i][s]/a.x[i][i]; for(int k=n-1; k>i; k--){ c.x[i][s]-=a.x[i][k]*c.x[k][s]/a.x[i][i]; } } } return c; } }  `class Colision { public static void main(String[] args) { //datos double ang=0*Math.PI/180; double mu=0.1; double e=0.94; double u1=3.5; double M=0.5; double k=0.5; //discos //incógnitas double v1; double v2; double w1; double w2; double fi1; double fi2; double Q; if(ang==0){ //choques frontales v1=(M-e)*u1/(1+M); v2=M*(1+e)*u1/(1+M); fi1=.0; fi2=0.0; w1=0.0; w2=0.0; }else{ //choques oblicuos double[][] matriz={ {Math.sin(ang), Math.cos(ang), -Math.sin(ang), -Math.cos(ang), 1.0, 1.0}, {0.0, M, 0.0, 1.0, 0.0, 0.0}, {M, 0.0, 1.0, 0.0, 0.0, 0.0}, {-Math.cos(ang), Math.sin(ang), Math.cos(ang), -Math.sin(ang),0.0, 0.0}, {Math.sin(ang), Math.cos(ang), 0.0, 0.0, -k, 0.0}, {0.0, 0.0, Math.sin(ang), Math.cos(ang), 0.0, k} }; Matriz coef=new Matriz(matriz); double[] vector={ 0.0, 0.0, (M*u1), (e*u1*Math.cos(ang)), (u1*Math.sin(ang)), 0.0 }; Vector ter=new Vector(vector); Vector solucion=Matriz.producto(Matriz.inversa(coef), ter); System.out.println("No desliza "); //desliza o no desliza? double V1x=solucion.x[0]; double V1y=solucion.x[1]; double V2x=solucion.x[2]; double V2y=solucion.x[3]; w1=solucion.x[4]; w2=solucion.x[5]; double A=mu*(V1y*Math.sin(ang)-(V1x-u1)*Math.cos(ang)); double B=u1*Math.sin(ang)-V1x*Math.sin(ang)-V1y*Math.cos(ang); if(A