Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //montante.java Karen Alduncin 1476867
- package carpeta;
- import carpeta.Fracciones;
- import java.util.*;
- public class Montante extends Fracciones
- {
- public static void main (String args[])
- {
- int n,i,j,temp,iteracion=0;
- //._. crear metodos fuera de este chingado metodo( ) ;
- System.out.println("dame el tamaño de tu matriz : ");
- Scanner lector = new Scanner(System.in);
- n= lector.nextInt();
- //madres .l.
- //construir :D MADRES ;@
- Fracciones MatAnt = new MatAnt[n][2*n];
- Fracciones MatAnt = new MatAct[n][2*n];
- Fracciones MAtAnt = new otemp();
- Fracciones MatAnt = new PivoteAnterior();
- Fracciones MAtAnt = new PivoteActual();
- for(i=0;i<n;j++)
- {
- for(j=0;j<n;j++)
- {
- System.out.println("valor de ["+i+"]["+j+"] :");
- temp=lector.nextInt();
- otemp=(Fracciones)temp;//.D
- MatAnt[i][j+n]=otemp;
- if(i==j)
- {
- otemp= Fraccion(1);
- MatAnt[i][j+n]=otemp;
- }
- }
- }
- PivoteAnt=Fraccion(1);
- for(i=0;i<n;i++)
- {
- for(j=0;j<2*n;j++)
- {
- System.out.print(" ");
- MatAnt[i][j].printf();
- }
- System.out.print("\n");
- }
- do
- {
- PivoteActual=MatAnt[iteracion][iteracion];
- for(j=0;j<n*2;j++)
- {
- MatAct[iteracion][j]=MatAnt[iteracion][j]/PivoteActual;
- }
- //._.
- for(i=0;i<n;i++)
- {
- if(i!=iteracion)
- {
- otemp=Fraccion(0);
- MatAnt[i][iteracion]=otemp;
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=0;j<2*n;j++)
- {
- if(i !=iteracion)
- {
- if(j!=iteracion)
- {
- MatAct[i][j]=((PivoteActual*MatAnt[i][j])
- -(MatAnt[i][iteracion]*MatAct[iteracion][j]/PivoteAnterior));//act
- }
- }
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=0;j<2*n;j++)
- {
- MatAnt[i][j]=MatAct[j][i]; //wait
- }
- }
- PivoteAnterior=PivoteActual;
- iteracion++;
- //....
- System.out.print("\n\n");
- //c/u
- for(i=0;i<n;i++)
- {
- for(j=0;j<2*n;j++)
- {
- System.out.print(" ");
- MatAnt[i][j].printf();
- }
- System.out.print("\n ");
- }
- System.out.print("\n");
- }
- while(iteracion< n);
- System.out.print("\n\n");
- for(i=0;i<n;i++)
- {
- for(j=0;j<2*n;j++)
- {
- System.out.print(" ");
- MatAnt[i][j].printf();
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement