Powered By Blogger

miércoles, 29 de octubre de 2008

Deber Operaciones con Matriz

Inge aqui está el deber de las Operaciones con Matrices
Att. Gustavo Araujo
9vo Nivel "A"

using System;
using System.Collections.Generic;
using System.Text;

namespace CMatrices
{
class clsMatrices
{
int[,] A, B, C;
public clsMatrices()
{

}
public static void CargaMatrices(int[,] M1, int[,] M2)
{

for (int i = 0; i < j="0" i =" 0;" j =" 0;" i =" 0;" j =" 0;" i =" 0;" j =" 0;" i =" 0;" j =" 0;" columna ="=" mensaje =" true;" mensaje =" false;" i =" 0;" j =" 0;" i =" 0;" j =" 0;" i =" 0;" j =" 0;" k =" 0;">
{
MR[i, j] += M1[i, K] * M2[K, j];
}
}
}

}
public static void CargaMatricesT(int[,] M1)
{

for (int i = 0; i < j =" 0;" fila ="=" mensaje =" true;" mensaje =" false;" i =" 0;" j =" 0;" i =" 0;" j =" 0;" determinante =" (Moriginal[0," i =" 0;" j =" 0;" i =" 0;" j =" 0;" opc =" Console.ReadLine();" fila =" Convert.ToInt32(Console.ReadLine());" columna =" Convert.ToInt32(Console.ReadLine());" m1 =" new" m2 =" new" mr =" new" fila =" Convert.ToInt32(Console.ReadLine());" columna =" Convert.ToInt32(Console.ReadLine());" m1 =" new" m2 =" new" mr =" new" fila =" Convert.ToInt32(Console.ReadLine());" columna =" Convert.ToInt32(Console.ReadLine());" fila2 =" Convert.ToInt32(Console.ReadLine());" columna2 =" Convert.ToInt32(Console.ReadLine());" objmatriz =" new" msgvalida =" objMatriz.ValidaMatrizMul(fila," msgvalida ="=" m1 =" new" m2 =" new" mr =" new" fila =" Convert.ToInt32(Console.ReadLine());" columna =" Convert.ToInt32(Console.ReadLine());" objmatriz2 =" new" msgdevalidez =" objMatriz2.ValidaMatrizTranspuesta(fila," msgdevalidez ="=" m1 =" new" mr =" new" o =" 2;" moriginal =" new" mres="new" minversa =" new" objmatriz =" new" determinante=" objMatriz.CalculaDeterminante(Moriginal);" fila =" Convert.ToInt32(Console.ReadLine());" columna =" Convert.ToInt32(Console.ReadLine());" escalar =" Convert.ToInt32(Console.ReadLine());" m1 =" new" mr =" new" opc = "7">

miércoles, 22 de octubre de 2008

Matriz

Daniel Dávila C.
9no "A"


MAIN

public class Main
{
public Main()
{
}
public static void main(String[] args)
{
Matriz m= new Matriz(2,2);
System.out.println(m.toString());
m.setMatriz(0, 0, 2);
m.setMatriz(0, 1, 3);
m.setMatriz(1, 0, 4);
m.setMatriz(1, 1, 5);
System.out.println(m);
System.out.println(m.transpuesta());
System.out.println(m.Suma(m));
System.out.println(m.Multiplicacion(m));
}
}


MATRIZ

public class Matriz
{
private int numFilas;
private int numColumnas;
public double [][]matriz ;
public Matriz(int nF, int nC)
{
this.numFilas=nF;
this.numColumnas=nC;
this.matriz=new double[this.numFilas][this.numColumnas];
int j;
for(int i=0;i for(j=0;j matriz[i][j]=0;
}
public Matriz(int nF, double e)
{
this.numFilas=nF;
this.numColumnas=nF;
this.matriz= new double[numFilas][numColumnas ];
int j;
for(int i=0;ifor(j=0;j{
if(i==j)
matriz[i][j]=e;
else
matriz[i][j]=0;
}
}
public Matriz transpuesta()
{
Matriz c=new Matriz(this.numColumnas, this.numFilas);
int j;
for(int i=0;ifor(j=0;jc.setMatriz(j, i, this.matriz[i][j]);
return c;
}
public Matriz Suma(Matriz b)
{
Matriz c=new Matriz(this.numFilas, this.numColumnas);
int j;
for(int i=0;ifor(j=0;jc.setMatriz(i, j, (this.matriz[i][j])+b.getMatriz()[i][j]);
return c;
}
public Matriz Multiplicacion(Matriz b)
{
Matriz c= new Matriz(this.numFilas,b.getNuColumnas());
int j, k;
for(int i=0;ifor(j=0;jfor(k=j;kc.setMatriz(i, j, (this.matriz[i][k])*b.getMatriz()[k][j]);
return c;
}
public void setMatriz(int i, int j, double d)
{
this.matriz[i][j]=d;
}
public int getNumFilas()
{
return numFilas;
}
public void setNumFilas(int nF)
{
this.numFilas=nF;
}
public int getNuColumnas()
{
return numFilas;
}
public void setNumColumnas(int nC)
{
this.numColumnas=nC;
}
public double[][] getMatriz()
{
return matriz;
}
public String toString()
{
String aux="";
int j;
for(int i=0;i{
for(j=0;jaux+=this.matriz[i][j]+" ";
aux+="\n";
}
return aux;
}
}