Scientific Calculator
RRRaguindin/matrix2
Solution of 2x2 Matrix Equations
Tagged:
var matrix2 = function() {
var promptForNumber = function (text, title, default) {
var result = false;
while (result == false) -> result = number(prompt(text, title, default));
result;
};
var a11 = promptForNumber( "Enter a value for a11", "a11", 1 );
var a12 = promptForNumber( "Enter a value for a12", "a12", 0 );
var k1 = promptForNumber( "Enter a value for k1", "k1", 1+1i );
var a21 = promptForNumber( "Enter a value for a21", "a21", 0 );
var a22 = promptForNumber( "Enter a value for a22", "a22", 1 );
var k2 = promptForNumber( "Enter a value for k2", "k2", 3-4i );
var coeff=[[a11,a12],[a21,a22]];
var coeffk1=[[k1,a12],[k2,a22]];
var coeffk2=[[a11,k1],[a21,k2]];
var x=det(coeffk1)/det(coeff);
var y=det(coeffk2)/det(coeff);
alert(concat("x = ", string(x)));
alert(concat("y = ", string(y)));
};
0 Comments
Sign in to leave a comment