mathlib-commitlog Mailing List for JMathLib - Octave, Matlab clone in java (Page 41)
Status: Beta
Brought to you by:
st_mueller
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(4) |
Aug
(150) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(233) |
Feb
(86) |
Mar
(32) |
Apr
(26) |
May
(73) |
Jun
(45) |
Jul
(23) |
Aug
(23) |
Sep
(5) |
Oct
(80) |
Nov
(11) |
Dec
(11) |
| 2008 |
Jan
|
Feb
|
Mar
(13) |
Apr
(3) |
May
(7) |
Jun
(30) |
Jul
(12) |
Aug
(12) |
Sep
|
Oct
|
Nov
(78) |
Dec
(78) |
| 2009 |
Jan
(214) |
Feb
(79) |
Mar
(20) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:33:40
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberTokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28595/Source/MathLib/Tokens/NumberTokens Log Message: Directory /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberTokens added to the repository |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:37:03
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv9756 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** ChangeLog.txt 18 Jan 2007 19:31:47 -0000 1.151 --- ChangeLog.txt 18 Jan 2007 19:36:56 -0000 1.152 *************** *** 9,13 **** ---- Functional Changes: version 0.7.0 -> 0.x.x ------------------------------ New functions: ! angle.java, beta.m, betaln.m, center.m, close.java, compan.m, complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, --- 9,14 ---- ---- Functional Changes: version 0.7.0 -> 0.x.x ------------------------------ New functions: ! angle.java, beta.m, betaln.m, center.m, cloglog.m, close.java, compan.m, ! complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, *************** *** 35,40 **** 2007/01/18 stefan * Tokens/CellArrayToken.java added better support for empty constructor ! stefan + Functions/Statistics/center.m ! stefan + Functions/Statistics/meansq.m 2007/01/17 --- 36,42 ---- 2007/01/18 stefan * Tokens/CellArrayToken.java added better support for empty constructor ! stefan + Functions/Statistics/base/center.m ! stefan + Functions/Statistics/base/meansq.m ! stefan + Functions/Statistics/base/cloglog.m 2007/01/17 |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:36:01
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Statistics/base In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv9369/Source/MathLib/Functions/Statistics/base Added Files: cloglog.m Log Message: --- NEW FILE: cloglog.m --- ## Copyright (C) 1995, 1996, 1997 Kurt Hornik ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} cloglog (@var{x}) ## Return the complementary log-log function of @var{x}, defined as ## ## @example ## - log (- log (@var{x})) ## @end example ## @end deftypefn ## Author: KH <Kur...@wu...> ## Description: Complementary log-log function function y = cloglog (x) if (nargin != 1) print_usage (); endif y = - log (- log (x)); endfunction /* @GROUP statistics @SYNTAX cloglog(x) @DOC Return the complementary log-log function of @EXAMPLES <programlisting> cloglog(8) </programlisting> @SEE std, var, cov, log, ln */ |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:31:55
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7391 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** ChangeLog.txt 17 Jan 2007 19:54:14 -0000 1.150 --- ChangeLog.txt 18 Jan 2007 19:31:47 -0000 1.151 *************** *** 9,22 **** ---- Functional Changes: version 0.7.0 -> 0.x.x ------------------------------ New functions: ! angle.java, beta.m, betaln.m, close.java, compan.m, complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, isfinite.java, ishidden.java, isnan.java, isinf.java, issymmetric.m, ! lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, mkdir.java, ! nan.java, ne.m, nthroot.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, ! perms.m, pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, pv.m, pvl.m, ! qconj.m, qderiv.m, qderivmat.m, qinv.m, qmult.m, qtrans.m, qtransv.m, ! qtransvmat.m, quaternion.m, rehash.java, repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, --- 9,22 ---- ---- Functional Changes: version 0.7.0 -> 0.x.x ------------------------------ New functions: ! angle.java, beta.m, betaln.m, center.m, close.java, compan.m, complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, isfinite.java, ishidden.java, isnan.java, isinf.java, issymmetric.m, ! lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, meansq.java, ! mkdir.java, nan.java, ne.m, nthroot.m, ntsc2rgb.m, nper.m, numel.java, orth.m, ! pascal.m, perms.m, pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, ! pv.m, pvl.m, qconj.m, qderiv.m, qderivmat.m, qinv.m, qmult.m, qtrans.m, ! qtransv.m, qtransvmat.m, quaternion.m, rehash.java, repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, *************** *** 33,36 **** --- 33,41 ---- stefan * + 2007/01/18 + stefan * Tokens/CellArrayToken.java added better support for empty constructor + stefan + Functions/Statistics/center.m + stefan + Functions/Statistics/meansq.m + 2007/01/17 stefan + Functions/General/nthroot.m |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:30:52
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Statistics/base In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6780/Source/MathLib/Functions/Statistics/base Modified Files: mean.m Added Files: meansq.m Log Message: --- NEW FILE: meansq.m --- ## Copyright (C) 1995, 1996, 1997 Kurt Hornik ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} meansq (@var{x}) ## @deftypefnx {Function File} {} meansq (@var{x}, @var{dim}) ## For vector arguments, return the mean square of the values. ## For matrix arguments, return a row vector contaning the mean square ## of each column. With the optional @var{dim} argument, returns the ## mean squared of the values along this dimension. ## @end deftypefn ## Author: KH <Kur...@wu...> ## Description: Compute mean square function y = meansq (x, varargin) if (nargin != 1 && nargin != 2) print_usage (); endif y = mean (x.^2, varargin{:}); endfunction /* @GROUP statistics @SYNTAX meansq([2,3,8],dim) @DOC Calculates the square mean value of the passed operand. @EXAMPLES <programlisting> meansq([4,2]) </programlisting> @SEE std, var, mean, cov */ Index: mean.m =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Statistics/base/mean.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mean.m 14 Jan 2007 11:26:53 -0000 1.4 --- mean.m 18 Jan 2007 19:30:42 -0000 1.5 *************** *** 131,134 **** </programlisting> @SEE ! std, var */ --- 131,134 ---- </programlisting> @SEE ! std, var, meansq */ |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:27:19
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Statistics/base In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5244/Source/MathLib/Functions/Statistics/base Added Files: mahalanobis.m Log Message: --- NEW FILE: mahalanobis.m --- ## Copyright (C) 1996, 1997 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} mahalanobis (@var{x}, @var{y}) ## Return the Mahalanobis' D-square distance between the multivariate ## samples @var{x} and @var{y}, which must have the same number of ## components (columns), but may have a different number of observations ## (rows). ## @end deftypefn ## Author: Friedrich Leisch <le...@ci...> ## Created: July 1993 ## Adapted-By: jwe function retval = mahalanobis (X, Y) if (nargin != 2) print_usage (); endif [xr, xc] = size (X); [yr, yc] = size (Y); if (xc != yc) error ("mahalanobis: X and Y must have the same number of columns"); endif Xm = sum (X) / xr; Ym = sum (Y) / yr; X = X - ones (xr, 1) * Xm; Y = Y - ones (yr, 1) * Ym; W = (X' * X + Y' * Y) / (xr + yr - 2) Winv = inv (W); retval = (Xm - Ym) * Winv * (Xm - Ym)'; endfunction |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:20:44
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Statistics/base In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv553/Source/MathLib/Functions/Statistics/base Added Files: center.m Log Message: --- NEW FILE: center.m --- ## Copyright (C) 1995, 1996, 1997 Kurt Hornik ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} center (@var{x}) ## @deftypefnx {Function File} {} center (@var{x}, @var{dim}) ## If @var{x} is a vector, subtract its mean. ## If @var{x} is a matrix, do the above for each column. ## If the optional argument @var{dim} is given, perform the above ## operation along this dimension ## @end deftypefn ## Author: KH <Kur...@wu...> ## Description: Center by subtracting means function retval = center (x, varargin) if ((nargin != 1) && (nargin != 2)) print_usage (); endif if (isvector (x)) retval = x - mean (x, varargin{:}); elseif (ismatrix (x)) if (nargin < 2) dim = find (size (x) > 1, 1); if (isempty (dim)), dim=1; endif; else dim = varargin {1}; endif sz = ones (1, ndims (x)); sz (dim) = size (x, dim); retval = x - repmat (mean (x, dim), sz); elseif (isempty (x)) retval = x; else error ("center: x must be a vector or a matrix"); endif endfunction /* @GROUP statistics @SYNTAX center(x,dim) @DOC Substract center value along the chosen dimension @EXAMPLES <programlisting> center([2,3,5,3],2) </programlisting> @SEE std, var, cov */ |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:18:02
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30248/Source/MathLib/Functions Modified Files: Function.java UserFunction.java Log Message: code cleanup Index: Function.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Function.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Function.java 2 Jan 2007 16:09:27 -0000 1.19 --- Function.java 18 Jan 2007 19:17:54 -0000 1.20 *************** *** 113,128 **** return -1; - // Check if all entrys of the arguments vector are not null - //int nargin = 0; - //for (nargin=0; nargin<operands.length; nargin++) - //{ - // // operand[x] is not null - // if (operands[nargin] == null) - // return -1; - //} - - // return number of right hand arguments return operands.length; - //return nargin; } --- 113,117 ---- *************** *** 169,191 **** } - /**Check if a parameter is of the correct type - @param parameter = the parameter to check - @param typeName = the name of the correct type, this must be the class name (e.g StringToken, NumberToken) - Throws and exception if the parameter isn't the correct type*/ - public void checkParameterType(Token parameter, String typeName) - { - try - { - if(!Class.forName("MathLib.Tokens." + typeName).isInstance(parameter)) - { - MathLib.Interpreter.Errors.throwMathLibException(ERR_INVALID_PARAMETER, new Object[] {typeName, parameter.getClass().getName()}); - } - } - catch(ClassNotFoundException exception) - { - } - } ! /**Throw arithmetic exception for external functions*/ public void throwMathLibException(String errorMessage) { --- 158,165 ---- } ! /**Throws arithmetic exception for external functions ! * @param error text to display ! * */ public void throwMathLibException(String errorMessage) { *************** *** 202,219 **** } - /**Calculates the derivative of the function*/ - //public OperandToken derivative(String deriveBy, OperandToken[] operands) - //{ - // FunctionToken result = new FunctionToken(getName()); - // result.setOperands(operands); - // return result; - //} - - /**Calculates the integral of the function*/ - //public OperandToken integral(String integrateBy, OperandToken[] operands) - //{ - // FunctionToken result = new FunctionToken(getName()); - // result.setOperands(operands); - // return result; - //} } --- 176,178 ---- Index: UserFunction.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/UserFunction.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** UserFunction.java 5 Jan 2007 14:29:21 -0000 1.36 --- UserFunction.java 18 Jan 2007 19:17:54 -0000 1.37 *************** *** 146,149 **** --- 146,155 ---- getVariables().createVariable("varargin").assign(cell); } + else + { + // varargin is empty + CellArrayToken cell = new CellArrayToken(); + getVariables().createVariable("varargin").assign(cell); + } } |
|
From: Stefan M. <st_...@us...> - 2007-01-18 19:14:19
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26465/Source/MathLib/Tokens Modified Files: NumberToken.java CellArrayToken.java CharToken.java Log Message: better support for CellArrays Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** NumberToken.java 14 Jan 2007 11:34:45 -0000 1.102 --- NumberToken.java 18 Jan 2007 19:13:58 -0000 1.103 *************** *** 337,341 **** sizeX = dx; sizeA = new int[]{sizeY, sizeX}; ! noElem = sizeY * sizeX; } // end setSize --- 337,341 ---- sizeX = dx; sizeA = new int[]{sizeY, sizeX}; ! noElem = sizeY * sizeX; } // end setSize Index: CellArrayToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CellArrayToken.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CellArrayToken.java 8 Jan 2007 18:47:34 -0000 1.9 --- CellArrayToken.java 18 Jan 2007 19:13:58 -0000 1.10 *************** *** 17,21 **** sizeY = 0; sizeX = 0; ! sizeA = null; noElem = 0; values = null; --- 17,21 ---- sizeY = 0; sizeX = 0; ! sizeA = new int[]{0,0}; noElem = 0; values = null; *************** *** 76,79 **** --- 76,82 ---- sizeY = dy; sizeX = dx; + sizeA = new int[]{sizeY, sizeX}; + noElem = sizeY * sizeX; + } // end setSize Index: CharToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CharToken.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CharToken.java 8 Jan 2007 16:20:45 -0000 1.2 --- CharToken.java 18 Jan 2007 19:14:00 -0000 1.3 *************** *** 7,11 **** { /**The value of the string*/ - //private String value; private char[][] values; --- 7,10 ---- *************** *** 31,36 **** sizeY = values.length; sizeX = values[0].length; ! sizeA = new int[]{sizeY,sizeX}; ! noElem = sizeY * sizeX; } --- 30,35 ---- sizeY = values.length; sizeX = values[0].length; ! sizeA = new int[]{sizeY,sizeX}; ! noElem = sizeY * sizeX; } *************** *** 44,49 **** sizeY = 1; sizeX = 1; ! sizeA = new int[]{sizeY,sizeX}; ! noElem = sizeY * sizeX; } --- 43,48 ---- sizeY = 1; sizeX = 1; ! sizeA = new int[]{sizeY,sizeX}; ! noElem = sizeY * sizeX; } *************** *** 79,89 **** } - - /**Gets the element at position y, x - @return null for strings*/ - //public OperandToken elementAt(int y, int x) - //{ - // return new CharToken(values[y][x]); - //} public OperandToken getElement(int y, int x) --- 78,81 ---- |
|
From: Stefan M. <st_...@us...> - 2007-01-18 18:56:34
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/String In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19076/Source/MathLib/Functions/String Modified Files: FindStr.java Log Message: Index: FindStr.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/String/FindStr.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FindStr.java 30 Dec 2006 18:04:42 -0000 1.9 --- FindStr.java 18 Jan 2007 18:56:30 -0000 1.10 *************** *** 19,24 **** //Check the parameters ! checkParameterType(operands[0], "CharToken"); ! checkParameterType(operands[1], "CharToken"); String string1 = ((CharToken)operands[0]).toString(); --- 19,27 ---- //Check the parameters ! if ( !(operands[0] instanceof CharToken)) ! throwMathLibException("findstr: works only on strings"); ! ! if ( !(operands[1] instanceof CharToken)) ! throwMathLibException("findstr: works only on strings"); String string1 = ((CharToken)operands[0]).toString(); |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:54:21
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23826 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** ChangeLog.txt 16 Jan 2007 18:45:39 -0000 1.149 --- ChangeLog.txt 17 Jan 2007 19:54:14 -0000 1.150 *************** *** 15,20 **** isfinite.java, ishidden.java, isnan.java, isinf.java, issymmetric.m, lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, mkdir.java, ! nan.java, ne.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, perms.m, ! pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, pv.m, pvl.m, qconj.m, qderiv.m, qderivmat.m, qinv.m, qmult.m, qtrans.m, qtransv.m, qtransvmat.m, quaternion.m, rehash.java, --- 15,20 ---- isfinite.java, ishidden.java, isnan.java, isinf.java, issymmetric.m, lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, mkdir.java, ! nan.java, ne.m, nthroot.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, ! perms.m, pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, pv.m, pvl.m, qconj.m, qderiv.m, qderivmat.m, qinv.m, qmult.m, qtrans.m, qtransv.m, qtransvmat.m, quaternion.m, rehash.java, *************** *** 33,36 **** --- 33,39 ---- stefan * + 2007/01/17 + stefan + Functions/General/nthroot.m + 2007/01/16 stefan + Functions/System/print_usage.java |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:53:27
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23614/Source/MathLib/Functions/General Added Files: nthroot.m Log Message: --- NEW FILE: nthroot.m --- ## Copyright (C) 2004 Paul Kienzle ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## ## Original version by Paul Kienzle distributed as free software in the ## public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {} nthroot (@var{x}, @var{n}) ## ## Compute the nth root of @var{x}, returning real results for real ## components of @var{x}. For example ## ## @example ## @group ## nthroot (-1, 3) ## @result{} -1 ## (-1) ^ (1 / 3) ## @result{} 0.50000 - 0.86603i ## @end group ## @end example ## ## @end deftypefn function y = nthroot (x, m) if (nargin != 2) print_usage (); endif y = x.^(1./m); if (isscalar (x)) x = x * ones (size (m)); endif if (isscalar (m)) m = m * ones (size (x)); endif idx = (mod (m, 2) == 1 & imag (x) == 0 & x < 0); if (any (idx(:))) y(idx) = -(-x(idx)).^(1./m(idx)); endif ## If result is all real, make sure it looks real if (all (imag (y) == 0)) y = real (y); endif endfunction %!assert(nthroot(-1,[3,-3]), [-1,-1],eps); %!assert(nthroot([-1,1],[3.1,-3]), [-1,1].^(1./[3.1,-3])); %!assert(nthroot([-1+1i,-1-1i],3), [-1+1i,-1-1i].^(1/3)); |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:46:56
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20763/Source/MathLib/Interpreter Modified Files: Parser.java Log Message: better support for double operands e.g. */ +* *^ Index: Parser.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/Parser.java,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** Parser.java 6 Jan 2007 15:01:35 -0000 1.124 --- Parser.java 17 Jan 2007 19:46:40 -0000 1.125 *************** *** 320,335 **** { Token nextToken = getNextToken(deliTyp); ! Token pToken = peekNextToken(deliTyp); // throw exception for multiple operands // e.g. a=/7 a=*8 +*5 -*8 -/9 ! if ((nextToken instanceof OperatorToken) && ! (pToken instanceof MulDivOperatorToken) ) ! Errors.throwParserException("multiple operators"); // e.g. a=^7 +^3 -^6 *^5 ^^5 !^7 ! if ((nextToken instanceof OperatorToken) && ! (pToken instanceof PowerOperatorToken) ) ! Errors.throwParserException("multiple operators"); --- 320,338 ---- { Token nextToken = getNextToken(deliTyp); ! Token pToken = peekNextToken(deliTyp); // throw exception for multiple operands // e.g. a=/7 a=*8 +*5 -*8 -/9 ! if (( (nextToken instanceof AssignmentOperatorToken) || ! (nextToken instanceof AddSubOperatorToken) ) && ! (pToken instanceof MulDivOperatorToken) ) ! Errors.throwParserException("multiple operators * /"); // e.g. a=^7 +^3 -^6 *^5 ^^5 !^7 ! if (( (nextToken instanceof AssignmentOperatorToken) || ! (nextToken instanceof AddSubOperatorToken) || ! (nextToken instanceof PowerOperatorToken) ) && ! (pToken instanceof PowerOperatorToken) ) ! Errors.throwParserException("multiple operators ^"); |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:41:31
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/miscellaneous In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18683/Source/MathLib/Functions/miscellaneous Added Files: texas_lotto.m Log Message: --- NEW FILE: texas_lotto.m --- ## Copyright (C) 1996, 1997 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} texas_lotto () ## Pick 6 unique numbers between 1 and 50 that are guaranteed to win ## the Texas Lotto. ## @seealso{rand} ## @end deftypefn ## Author: jwe function picks = texas_lotto () if (nargin != 0) warning ("texas_lotto: ignoring extra arguments"); endif picks = zeros (1,6); picks (1) = round (50-49*(1-rand)); n = 2; while (n < 7) tmp = round (50-49*(1-rand)); equal = 0; for i = 1:n if (tmp == picks (i)) equal = 1; break; endif endfor if (! equal) picks (n) = tmp; n++; endif endwhile picks = sort (picks); endfunction /* @GROUP miscellaneous @SYNTAX texas_lotto @DOC Pick 6 unique numbers between 1 and 50 that are guaranteed to win. @EXAMPLES <programlisting> texas_lotto ans = [5 , 16 , 30 , 33 , 34 , 42] </programlisting> @SEE */ |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:38:08
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16989/Source/MathLib/Functions/General Modified Files: rand.java Log Message: added support for rand() 0 arguments return a single random number Index: rand.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/rand.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** rand.java 9 Jan 2007 19:08:06 -0000 1.13 --- rand.java 17 Jan 2007 19:38:01 -0000 1.14 *************** *** 12,22 **** { ! // at least one operand ! if (getNArgIn(operands) < 1) ! throwMathLibException("rand: number of arguments <1 "); // number of arguments int n = getNArgIn(operands); ! // set up dimension array int[] dim = new int[n]; --- 12,27 ---- { ! if ( (getNArgIn(operands) < 0) || ! (getNArgIn(operands) > 1) ) ! throwMathLibException("rand: number of arguments <0 or >1 "); // number of arguments int n = getNArgIn(operands); ! ! // in case of 0 arguments return a single random number ! // e.g. rand() -> 0.xxx ! if (n==0) ! return new NumberToken(Math.random()); ! // set up dimension array int[] dim = new int[n]; *************** *** 64,67 **** --- 69,73 ---- matrix = rand(size) matrix = rand(x,y,....) + number = rand() @DOC Returns a matrix filled with random numbers. |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:30:58
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/miscellaneous In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14050/Source/MathLib/Functions/miscellaneous Added Files: ans.m Log Message: --- NEW FILE: ans.m --- ## -*- texinfo -*- ## @defvr {Automatic Variable} ans ## The the most recently computed result that was not ## explicitly assigned to a variable. For example, after the expression ## ## @example ## 3^2 + 4^2 ## @end example ## ## @noindent ## is evaluated, the value returned by @code{ans} is 25. ## @end defvr ## FIXME -- we should be able to get formatted help for empty scripts, ## not just functions. ##function ans () ##endfunction |
|
From: Stefan M. <st_...@us...> - 2007-01-17 19:30:20
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/miscellaneous In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13594/Source/MathLib/Functions/miscellaneous Added Files: semicolon.m comma.m Log Message: --- NEW FILE: comma.m --- ## Copyright (C) 1996, 1997 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deffn {Operator} , ## Array index, function argument, or command separator. ## @seealso{semicolon} ## @end deffn --- NEW FILE: semicolon.m --- ## Copyright (C) 1996, 1997 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deffn {Operator} ; ## Array row or command separator. ## @seealso{comma} ## @end deffn |
|
From: Stefan M. <st_...@us...> - 2007-01-16 18:45:43
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv1147 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** ChangeLog.txt 14 Jan 2007 12:16:00 -0000 1.148 --- ChangeLog.txt 16 Jan 2007 18:45:39 -0000 1.149 *************** *** 16,20 **** lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, mkdir.java, nan.java, ne.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, perms.m, ! pmt.m, polyval.m, polyreduce.m, poly.m, pv.m, pvl.m, qtransvmat.m, rehash.java, repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, --- 16,22 ---- lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, mkdir.java, nan.java, ne.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, perms.m, ! pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, pv.m, pvl.m, ! qconj.m, qderiv.m, qderivmat.m, qinv.m, qmult.m, qtrans.m, qtransv.m, ! qtransvmat.m, quaternion.m, rehash.java, repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, *************** *** 25,29 **** real.java, row.m, size.java, tic.java, whos.java, zeros.java All trigonometric functions have been updated ! ---- HISTORY ------------------------------------------------------------------ --- 27,31 ---- real.java, row.m, size.java, tic.java, whos.java, zeros.java All trigonometric functions have been updated ! ---- HISTORY ------------------------------------------------------------------ *************** *** 31,34 **** --- 33,48 ---- stefan * + 2007/01/16 + stefan + Functions/System/print_usage.java + stefan + Functions/quaternion/qconj.m + stefan + Functions/quaternion/qderiv.m + stefan + Functions/quaternion/qderivmat.m + stefan + Functions/quaternion/qinv.m + stefan + Functions/quaternion/qmult.m + stefan + Functions/quaternion/qtrans.m + stefan + Functions/quaternion/qtransv.m + stefan + Functions/quaternion/qtransvmat.m + stefan + Functions/quaternion/quaternion.m + 2007/01/14 stefan + Functions/signal/hurst.m |
|
From: Stefan M. <st_...@us...> - 2007-01-16 18:42:20
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/System In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32385/Source/MathLib/Functions/System Added Files: print_usage.java Log Message: --- NEW FILE: print_usage.java --- package MathLib.Functions.System; import MathLib.Tokens.Token; import MathLib.Tokens.OperandToken; import MathLib.Functions.ExternalFunction; public class print_usage extends ExternalFunction { public OperandToken evaluate(Token[] operands) { throwMathLibException("print_usage"); return null; } } /* @GROUP system @SYNTAX print_usage @DOC print out the valid usage of the calling function @NOTES @EXAMPLES @SEE warning, error */ |
|
From: Stefan M. <st_...@us...> - 2007-01-16 18:25:17
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/quaternion In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24978/Source/MathLib/Functions/quaternion Added Files: quaternion.m qderivmat.m qinv.m qtransv.m qderiv.m qmult.m qtrans.m Log Message: --- NEW FILE: qmult.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qmult (@var{a}, @var{b}) ## Multiply two quaternions. ## ## @example ## [w, x, y, z] = w*i + x*j + y*k + z ## @end example ## ## @noindent ## identities: ## ## @example ## i^2 = j^2 = k^2 = -1 ## ij = k jk = i ## ki = j kj = -i ## ji = -k ik = -j ## @end example ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function retval = qmult (a, b) [a1, b1, c1, d1] = quaternion (a); [a2, b2, c2, d2] = quaternion (b); ri = b1*c2 - c1*b2 + d1*a2 + a1*d2; rj = c1*a2 - a1*c2 + d1*b2 + b1*d2; rk = a1*b2 - b1*a2 + d1*c2 + c1*d2; rr = -(a1*a2 + b1*b2 + c1*c2) + d1*d2; retval = quaternion (ri, rj, rk, rr); endfunction --- NEW FILE: qtrans.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qtrans (@var{v}, @var{q}) ## Transform the unit quaternion @var{v} by the unit quaternion @var{q}. ## Returns @code{@var{v} = @var{q}*@var{v}/@var{q}}. ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function v = qtrans (v, q) if (! isvector (v) || length (v) != 4) error ("qtrans: v(%d,%d) must be a quaternion", rows (v), columns (v)); elseif (! isvector (q) || length (q) != 4) error ("qtrans: q(%d,%d) must be a quaternion", rows (q), columns (q)); endif v = qmult (q, qmult (v, qinv (q))); endfunction --- NEW FILE: qderiv.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qderiv (omega) ## Derivative of a quaternion. ## ## Let Q be a quaternion to transform a vector from a fixed frame to ## a rotating frame. If the rotating frame is rotating about the ## [x, y, z] axes at angular rates [wx, wy, wz], then the derivative ## of Q is given by ## ## @example ## Q' = qderivmat (omega) * Q ## @end example ## ## If the passive convention is used (rotate the frame, not the vector), ## then ## ## @example ## Q' = -qderivmat (omega) * Q ## @end example ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function Dmat = qderivmat (Omega) Omega = vec (Omega); if (length (Omega) != 3) error ("qderivmat: Omega must be a length 3 vector"); endif Dmat = 0.5 * [ 0.0, Omega(3), -Omega(2), Omega(1); -Omega(3), 0.0, Omega(1), Omega(2); Omega(2), -Omega(1), 0.0, Omega(3); -Omega(1), -Omega(2), -Omega(3), 0.0 ]; endfunction --- NEW FILE: qtransv.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qtransv (@var{v}, @var{q}) ## Transform the 3-D vector @var{v} by the unit quaternion @var{q}. ## Return a column vector. ## ## @example ## vi = (2*real(q)^2 - 1)*vb + 2*imag(q)*(imag(q)'*vb) ## + 2*real(q)*cross(imag(q),vb) ## @end example ## ## @noindent ## Where imag(q) is a column vector of length 3. ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function vi = qtransv (vb, qib) if (! isvector (vb) || length (vb) != 3) error ("qtransv: v(%d,%d) must be a 3-D vector", rows (vb), columns (vb)); elseif (! isvector (qib) || length (qib) != 4) error ("qtransv: q(%d,%d) must be a quaternion", rows (qib), columns (qib)); elseif (max (abs (imag (vb))) + max (abs (imag (qib))) != 0) error ("qtransv: input values must be real"); endif qr = qib(4); qimag = vec (qib(1:3)); vb = vec (vb); vi = (2*qr^2 - 1)*vb + 2*qimag*(qimag'*vb) + 2*qr*cross (qimag, vb); endfunction --- NEW FILE: qinv.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qinv (@var{q}) ## Return the inverse of a quaternion. ## ## @example ## q = [w, x, y, z] = w*i + x*j + y*k + z ## qmult (q, qinv (q)) = 1 = [0 0 0 1] ## @end example ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function retval = qinv (q) if (norm (q) != 0) retval = qconj (q) / sum (q .* q); else error ("qinv: zero quaternion passed!"); endif endfunction --- NEW FILE: quaternion.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}] =} quaternion (w) ## @deftypefnx {Function File} {[@var{vv}, @var{theta}] =} quaternion (w) ## @deftypefnx {Function File} {@var{w} =} quaternion (@var{a}, @var{b}, @var{c}, @var{d}) ## @deftypefnx {Function File} {@var{w} =} quaternion (@var{vv}, @var{theta}) ## Construct or extract a quaternion ## ## @example ## w = a*i + b*j + c*k + d ## @end example ## ## @noindent ## from given data. ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function [a, b, c, d] = quaternion (w, x, y, z) switch (nargin) case(1) if (! (isvector (w) && length (w) == 4)) error ("input vector must be of length 4)"); endif ## extract data switch (nargout) case(4) a = w(1); b = w(2); c = w(3); d = w(4); case(2) if (abs (norm (w) - 1) > 1e-12) warning ("quaternion: ||w||=%e, setting=1 for vv, theta", norm(w)); w = w/norm(w); endif [a, b, c, d] = quaternion (w); theta = acos (d) * 2; if (abs (theta) > pi) theta = theta - sign (theta) * pi; endif sin_th_2 = norm ([a, b, c]); if (sin_th_2 != 0) vv = [a, b, c] / sin_th_2; else vv = [a, b, c]; endif a = vv; b = theta; otherwise print_usage (); endswitch case(2) if (nargout != 1) print_usage (); endif vv = w; theta = x; if (! isvector (vv) || length (vv) != 3) error ("vv must be a length three vector"); elseif (! isscalar (theta)) error ("theta must be a scalar"); elseif (norm (vv) == 0) error ("quaternion: vv is zero"); elseif (abs (norm (vv) - 1) > 1e-12) warning ("quaternion: ||vv|| != 1, normalizing") vv = vv / norm (vv); endif if (abs (theta) > 2*pi) warning ("quaternion: |theta| > 2 pi, normalizing") theta = rem (theta, 2*pi); endif vv = vv * sin (theta / 2); d = cos (theta / 2); a = quaternion (vv(1), vv(2), vv(3), d); case(4) if (nargout != 1) print_usage (); endif if (! (isscalar (w) && isscalar (x) && isscalar (y) && isscalar (z))) error ("input values must be scalars"); endif a = [w, x, y, z]; otherwise print_usage (); endswitch endfunction --- NEW FILE: qderivmat.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qderivmat (@var{omega}) ## Derivative of a quaternion. ## ## Let Q be a quaternion to transform a vector from a fixed frame to ## a rotating frame. If the rotating frame is rotating about the ## [x, y, z] axes at angular rates [wx, wy, wz], then the derivative ## of Q is given by ## ## @example ## Q' = qderivmat (omega) * Q ## @end example ## ## If the passive convention is used (rotate the frame, not the vector), ## then ## ## @example ## Q' = -qderivmat (omega) * Q. ## @end example ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function Dmat = qderivmat (Omega) Omega = vec (Omega); if (length (Omega) != 3) error ("qderivmat: Omega must be a length 3 vector"); endif Dmat = 0.5 * [ 0.0, Omega(3), -Omega(2), Omega(1); -Omega(3), 0.0, Omega(1), Omega(2); Omega(2), -Omega(1), 0.0, Omega(3); -Omega(1), -Omega(2), -Omega(3), 0.0 ]; endfunction |
|
From: Stefan M. <st_...@us...> - 2007-01-16 18:23:30
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/quaternion In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24149/Source/MathLib/Functions/quaternion Added Files: qconj.m Log Message: --- NEW FILE: qconj.m --- ## Copyright (C) 1998 Auburn University. All rights reserved. ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} qconj (@var{q}) ## Conjugate of a quaternion. ## ## @example ## q = [w, x, y, z] = w*i + x*j + y*k + z ## qconj (q) = -w*i -x*j -y*k + z ## @end example ## @end deftypefn ## Author: A. S. Hodel <a.s...@en...> ## Adapted-By: jwe function retval = qconj (q) [a, b, c, d] = quaternion (q); retval = quaternion (-a, -b, -c, d); endfunction |
|
From: Stefan M. <st_...@us...> - 2007-01-16 18:18:14
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21659/Source/MathLib/Functions/General Modified Files: mod.m Log Message: Index: mod.m =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/mod.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mod.m 9 Jul 2006 18:15:37 -0000 1.1 --- mod.m 16 Jan 2007 18:17:37 -0000 1.2 *************** *** 45,50 **** endif ! if (((ndims (x) != ndims (y)) || any (size (x) != size (y))) && ! ! (isscalar (x) || isscalar (y))) error ("mod: argument sizes must agree"); endif --- 45,49 ---- endif ! if (((ndims (x) != ndims (y)) || any (size (x) != size (y))) && !(isscalar (x) || isscalar (y))) error ("mod: argument sizes must agree"); endif *************** *** 64,71 **** ## Some elements of y are zero. if (isscalar (x)) ! r = x * ones (size (y)); else ! r = x; ! x = x(nz); endif y = y(nz); --- 63,70 ---- ## Some elements of y are zero. if (isscalar (x)) ! r = x * ones (size (y)); else ! r = x; ! x = x(nz); endif y = y(nz); |
|
From: Stefan M. <st_...@us...> - 2007-01-14 19:19:22
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3101/Source/MathLib/Tools/TestSuite/Functions/General Modified Files: AllTests.java testRem.java Added Files: testMod.java Log Message: Index: testRem.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General/testRem.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testRem.java 14 Jan 2007 18:45:12 -0000 1.1 --- testRem.java 14 Jan 2007 19:19:03 -0000 1.2 *************** *** 32,38 **** } ! public void testRem03() { ! ml.executeExpression("a=rem(8,9);"); ! assertTrue(8 == ml.getScalarValueRe("a")); } --- 32,38 ---- } ! public void testRem04() { ! ml.executeExpression("a=rem(-5,3);"); ! assertTrue(-2 == ml.getScalarValueRe("a")); } --- NEW FILE: testMod.java --- package MathLib.Tools.TestSuite.Functions.General; import MathLib.Tools.junit.framework.*; import MathLib.Interpreter.*; public class testMod extends TestCase { protected Interpreter ml; public testMod(String name) { super(name); } public static void main (String[] args) { MathLib.Tools.junit.textui.TestRunner.run (suite()); } protected void setUp() { ml = new Interpreter(true); } public static Test suite() { return new TestSuite(testMod.class); } ////////////////////////////////////////////////////////////////// public void testMod01() { ml.executeExpression("a=mod(4,2);"); assertTrue(0 == ml.getScalarValueRe("a")); } public void testMod02() { ml.executeExpression("a=mod(5,2);"); assertTrue(1 == ml.getScalarValueRe("a")); } public void testMod03() { ml.executeExpression("a=mod(8,9);"); assertTrue(8 == ml.getScalarValueRe("a")); } public void testMod04() { ml.executeExpression("a=mod(-5,3);"); assertTrue(1 == ml.getScalarValueRe("a")); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General/AllTests.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AllTests.java 14 Jan 2007 18:45:12 -0000 1.16 --- AllTests.java 14 Jan 2007 19:19:03 -0000 1.17 *************** *** 44,47 **** --- 44,48 ---- suite.addTest(MathLib.Tools.TestSuite.Functions.General.testLength.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testLinspace.suite()); + suite.addTest(MathLib.Tools.TestSuite.Functions.General.testMod.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testPerformFunction.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testPermutations.suite()); |
|
From: Stefan M. <st_...@us...> - 2007-01-14 18:45:16
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20100/Source/MathLib/Tools/TestSuite/Functions/General Modified Files: AllTests.java Added Files: testRem.java Log Message: --- NEW FILE: testRem.java --- package MathLib.Tools.TestSuite.Functions.General; import MathLib.Tools.junit.framework.*; import MathLib.Interpreter.*; public class testRem extends TestCase { protected Interpreter ml; public testRem(String name) { super(name); } public static void main (String[] args) { MathLib.Tools.junit.textui.TestRunner.run (suite()); } protected void setUp() { ml = new Interpreter(true); } public static Test suite() { return new TestSuite(testRem.class); } ////////////////////////////////////////////////////////////////// public void testRem01() { ml.executeExpression("a=rem(4,2);"); assertTrue(0 == ml.getScalarValueRe("a")); } public void testRem02() { ml.executeExpression("a=rem(5,2);"); assertTrue(1 == ml.getScalarValueRe("a")); } public void testRem03() { ml.executeExpression("a=rem(8,9);"); assertTrue(8 == ml.getScalarValueRe("a")); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General/AllTests.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AllTests.java 5 Jan 2007 13:17:55 -0000 1.15 --- AllTests.java 14 Jan 2007 18:45:12 -0000 1.16 *************** *** 49,52 **** --- 49,53 ---- suite.addTest(MathLib.Tools.TestSuite.Functions.General.testRand.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testReal.suite()); + suite.addTest(MathLib.Tools.TestSuite.Functions.General.testRem.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testSetPFileCaching.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.General.testSign.suite()); |
|
From: Stefan M. <st_...@us...> - 2007-01-14 18:40:44
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/Matrix In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18097/Source/MathLib/Tools/TestSuite/Functions/Matrix Modified Files: AllTests.java Added Files: testIsreal.java Log Message: --- NEW FILE: testIsreal.java --- package MathLib.Tools.TestSuite.Functions.Matrix; import MathLib.Tools.junit.framework.*; import MathLib.Interpreter.*; public class testIsreal extends TestCase { protected Interpreter ml; public testIsreal(String name) { super(name); } public static void main (String[] args) { MathLib.Tools.junit.textui.TestRunner.run (suite()); } protected void setUp() { ml = new Interpreter(true); } public static Test suite() { return new TestSuite(testIsreal.class); } //////////////////////////////////////////////////////////////// public void testIsreal01() { ml.executeExpression("a=isreal(12);"); assertTrue(1 == ml.getScalarValueRe("a")); } public void testIsreal02() { ml.executeExpression("a=isreal([]);"); assertTrue(1 == ml.getScalarValueRe("a")); } public void testIsreal03() { ml.executeExpression("a=isreal(3i);"); assertTrue(0 == ml.getScalarValueRe("a")); } public void testIsreal04() { ml.executeExpression("a=isreal(5+4j);"); assertTrue(0 == ml.getScalarValueRe("a")); } public void testIsreal05() { ml.executeExpression("a=isreal([1,2,3,4]);"); assertTrue(1 == ml.getScalarValueRe("a")); } public void testIsreal06() { ml.executeExpression("a=isreal([1,2j;3,4]);"); assertTrue(0 == ml.getScalarValueRe("a")); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/Matrix/AllTests.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AllTests.java 14 Jan 2007 08:17:24 -0000 1.16 --- AllTests.java 14 Jan 2007 18:40:40 -0000 1.17 *************** *** 36,39 **** --- 36,40 ---- suite.addTest(MathLib.Tools.TestSuite.Functions.Matrix.testGe.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.Matrix.testGt.suite()); + suite.addTest(MathLib.Tools.TestSuite.Functions.Matrix.testIsreal.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.Matrix.testLe.suite()); suite.addTest(MathLib.Tools.TestSuite.Functions.Matrix.testLt.suite()); |