#native_company# #native_desc#
#native_cta#

Augmented Matrixes

By Craig
on January 8, 2005

Version: 1.0.0

Type: Full Script

Category: Math Functions

License: Artistic License

Description: This function will solve an augmented matrix or an algebra double elimiation problem.

<?
function dlimin($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l){
	$ans[0] = ($a*$f*$k)+($b*$g*$i)+($c*$e*$j)-($i*$f*$c)-($j*$g*$a)-($k*$e*$b);
	$ans[1] = ($d*$f*$k)+($b*$g*$l)+($c*$h*$j)-($l*$f*$c)-($j*$g*$d)-($k*$h*$b);
	$ans[2] = ($a*$h*$k)+($d*$g*$i)+($c*$e*$l)-($i*$h*$c)-($l*$g*$a)-($k*$e*$d);
	$ans[3] = ($a*$f*$l)+($b*$h*$i)+($d*$e*$j)-($i*$f*$d)-($j*$h*$a)-($l*$e*$b);
	$ans['x'] = $ans[1]/$ans[0];
	$ans['y'] = $ans[2]/$ans[0];
	$ans['z'] = $ans[3]/$ans[0];
	if($ans[0] != '0'){
		echo "X = ".round($ans['x'], 5).", Y = ".round($ans['y'], 5).", Z = ".round($ans['z'], 5)."";
	}else{
		echo "Division by 0: no solution.";
	}
}
?>
<form method=POST name="dlimin" action=<? echo $_SERVER['PHP_SELF']; ?>>
<table>
<tr>
<td>A:<input type="text" name="a"></td>
<td>B:<input type="text" name="b"></td>
<td>C:<input type="text" name="c"></td>
<td>D:<input type="text" name="d"></td>
</tr>
<tr>
<td>E:<input type="text" name="e"></td>
<td>F:<input type="text" name="f"></td>
<td>G:<input type="text" name="g"></td>
<td>H:<input type="text" name="h"></td>
</tr>
<tr>
<td>I:<input type="text" name="i"></td>
<td>J:<input type="text" name="j"></td>
<td>K:<input type="text" name="k"></td>
<td>L:<input type="text" name="l"></td>
</tr>
<tr>
<td colspan=3><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
<?
if(isset($_POST['submit'])){
	dlimin($_POST['a'], $_POST['b'], $_POST['c'], $_POST['d'], $_POST['e'], $_POST['f'], $_POST['g'], $_POST['h'], $_POST['i'], $_POST['j'], $_POST['k'], $_POST['l']);
}
?>