Permalink
Browse files

Merge pull request #52 from ChrisRackauckas/master

Fixed errors and added to the documentation
  • Loading branch information...
2 parents fdbb9ae + 9c3a11d commit e90f2d1c34387538fcf4bd934badbe1b0e81ee59 @trevnorris trevnorris committed Jun 9, 2012
Showing with 88 additions and 26 deletions.
  1. +73 −11 doc/md/linear-algebra.md
  2. +15 −15 src/test.js
View
@@ -1,5 +1,7 @@
## Linear Algebra
+## Instance Functionality
+
### add( arg )
Add value to all entries.
@@ -48,27 +50,87 @@ Compulte the norm of a vector.
Compute the angle between two vectors.
-### aug()
+## Static Functionality
+
+### add( arr, arg )
+
+Add arg to all entries of the array
+
+### subtract( arr, arg )
+
+Subtract all entries of the array by arg
+
+### divide( arr, arg )
+
+Divide all entries of the array by arg.
+
+### multiply( arr, arg )
+
+Multiply all entries of the array by arg.
+
+### dot( arr1, arr2 )
+
+Take dot product of array 1 and array 2.
+
+### pow( arr, arg )
+
+Raise all entries of the array to the power of arg
+
+### abs(arr)
+
+Return the absolute values of all entries in the array
+
+### norm(arr)
+
+Compulte the norm of a vector.
+
+### angle( arr1, arr2 )
+
+Compute the angle between two vectors.
+
+### aug(A,B)
+
+Augments matrix A by matrix B
+
+### det(A)
+
+Calculates the determinant of matrix A.
+
+### inv(A)
+
+Returns the inverse of the matrix A.
+
+### gauss_elimination(A,B)
+
+Performs Gaussian Elimination on matrix A augmented by matrix B.
+
+### gauss_jordan(A,B)
+
+Performs Gauss-Jordan Elimination on matrix A augmented by matrix B.
+
+### lu(A,B)
+
+Performs the LU-Decomposition on matrix A.
-### det()
+### cholesky(A)
-### inv()
+Performs the Cholesky decomposition on matrix A.
-### gauss_elimination()
+### gauss_jacobi(A,b,x,r)
-### gauss_jordan()
+Solves the linear system Ax = b using the Gauss-Jacobi method with an initial guess of r.
-### lu()
+### gauss_seidel(A,b,x,r)
-### cholesky()
+Solves the linear system Ax = b using the Gauss-Seidel method with an initial guess of r.
-### gauss_jacobi()
+### SOR(A,b,x,r,w)
-### gauss_seidel()
+Solves the linear system Ax = b using the sucessive over-relaxation method with an initial guess of r and parameter w (omega).
-### SOR()
+### householder(A)
-### householder()
+Performs the householder transformation on the matrix A.
### QR()
View
@@ -26,16 +26,16 @@ jStat.extend({
if ( args.length === 4 ) {
if( isNumber( args[1] )) {
return ( args[3] === 1 ) ?
- ( 1 - jStat.normal.cdf( Math.abs( args[0] ), args[1], args[2] )) :
- ( 1 - 2 * jStat.normal.cdf( Math.abs( args[0] ), args[1], args[2] ));
+ (1-jStat.normal.cdf( Math.abs( args[0] ), args[1], args[2] )) :
+ ( 2 * jStat.normal.cdf( Math.abs( args[0] ), args[1], args[2] )- 2);
}
return ( args[2] === 1 ) ?
( 1 - jStat.normal.cdf( Math.abs( args[0] ), jStat.mean( args[1] ), jStat.stdev( args[1],args[3] ))) :
- ( 1 - 2 * jStat.normal.cdf( Math.abs( args[0] ), jStat.mean( args[1] ), jStat.stdev( args[1],args[3] )));
+ ( 2 * jStat.normal.cdf( Math.abs( args[0] ), jStat.mean( args[1] ), jStat.stdev( args[1],args[3] ))-2);
}
return ( args[1] === 1 ) ?
( 1 - jStat.normal.cdf( Math.abs( args[0] ), 0, 1 )) :
- ( 1 - 2 * jStat.normal.cdf( Math.abs( args[0] ), 0, 1 ));
+ ( 2 * jStat.normal.cdf( Math.abs( args[0] ), 0, 1 )-2);
}
});
@@ -48,7 +48,7 @@ jStat.extend( jStat.fn, {
var zscore = Math.abs( this.zscore( value, flag ));
return ( sides === 1 ) ?
( 1 - jStat.normal.cdf( zscore, 0, 1 )) :
- ( 2 * ( 1 - jStat.normal.cdf( zscore, 0, 1 )));
+ (2 * jStat.normal.cdf( zscore, 0, 1 ) -2);
}
});
@@ -69,24 +69,24 @@ jStat.extend({
// ( tscore, n, sides )
// ( value, array, sides )
ttest : function() {
- var args = slice.call( arguments ),
- tscore;
+ var args = slice.call( arguments );
+ var tscore;
if ( args.length === 5 ) {
tscore = Math.abs( jStat.tscore( args[0], args[1], args[2], args[3] ));
return ( args[4] === 1 ) ?
- ( 1 - jStat.studentt.cdf( tscore, args[3] - 1 )) :
- ( 1 - ( 2 * jStat.studentt.cdf( tscore, args[3] - 1 )));
+ ( 1 - jStat.studentt.cdf( tscore, args[3] )) :
+ ( 2 * jStat.studentt.cdf( tscore, args[3])-2);
}
if ( isNumber( args[1] )) {
tscore = Math.abs( args[0] )
return ( args[2] == 1 ) ?
- ( 1 - jStat.studentt.cdf( tscore, args[1] - 1 )) :
- ( 2 * ( 1 - jStat.studentt.cdf( tscore, args[1] - 1 )));
+ ( 1 - jStat.studentt.cdf( tscore, args[1])) :
+ ( 2 * jStat.studentt.cdf( tscore, args[1])-2);
}
tscore = Math.abs( jStat.tscore( args[0], args[1] ))
return ( args[2] == 1 ) ?
- ( 1 - jStat.studentt.cdf( tscore, args[1].length - 1 )) :
- ( 2 * ( 1 - jStat.studentt.cdf( tscore, args[1].length - 1 )));
+ ( 1 - jStat.studentt.cdf( tscore, args[1].length-1)) :
+ ( 2 * jStat.studentt.cdf( tscore, args[1].length-1)-2);
}
});
@@ -97,8 +97,8 @@ jStat.extend( jStat.fn, {
ttest : function( value, sides ) {
return ( sides === 1 ) ?
- ( 1 - jStat.studentt.cdf( Math.abs( this.tscore(3)), this.cols() - 1 )) :
- ( 2 * ( 1 - jStat.studentt.cdf( Math.abs( this.tscore(3)), this.cols() - 1 )));
+ ( 1 - jStat.studentt.cdf( Math.abs( this.tscore(value)), this.cols()-1)) :
+ ( 2 * jStat.studentt.cdf( Math.abs( this.tscore(value)), this.cols()-1)-2);
}
});

0 comments on commit e90f2d1

Please sign in to comment.