Skip to content

Instantly share code, notes, and snippets.

@anthony17guty
Created July 24, 2019 01:53
Show Gist options
  • Save anthony17guty/2d40c108a189eba3119da0eadfd8c970 to your computer and use it in GitHub Desktop.
Save anthony17guty/2d40c108a189eba3119da0eadfd8c970 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>matrices
</title>
<script >
var a=new Array(3);b=new Array(3);c=new Array(3)
function producto()
{
for(i=1;i<=3;i++)
{ a[i]=[1,3,4,6];b[i]= [1,4,6,7];c[i]= [8,7,5,3]
for(j=1;j<=3;j++)
{ a[i][j]=parseFloat(document.matriza[3*i+j-4].value)
b[i][j]=parseFloat(document.matrizb[3*i+j-4].value) } }
for(i=1;i<=3;i++)
{ for(j=1;j<=3;j++)
{ c[i][j]=0
for(k=1;k<=3;k++)
{c[i][j]=c[i][j]+a[i][k]*b[k][j] }
document.matrizc[3*i+j-4].value=c[i][j] } }
}
</script>
</head>
<body text=white bgcolor=green
Producto de matrices (3x3)
<form name="matriza">
A=<BR> <input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3">
</form>
<form name="matrizb">
B=<BR> <input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3">
<input type="button" value="Generar" onClick=" producto()">
</form>
<form name="matrizc">
Matriz producto C=AxB<BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3"><BR>
<input type="text" size="3">
<input type="text" size="3">
<input type="text" size="3">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment