PHP Classes

File: cmd.php

Recommend this page to a friend!
  Classes of Ricardo Gamba   Matrix algebra   cmd.php   Download  
File: cmd.php
Role: Auxiliary script
Content type: text/plain
Description: Command line exe
Class: Matrix algebra
Perform operations with matrices
Author: By
Last change:
Date: 13 years ago
Size: 1,720 bytes
 

Contents

Class file image Download
<?php
error_reporting
(E_ALL ^ E_NOTICE);
include(
"matrix.php");
$Mat=new Matrix();
$cmd=stripslashes(urldecode($_POST['cmd']));
$cmd=str_replace("'",'"',$cmd);
$cmd=str_replace("mat.",'$Mat->',$cmd);
$cmd=str_replace("m.",'$Mat->',$cmd);
$cmd=str_replace("help",'echo $help',$cmd);
$cmd=str_replace("autor",'echo $author',$cmd);
$cmd=str_replace("print",'echo',$cmd);
$author='
>> Created by Ricardo Gamba, 2008
'
;
$help='

Commands
-------------------------
mat.create(): Matrix creation function
    Args: matrix [string] Formato: \'[1 2 3;4 5 6]\'
   
mat.sum(a,b): Matrix sum function
    Args: matrix a, matriz o numero b
   
mat.subs(a,b): Matriz substraction function
    Args: matrix a, matriz o numero b
   
mat.mult(a,b): Matrix multiplication function
    Args: matrix a, matriz b

mat.dmult(a,b): Direct multiplication (NOTE: Is NOT algebraic matrix multiplication)
    Args: matrix a, matriz o numero b
   
mat.det(a): Calculates the determinant of a matrix
    Args: matrix a
   
mat.solve(a): Solve the matrix using the Gauss Jordan reduction algorythm
    Args: augmented matrix a
   
mat.decimals(num): Establish decimal precision

mat.plot(a,texto): Print the matrix on a readable way
    Args: a matrix, text = title text (caption)

mat.I(num): Create an identity matrix
    Args: n x m array or integer
   
mat.add(a,b): Add the b matrix to the a matrix (matrix glue)
    Args: a, matrix to be augmented. b : matrix to be appended
    Note: the matrix are just joined together, not operated

mat.trans(a): Obtain the matrix transpose
    Args: matrix a

mat.adj(a): Calculate the adjoint of the matrix
    Args: matrix a

mat.inv(a): Calculate the matrix inverse
    Args: matrix a
'
;
eval(
$cmd);