├── MATLAB └── cliffordv07 │ ├── CHANGELOG │ ├── CDE │ ├── ReflectByHyper.m │ ├── NestReflectByHyper.m │ ├── phi.m │ └── AlgoCDE.m │ ├── Core │ ├── Magnitude.m │ ├── PointFromBasis.m │ ├── PointToBasis.m │ ├── Dualize.m │ ├── Set_Epsilon.m │ ├── Pseudoscalar.m │ ├── Coeff.m │ ├── Dual.m │ ├── MultivectorInverse.m │ ├── GARejection.m │ ├── HomogeneousQ.m │ ├── GAProjection.m │ ├── ToBasis.m │ ├── Set_Signature.m │ ├── GAReflection.m │ ├── ToVector.m │ ├── RegressiveProduct.m │ ├── Turn.m │ ├── QuaternionProduct.m │ ├── GARotation.m │ ├── Grade.m │ ├── OuterProduct.m │ ├── InnerProduct.m │ └── GeometricProduct.m │ ├── QuaternionConjugate.m │ ├── QuaternionInverse.m │ ├── QuaternionMagnitude.m │ ├── Extra │ ├── setDimensions.m │ ├── Coefficient.m │ ├── basicGroup.m │ ├── bilinearform.m │ ├── simplifyResult.m │ ├── GAarithmetic.m │ ├── untransform.m │ ├── GAmat2string.m │ ├── transform.m │ └── GAstring2mat.m │ ├── demoCDE.m │ ├── LICENSE │ └── DEMO.m ├── .gitignore ├── functions.xlsx ├── LICENSE ├── Mathematica └── cliffordv07 │ ├── LICENSE │ ├── CHANGELOG │ ├── cliffordv07.m │ ├── palettev07.nb │ └── palettev07_src.nb └── README.md /MATLAB/cliffordv07/CHANGELOG: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | sandbox/ 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /functions.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerac83/clifford_toolbox/HEAD/functions.xlsx -------------------------------------------------------------------------------- /MATLAB/cliffordv07/CDE/ReflectByHyper.m: -------------------------------------------------------------------------------- 1 | function out = ReflectByHyper(h, x) 2 | 3 | invH = GAvectorInverse(h); 4 | out = GAproduct(h, x, invH); 5 | out = -1 * out; 6 | 7 | out = simplifyResult(out); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Magnitude.m: -------------------------------------------------------------------------------- 1 | function out = Magnitude(m) 2 | 3 | %MAGNITUDE(M) calculates the Magnitude of the multivector m. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | out = sqrt(Grade(GeometricProduct(m, Turn(m)), 0)); 11 | out = out(1); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/QuaternionConjugate.m: -------------------------------------------------------------------------------- 1 | function out = QuaternionConjugate(q) 2 | 3 | %QUATERNIONCONJUGATE(Q) gives the inverse of a quaternion q. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | q = transform(q); 11 | qT = Turn(q); 12 | out = untransform(qT); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/PointFromBasis.m: -------------------------------------------------------------------------------- 1 | function out = PointFromBasis(x, n) 2 | 3 | %POINTFROMBASIS(X,N) converts the Clifford Algebra element x (a point) 4 | % of dimension n to the standard Mathematica form {a,b,...}. 5 | % 6 | % Author by: Charles Gunn, 03/2011 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | out = ToVector(Dualize(x, n), n); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/QuaternionInverse.m: -------------------------------------------------------------------------------- 1 | function out = QuaternionInverse(q) 2 | 3 | %QUATERNIONINVERSE(Q) finds the inverse of a quaternion q. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | q = transform(q); 11 | qI = MultivectorInverse(q); 12 | out = untransform(qI); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/QuaternionMagnitude.m: -------------------------------------------------------------------------------- 1 | function out = QuaternionMagnitude(q) 2 | 3 | %QUATERNIONMAGNITUDE(Q) gives the magnitude of a quaternion q. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | q = transform(q); 11 | qM = Magnitude(q); 12 | out = untransform(qM); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/setDimensions.m: -------------------------------------------------------------------------------- 1 | function [A, B, sizA, sizB] = setDimensions(A, B, sizA, sizB) 2 | 3 | % Checks if both vectors have equal or diferent dimension (columns). If 4 | % not, set the correct dimension accordingly 5 | 6 | if sizA(2) ~= sizB(2) 7 | if sizA(2) < sizB(2) 8 | A = [A, zeros(sizA(1), sizB(2) - sizA(2))]; 9 | sizA(2) = sizB(2); 10 | else 11 | B = [B, zeros(sizB(1), sizA(2) - sizB(2))]; 12 | sizB(2) = sizA(2); 13 | end 14 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/Coefficient.m: -------------------------------------------------------------------------------- 1 | function out = Coefficient(a,b) 2 | 3 | idx = a(:,find(b)) > 0; %#ok<*FNDSB> 4 | out = a(find(sum(idx,2)),:); 5 | 6 | % Find which are either scalar or vectors 7 | test = sum(out>0,2); 8 | 9 | for i = 1:length(test) 10 | if test(i) == sum(b) 11 | % Divided as one wants to query the coefficient of the k-blade 12 | out(i,1) = sum(out(i,:))/sum(b); 13 | out(i,find(b)) = 0; 14 | else 15 | out(i,find(b)) = 0; 16 | end 17 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/basicGroup.m: -------------------------------------------------------------------------------- 1 | function out = basicGroup(in) 2 | 3 | % BASICGROUP(TUPLE) assigns group number to the corresponding basis. It 4 | % does not actually corresponds to the same k-blade, it is random for 5 | % speed 6 | % 7 | % Version: 1.0 (Nov, 2010) 8 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | idx = prod(find(in)); %Memory problems when Pseudoscalar(20) 12 | % idx = sum(find(in)); 13 | out = sum(abs(in)) * idx; -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/PointToBasis.m: -------------------------------------------------------------------------------- 1 | function out = PointToBasis(vec) 2 | 3 | %POINTTOBASIS(VEC) converts a homogenous point into the geometric algebra; 4 | % similar to ToBasis. 5 | % 6 | % Author by: Charles Gunn, 03/2011 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | if ~isvector(vec) 12 | error('Input must be a vector.') 13 | end 14 | 15 | points = ToBasis(vec); 16 | out = Dualize(points, length(vec)); 17 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Dualize.m: -------------------------------------------------------------------------------- 1 | function out = Dualize(m, n) 2 | 3 | %DUALIZE(M,N) calculates the Dual of the multivector m in a 4 | % n-dimensional space. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | if ~isnumeric(n) || n < 0 12 | error('Second argument must be numeric and positive'); 13 | end 14 | 15 | Set_Signature(n, 0, 0); 16 | out = Dual(m, n); 17 | Set_Signature; 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Set_Epsilon.m: -------------------------------------------------------------------------------- 1 | function Set_Epsilon(in) 2 | 3 | %SET_SIGNATURE(P,Q,S) sets the machine working precision to be used for 4 | % numerical computations. The default value is "eps". Once changed, it can 5 | % be recovered by invoking again "Set_Epsilon" 6 | % 7 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 8 | % Version: 0.7 (Oct, 2011) 9 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 10 | % Aragon J. L. & Rodriguez-Andrade, M. A. 11 | 12 | if nargin < 1 % Set defaults 13 | in = eps; 14 | end 15 | 16 | global epsilon 17 | epsilon = in; -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Pseudoscalar.m: -------------------------------------------------------------------------------- 1 | function out = Pseudoscalar(n,opt) 2 | 3 | %PSEUDOSCALAR(N) gives the n-dimensional pseudoscalar. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if nargin < 2 11 | opt = 0; 12 | end 13 | 14 | if ~isnumeric(n) 15 | error('first input should be numeric!'); 16 | end 17 | 18 | out = zeros(1,n+1); 19 | out(:,2:end) = 1; 20 | 21 | if opt 22 | out = GAmat2string(out); 23 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Coeff.m: -------------------------------------------------------------------------------- 1 | function out = Coeff(m, b) 2 | 3 | %COEFF(M,B) gives the coefficient of the r-blade b in the multivector m. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ischar(m) 11 | m = GAstring2mat(m); 12 | end 13 | if ischar(b) 14 | b = GAstring2mat(b); 15 | else 16 | error('b has to be a string, e.g. e[1]'); 17 | end 18 | 19 | m = simplifyResult(m); 20 | cc = Coefficient(m,b); 21 | out = Grade(cc,0); 22 | 23 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/bilinearform.m: -------------------------------------------------------------------------------- 1 | function out = bilinearform(idx) 2 | 3 | global signature 4 | 5 | if isempty(signature) 6 | Set_Signature; % Set default 7 | end 8 | 9 | if ~isnumeric(idx) 10 | error('Argument must be a integer...'); 11 | end 12 | 13 | out = NaN; 14 | if idx <= signature(1) 15 | out = 1; 16 | end 17 | if idx > signature(1) && (idx <= signature(1) + signature(2)) 18 | out = -1; 19 | end 20 | if idx > signature(1) + signature(2) + signature(3) 21 | out = 0; 22 | end 23 | 24 | if isnan(out) 25 | error('Error in BILINEARFORM: It was not possible to set the signature'); 26 | end 27 | 28 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Dual.m: -------------------------------------------------------------------------------- 1 | function out = Dual(m, n) 2 | 3 | %DUAL(M,N) calculates the Dual of the multivector m in a 4 | % n-dimensional space. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | flag = 0; 12 | if ischar(m) 13 | m = GAstring2mat(m); 14 | flag = 1; 15 | end 16 | 17 | if ~isnumeric(n) 18 | error('first input should be numeric!'); 19 | end 20 | 21 | t = Turn(Pseudoscalar(n)); 22 | out = GeometricProduct(m,t); 23 | 24 | if flag 25 | out = GAmat2string(out); 26 | end 27 | 28 | 29 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/MultivectorInverse.m: -------------------------------------------------------------------------------- 1 | function out = MultivectorInverse(in) 2 | 3 | %MULTIVECTORINVERSE(A) gives the inverse of a multivector defined in 'in' 4 | % See GeometricProduct for input and output formats. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | if ischar(in) 12 | in = GAstring2mat(in); 13 | end 14 | inT = Turn(in); 15 | temp = GeometricProduct(in, inT); 16 | if size(temp,2) > 1 17 | if sum(temp(2:end),2) > 0 18 | error('Inverse does not exist!'); 19 | end 20 | end 21 | out = inT ./ temp(1); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/GARejection.m: -------------------------------------------------------------------------------- 1 | function out = GARejection(v, w) 2 | 3 | %GAREJECTION(V,W) calculate the rejection of the vector v on the subspace 4 | % defined by the r-blade w. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | flag = 0; 12 | if ischar(v) 13 | v = GAstring2mat(v); 14 | flag = 1; 15 | end 16 | if ischar(w) 17 | w = GAstring2mat(w); 18 | flag = 1; 19 | end 20 | 21 | out = GeometricProduct(OuterProduct(v,w), MultivectorInverse(w)); 22 | 23 | if flag 24 | out = GAmat2string(out); 25 | end 26 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/HomogeneousQ.m: -------------------------------------------------------------------------------- 1 | function out = HomogeneousQ(x, r) 2 | 3 | %HOMOGENEOUSQ(X,R) gives True if x is a r-blade and False otherwise. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ~isnumeric(r) 11 | error('r must be numeric'); 12 | end 13 | if ischar(x) 14 | x = GAstring2mat(x); 15 | end 16 | 17 | len_x = numel(x); 18 | x = simplifyResult(x); 19 | 20 | grd = Grade(x,r); 21 | 22 | test = 0; 23 | if numel(grd) == len_x 24 | test = x == grd; 25 | end 26 | 27 | out = false; 28 | if sum(test(:)) == len_x 29 | out = true; 30 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/GAProjection.m: -------------------------------------------------------------------------------- 1 | function out = GAProjection(v, w) 2 | 3 | %GAPROJECTION(V,W) calculate the projection of the vector v on the subspace 4 | % defined by the r-blade w. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | flag = 0; 12 | if ischar(v) 13 | v = GAstring2mat(v); 14 | flag = 1; 15 | end 16 | if ischar(w) 17 | w = GAstring2mat(w); 18 | flag = 1; 19 | end 20 | 21 | out = GeometricProduct(InnerProduct(v,w), MultivectorInverse(w)); 22 | 23 | if flag 24 | out = GAmat2string(out); 25 | end 26 | 27 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/ToBasis.m: -------------------------------------------------------------------------------- 1 | function out = ToBasis(x) 2 | 3 | %TOBASIS(X) Transform the vector x from {a,b,...} to the standard form 4 | % used in this Package: a*e[1]+b*e[2]+...." 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | % input checking 12 | if ~isvector(x) 13 | error('Input must be a vector.') 14 | end 15 | if ~isnumeric(x) 16 | error('Vector must be numeric!'); 17 | end 18 | 19 | % Change to row vector 20 | if size(x,1) > 1 21 | x = x'; 22 | end 23 | 24 | out = zeros(size(x,2), size(x,2) + 1); 25 | for i = 1:size(x,2) 26 | tuple = zeros(1,size(x,2)); 27 | tuple(i) = 1; 28 | out(i,:) = [0, tuple .* x(i)]; 29 | end 30 | 31 | out = simplifyResult(out); -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Set_Signature.m: -------------------------------------------------------------------------------- 1 | function Set_Signature(p, q, s) 2 | 3 | %SET_SIGNATURE(P,Q,S) sets the indices (p,q,s) of the bilinear form 4 | % used to define the Clifford Algebra (s is the index of degeneracy). Thus 5 | % it is assumed that for i>p+q+s we have GeometricProduct(ei,ei)=0. 6 | % The default value is [20,0,0]. Once changed, it can be recovered by 7 | % invoking again "Set_Signature;". 8 | % 9 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 10 | % Version: 0.7 (Oct, 2011) 11 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 12 | % Aragon J. L. & Rodriguez-Andrade, M. A. 13 | 14 | if nargin < 1 % Set defaults 15 | p = 20; 16 | q = 0; 17 | s = 0; 18 | end 19 | if nargin < 2 20 | q = 0; 21 | s = 0; 22 | end 23 | if nargin < 3 24 | s = 0; 25 | end 26 | 27 | global signature 28 | signature = [p, q, s]; -------------------------------------------------------------------------------- /MATLAB/cliffordv07/CDE/NestReflectByHyper.m: -------------------------------------------------------------------------------- 1 | function out = NestReflectByHyper(v, a, h) 2 | 3 | if h - 1 > 1 4 | if ~isempty(Coefficient(v{h-1})) 5 | % ReflectByHyper[v[[h - 1]], NestReflectByHyper[v, a, h - 1]] 6 | out = ReflectByHyper(v{h - 1}, NestReflectByHyper(v, a, h - 1)); 7 | return; 8 | else 9 | % ReflectByHyper[v[[h - 2]], NestReflectByHyper[v, a, h - 2]] 10 | out = ReflectByHyper(v{h - 2}, NestReflectByHyper(v, a, h - 2)); 11 | return; 12 | end 13 | end 14 | 15 | if h - 1 == 0 16 | out = a; 17 | return; 18 | else 19 | if sum(Coefficient(v{1})) == 0 && length(Coefficient(v{1})) < 1 20 | out = a; 21 | return; 22 | else 23 | %ReflectByHyper[v[[h - 1]], a] 24 | out = ReflectByHyper(v{h - 1}, a); 25 | return; 26 | end 27 | end 28 | 29 | % Auxliar function (Mathematica wrappers) 30 | function out = Coefficient(in) 31 | 32 | out = in(abs(in)>0); 33 | 34 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/GAReflection.m: -------------------------------------------------------------------------------- 1 | function out = GAReflection(v, w, x) 2 | 3 | %GAREFLECTION(V,W,X) reflects the vector v by the plane formed by the 4 | % vectors w and x. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | if ~HomogeneousQ(v, 1) || ~HomogeneousQ(w, 1) || ~HomogeneousQ(x, 1) 12 | error('GARotation function works only with vectors.'); 13 | end 14 | 15 | flag = 0; 16 | if ischar(v) 17 | v = GAstring2mat(v); 18 | flag = 1; 19 | end 20 | if ischar(w) 21 | w = GAstring2mat(w); 22 | flag = 1; 23 | end 24 | if ischar(x) 25 | x = GAstring2mat(x); 26 | flag = 1; 27 | end 28 | 29 | plane = OuterProduct(w,x); 30 | u = Dual(plane/Magnitude(plane),3); 31 | out = GeometricProduct(-u,v,u); 32 | 33 | if flag 34 | out = GAmat2string(out); 35 | end 36 | 37 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/ToVector.m: -------------------------------------------------------------------------------- 1 | function out = ToVector(x,n) 2 | 3 | %TOVECTOR(X,N) transform the n-dimensional vector x from a*e[1]+b*e[2]+... to 4 | % the standard Mathematica form {a,b,...}. The defaul value of n is the 5 | % highest of all e[i]'s. 6 | % 7 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 8 | % Version: 0.7 (Oct, 2011) 9 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 10 | % Aragon J. L. & Rodriguez-Andrade, M. A. 11 | 12 | if ~HomogeneousQ(x, 1) 13 | error('ToVector function works only with vectors.'); 14 | end 15 | 16 | if ischar(x) 17 | x = GAstring2mat(x); 18 | end 19 | 20 | aux = dimensions(x); 21 | test = max(aux)-1; 22 | if nargin < 2 23 | dim = test; 24 | else 25 | dim = n; 26 | end 27 | 28 | out = zeros(dim,1); 29 | for i = 1:dim 30 | if i <= test 31 | temp = Coefficient(x, GAstring2mat(['e' num2str(i)])); 32 | out(i,1) = temp(1,1); 33 | end 34 | end 35 | 36 | function out = dimensions(a) 37 | 38 | out = zeros(size(a,1),1); 39 | for i = 1:size(a,1) 40 | out(i) = find(a(i,:)); 41 | end 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/demoCDE.m: -------------------------------------------------------------------------------- 1 | % Test matrices 2 | A1 = [6/7, 2/7, 3/7; 3 | 2/7, 3/7, -6/7; 4 | -3/7, 6/7, 2/7]; 5 | 6 | A2 = [2/sqrt(5), 1/sqrt(30), 1/sqrt(6); 7 | -1/sqrt(5), 2/sqrt(30), 2/sqrt(6); 8 | 0, -5/sqrt(30), 1/sqrt(6)]; 9 | 10 | A3 = 1/2*[1, -1, -1, -1; 11 | 1, -1, 1, 1; 12 | 1, 1, -1, 1; 13 | 1, 1, 1, -1]; 14 | 15 | A4 = [1, 0, 0; 16 | 0, 2, 1; 17 | 0, 1, 1]; 18 | 19 | A5 = [1, 0, 0; 20 | 0, sqrt(3)/2, 1/2; 21 | 0, -1/2, sqrt(3)/2]; 22 | 23 | A6 = [-1, 0, 0, 0; 24 | 0, -1, 0, 0; 25 | 0, 0, -1, 0; 26 | 0, 0, 0, -1]; 27 | 28 | A7 = [0, -1, 0, 0, 0; 29 | 1, 0, 0, 0, 0; 30 | 0, 0, -1, 0, 0; 31 | 0, 0, 0, -1, 0; 32 | 0, 0, 0, 0, 1]; 33 | 34 | disp('A1'); 35 | AlgoCDE(A1); 36 | disp(' '); 37 | disp('A2'); 38 | AlgoCDE(A2); 39 | disp(' '); 40 | disp('A3'); 41 | AlgoCDE(A3); 42 | disp(' '); 43 | disp('A4'); 44 | AlgoCDE(A4); 45 | disp(' '); 46 | disp('A5'); 47 | AlgoCDE(A5); 48 | disp(' '); 49 | disp('A6'); 50 | AlgoCDE(A6); 51 | disp(' '); 52 | disp('A7'); 53 | AlgoCDE(A7); 54 | disp(' '); 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/simplifyResult.m: -------------------------------------------------------------------------------- 1 | function out = simplifyResult(in) 2 | 3 | % SIMPLIFYRESULT simplifies the input (vectorised code) 4 | % 5 | % Version: 1.0 (Nov, 2010) 6 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 7 | % Aragon J. L. & Rodriguez-Andrade, M. A. 8 | 9 | % Machine precision 10 | global epsilon 11 | 12 | if isempty(epsilon) 13 | Set_Epsilon; 14 | end 15 | 16 | threshold = epsilon; 17 | 18 | sumIn = sum(sum(abs(in),2),1); 19 | if sumIn > 0 20 | group = zeros(size(in,1),1); 21 | for i = 1:size(in,1) 22 | tuple = abs(in(i,:)) > 0; 23 | group(i) = basicGroup(tuple); 24 | end 25 | 26 | idx = group > 0; 27 | group = group(idx); 28 | in = in(idx,:); 29 | 30 | temp = accumarray(group, (1:length(group))', [max(group) 1], @(idx) {sum(in(idx,1:end),1)}); 31 | out = cat(1,temp{:}); 32 | idx = logical(sum(abs(out) < threshold & out ~= 0,2)); 33 | out(idx,:) = []; % Remove vectors that are below machine precision 34 | else 35 | out = in; 36 | end 37 | 38 | % Remove empty vectors 39 | idx = sum(abs(out),2) == 0; 40 | out(idx,:) = []; 41 | 42 | if isempty(out) || sum(abs(out(:))) == 0 43 | out = 0; 44 | end 45 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/GAarithmetic.m: -------------------------------------------------------------------------------- 1 | function C = GAarithmetic(mode, varargin) 2 | 3 | if ~ischar(mode) 4 | error('Use either: "plus" or "minus" as strings in the first argument'); 5 | end 6 | 7 | if strcmp(mode, 'plus') 8 | op = 1; 9 | elseif strcmp(mode, 'minus') 10 | op = -1; 11 | else 12 | error('Use either: plus or minus'); 13 | end 14 | 15 | numVar = size(varargin,2); 16 | if numVar < 2 17 | error('At least two inputs are required'); 18 | end 19 | 20 | for iter = 1:numVar-1 % Iterate until no input arguments remain 21 | if iter == 1 % First iteration, assigns the first entry of the arguments 22 | A = varargin{iter}; 23 | else % otherwise, set as the last output 24 | A = C; 25 | end 26 | B = varargin{iter+1}; 27 | 28 | if ischar(A) 29 | A = GAstring2mat(A); 30 | end 31 | if ischar(B) 32 | B = GAstring2mat(B); 33 | end 34 | 35 | % Check that both has the same number of columns (dimensions) 36 | [A, B] = setDimensions(A, B, size(A), size(B)); 37 | 38 | % Subtract 39 | C = [A; op * B]; 40 | C = simplifyResult(C); 41 | 42 | end 43 | 44 | % Uncomment to output string 45 | %C = GAmat2string(C); 46 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/RegressiveProduct.m: -------------------------------------------------------------------------------- 1 | function out = RegressiveProduct(v, w, x) 2 | 3 | %REGRESSIVEPRODUCT(V,W) calculate the rejection of the vector v on the 4 | % subspace defined by the r-blade w. 5 | % 6 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 7 | % Version: 0.7 (Oct, 2011) 8 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 9 | % Aragon J. L. & Rodriguez-Andrade, M. A. 10 | 11 | global signature 12 | 13 | if isempty(signature) 14 | Set_Signature; % Set default 15 | end 16 | 17 | flag = 0; 18 | if ischar(v) 19 | v = GAstring2mat(v); 20 | flag = 1; 21 | end 22 | if ischar(w) 23 | w = GAstring2mat(w); 24 | flag = 1; 25 | end 26 | 27 | if nargin > 2 28 | if isnumeric(x) 29 | if x > 0 30 | Set_Signature(x, 0, 0); 31 | vx = Dualize(v,x); 32 | wx = Dualize(w,x); 33 | outProd = OuterProduct(vx,wx); 34 | out = Dualize(outProd, x); 35 | end 36 | else 37 | error('Third argument must be numeric and possitive'); 38 | end 39 | else 40 | out = RegressiveProduct(v, w, sum(signature(:))); 41 | end 42 | 43 | if flag 44 | out = GAmat2string(out); 45 | end 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Turn.m: -------------------------------------------------------------------------------- 1 | function out = Turn(m) 2 | 3 | %TURN(M) gives the Reverse of the multivector m. 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ischar(m) 11 | m = GAstring2mat(m); 12 | end 13 | 14 | m = simplifyResult(m); 15 | temp = m; 16 | 17 | if size(m,1) > 1 18 | % For each entry apply Turn; this denotes that it is a multivector 19 | for i = 1:size(m,1) 20 | temp(i,:) = Turn(m(i,:)); 21 | end 22 | else 23 | % If a k-blade split entries, reverse order and apply the geometric 24 | % product. Otherwise, don't do nothing. 25 | test = sum(abs(m)>0); 26 | if test > 1 27 | mat = zeros(test,size(m,2)); 28 | idx = find(m); 29 | coeff = m(idx(1)); 30 | for j = 1:length(idx) 31 | mat(j,idx(j)) = m(:,idx(j)); 32 | end 33 | mat = flipud(mat); % Reverse 34 | % Geometric Product 35 | mat = mat / coeff; 36 | temp = mat(1,:); 37 | for j = 2:length(idx) 38 | temp = GeometricProduct(temp,mat(j,:)); 39 | end 40 | temp = coeff * temp; 41 | end 42 | end 43 | out = temp; 44 | 45 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/QuaternionProduct.m: -------------------------------------------------------------------------------- 1 | function out = QuaternionProduct(varargin) 2 | 3 | %QUATERNIONPRODUCT(Q1,Q2,...) gives the product of quaternions q1,q2,... 4 | % 5 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 6 | % Version: 0.7 (Oct, 2011) 7 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | numVar = size(varargin,2); 11 | if numVar < 2 12 | error('At least two inputs are required'); 13 | end 14 | 15 | for iter = 1:numVar-1 % Iterate until no input arguments remain 16 | if iter == 1 % First iteration, assigns the first entry of the arguments 17 | A = transform(varargin{iter}); 18 | else % otherwise, set as the last output 19 | A = out; 20 | end 21 | B = transform(varargin{iter+1}); 22 | 23 | if ischar(A) 24 | A = GAstring2mat(A); 25 | end 26 | if ischar(B) 27 | B = GAstring2mat(B); 28 | end 29 | 30 | out = GeometricProduct(A, B); 31 | out = simplifyResult(out); 32 | 33 | end 34 | 35 | out = simplifyResult(out); 36 | out = untransform(out); 37 | 38 | % QuaternionProduct[ _] := $Failed 39 | % QuaternionProduct[q1_,q2_,q3__] := QuaternionProduct[QuaternionProduct[q1,q2],q3] 40 | % QuaternionProduct[q1_,q2_] := untransform[ 41 | % GeometricProduct[transform[q1],transform[q2]] ] 42 | 43 | 44 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/CDE/phi.m: -------------------------------------------------------------------------------- 1 | function out = phi(s,B) 2 | 3 | if size(B,1) < 2 4 | error('TBD!'); 5 | end 6 | 7 | if s == 0 8 | out = eye(size(B,1)); 9 | return; 10 | end 11 | 12 | one = -1 / getScalar(GAproduct(s,s)); 13 | 14 | res = zeros(size(B,1),size(B,1)); 15 | for l = 1:size(B,1) 16 | for j = 1:size(B,1) 17 | if l == j 18 | two = getScalar(GAinner(s,B(j,:))) ^ 2 / getScalar(GAproduct(B(j,:), B(j,:))); 19 | three = 0; 20 | for i = 1:size(B,1) 21 | if i == j 22 | temp = 0; 23 | else 24 | num = getScalar(GAinner(s,B(i,:))) ^ 2; 25 | den = getScalar(GAproduct(B(i,:), B(i,:))); 26 | temp = num / den; 27 | end 28 | three = three + temp; 29 | end 30 | res(l,j) = two - three; 31 | else 32 | two = getScalar(GAinner(s,B(j,:))); 33 | three = getScalar(GAinner(s,B(l,:))) / getScalar(GAproduct(B(l,:), B(l,:))); 34 | res(l,j) = 2 * two * three; 35 | end 36 | end 37 | end 38 | 39 | out = one .* res; 40 | 41 | % Auxiliar function 42 | function out = getScalar(in) 43 | 44 | temp = sum(abs(in),2); 45 | idx = temp(:,1) == 0; 46 | if numel(in) ~= 1 47 | if sum(~idx) > 1 48 | error('Not a scalar!'); 49 | else 50 | if sum(in(~idx,2:end)) > 0 51 | error('Not a scalar!'); 52 | end 53 | end 54 | else 55 | idx = 0; 56 | end 57 | in = in(~idx,:); 58 | out = in(1); 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & 2 | Rodriguez-Andrade, M. A. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of clifford_toolbox nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/GARotation.m: -------------------------------------------------------------------------------- 1 | function out = GARotation(v, w, x, theta) 2 | 3 | %GAROTATION(V,W,X,THETA) Rotates the vector v by an angle theta 4 | % (in degrees), along the plane defined by w and x. The sense of the 5 | % rotation is from w to x. Default value of theta is the angle between 6 | % w and x. 7 | % 8 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 9 | % Version: 0.7 (Oct, 2011) 10 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 11 | % Aragon J. L. & Rodriguez-Andrade, M. A. 12 | 13 | if ~HomogeneousQ(v, 1) || ~HomogeneousQ(w, 1) || ~HomogeneousQ(x, 1) 14 | error('GARotation function works only with vectors.'); 15 | end 16 | 17 | flag = 0; 18 | if ischar(v) 19 | v = GAstring2mat(v); 20 | flag = 1; 21 | end 22 | if ischar(w) 23 | w = GAstring2mat(w); 24 | flag = 1; 25 | end 26 | if ischar(x) 27 | x = GAstring2mat(x); 28 | flag = 1; 29 | end 30 | 31 | plano=OuterProduct(w,x); 32 | 33 | if nargin > 3 34 | if ~isnumeric(theta) 35 | error('THETA must be numeric and in degrees!'); 36 | end 37 | theta = deg2rad(theta); 38 | r = sin(theta/2) * (plano / Magnitude(plano)); 39 | r = GAarithmetic('plus', cos(theta/2), r); 40 | else 41 | [w, x] = setDimensions(w, x, size(w), size(x)); 42 | theta = InnerProduct(w,x)/(Magnitude(w)*Magnitude(x)); 43 | theta = theta(1); 44 | r = sqrt((1-theta)/2) * (plano / Magnitude(plano)); 45 | r = GAarithmetic('plus', sqrt((1+theta)/2), r); 46 | end 47 | 48 | out = GeometricProduct(Turn(r),v,r); 49 | if flag 50 | out = GAmat2string(out); 51 | end 52 | 53 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & 2 | Rodriguez-Andrade, M. A. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of clifford_toolbox nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | -------------------------------------------------------------------------------- /Mathematica/cliffordv07/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & 2 | Rodriguez-Andrade, M. A. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of clifford_toolbox nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/Grade.m: -------------------------------------------------------------------------------- 1 | function out = Grade(A, k) 2 | 3 | %GRADE(A) gives the grade value of all components in the multivector 4 | %GRADE(A,R) gives the r-vector part of the multivector m. 5 | % 6 | % INPUTS 7 | % A should be either a matrix or a string as defined in GAproduct. 'k' 8 | % denotes the r-vector part needed. If 'k' is not defined, a list of the 9 | % grade for each component is returned. 10 | % 11 | % OUTPUTS 12 | % If A is a matrix, the output in 'out' is a matrix. 13 | % If A is a string and 'k' is not defined, the output is a list with the 14 | % grades of each component in the vector. Otherwise, it returns a string 15 | % with the r-vector component. 16 | % 17 | % EXAMPLE 18 | % 19 | % A = '5e5+e6e9+e3e4e5e6+e1e2e3+e3'; 20 | % Grade(A, 2) 21 | % 22 | % ans = e6e9 23 | % 24 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 25 | % Version: 0.7 (Oct, 2011) 26 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 27 | % Aragon J. L. & Rodriguez-Andrade, M. A. 28 | 29 | flag = 0; 30 | if ischar(A) 31 | A = GAstring2mat(A); 32 | flag = 1; 33 | end 34 | 35 | sumScalar = sum(abs(A(:,1) > 0),2); 36 | sumIn = sum(abs(A(:,2:end)) > 0,2); 37 | 38 | if nargin < 2 39 | out = sumIn; 40 | else 41 | if k == 0 42 | idx = sumScalar == 1; 43 | out = A(idx,:); 44 | if size(out,2) > 1 45 | out(:,2:end) = 0; 46 | end 47 | else 48 | idx = sumIn == k; 49 | out = A(idx,:); 50 | if isempty(out) 51 | out = zeros(size(A)); 52 | end 53 | end 54 | end 55 | 56 | if flag && nargin > 1 57 | out = GAmat2string(out); 58 | end 59 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/OuterProduct.m: -------------------------------------------------------------------------------- 1 | function [out, out1] = OuterProduct(varargin) 2 | 3 | %OUTERPRODUCT(A1,A2,...) calculates the outer product of multivectors 4 | % m1,m2,..., mn 5 | % 6 | % See GeometricProduct for help in this function as it is similar. 7 | % 8 | % NOTE: This function employs the generalised equation in terms of the 9 | % geometric product. 10 | % 11 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 12 | % Version: 0.7 (Oct, 2011) 13 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 14 | % Aragon J. L. & Rodriguez-Andrade, M. A. 15 | 16 | numVar = size(varargin,2); 17 | if numVar < 2 18 | error('At least two inputs are required'); 19 | end 20 | 21 | for iter = 1:numVar-1 % Iterate until no input arguments remain 22 | if iter == 1 % First iteration, assigns the first entry of the arguments 23 | A = varargin{iter}; 24 | else % otherwise, set as the last output 25 | A = out; 26 | end 27 | B = varargin{iter+1}; 28 | 29 | if ischar(A) 30 | A = GAstring2mat(A); 31 | end 32 | if ischar(B) 33 | B = GAstring2mat(B); 34 | end 35 | 36 | [A, B, sizA, sizB] = setDimensions(A, B, size(A), size(B)); 37 | 38 | % Set output matrix 39 | out = zeros(sizA(1)*sizB(1),sizA(2)); 40 | k = 1; 41 | kA = Grade(A); 42 | kB = Grade(B); 43 | for i = 1:sizA(1) 44 | for j = 1:sizB(1) 45 | p = max(kA(i,:)); 46 | q = max(kB(j,:)); 47 | 48 | out(k,:) = Grade(GeometricProduct(A(i,:),B(j,:)),p+q); 49 | k = k + 1; 50 | end 51 | end 52 | 53 | out = simplifyResult(out); 54 | 55 | end 56 | 57 | out = simplifyResult(out); 58 | 59 | if nargout > 1 60 | out1 = GAmat2string(out); 61 | else 62 | %disp(GAmat2string(out)) 63 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/DEMO.m: -------------------------------------------------------------------------------- 1 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 2 | % Aragon J. L. & Rodriguez-Andrade, M. A. 3 | 4 | clear; 5 | clc; 6 | 7 | disp('Demonstrating Geometric Algebra (A port of Clifford Algebra for Mathematica)'); 8 | disp(' ') 9 | disp('Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.;') 10 | disp('Aragon J. L. & Rodriguez-Andrade, M. A.') 11 | disp(' ') 12 | disp('Press a key to continue...'); 13 | pause; 14 | 15 | disp(' ') 16 | disp(' ') 17 | disp('A simple example :)') 18 | disp('Declaring two simple variables;') 19 | A = 'e1'; 20 | B = 'e2'; 21 | 22 | disp(' ') 23 | disp(['A = ' A]); 24 | disp(['B = ' B]); 25 | 26 | disp(' ') 27 | disp('Press a key to continue...'); 28 | pause; 29 | 30 | disp(' ') 31 | disp(' ') 32 | disp('Inner, outer and geometric products;'); 33 | inner = InnerProduct(A,B); 34 | disp(['Inner product = ' GAmat2string(inner)]); 35 | 36 | outer = OuterProduct(A,B); 37 | disp(['Outer product = ' GAmat2string(outer)]); 38 | 39 | geo = GeometricProduct(A,B); 40 | disp(['Geometric product = ' GAmat2string(geo)]); 41 | 42 | A1 = MultivectorInverse(A); 43 | disp(' ') 44 | disp('Multivector inverse;'); 45 | disp(['Inverse of A = ' GAmat2string(A1)]); 46 | B1 = MultivectorInverse(B); 47 | disp(['Inverse of B = ' GAmat2string(B1)]); 48 | 49 | disp(' ') 50 | disp('Press a key to continue...'); 51 | pause; 52 | 53 | clc; 54 | disp('A neat example...') 55 | disp('Reflection of a vector in a plane.') 56 | 57 | a = 'e1 + e2'; 58 | P = 'e1e3'; 59 | I3 = 'e1e2e3'; 60 | 61 | disp(['vector = ' a]); 62 | disp(['Plane = ' P]); 63 | disp(' ') 64 | disp('Press a key to continue...'); 65 | pause; 66 | 67 | disp(' ') 68 | r = GeometricProduct(P,I3); 69 | disp(['Normal vector = ' GAmat2string(r)]); 70 | 71 | reflection = GeometricProduct(r,a,-r); 72 | disp(['Reflection = ' GAmat2string(reflection)]); 73 | 74 | disp(' ') 75 | disp('That`s all...'); 76 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/InnerProduct.m: -------------------------------------------------------------------------------- 1 | function [out, out1] = InnerProduct(varargin) 2 | 3 | %INNERPRODUCT(A1,A2,...) calculates the inner product of multivectors 4 | % m1,m2,..., mn 5 | % 6 | % See GeometriProduct for help in this function as it is similar. 7 | % 8 | % NOTE: This function employs the generalised equation in terms of the 9 | % geometric product. 10 | % 11 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 12 | % Version: 0.7 (Oct, 2011) 13 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G., 14 | % Aragon J. L. & Rodriguez-Andrade, M. A. 15 | 16 | numVar = size(varargin,2); 17 | if numVar < 2 18 | error('At least two inputs are required'); 19 | end 20 | 21 | for iter = 1:numVar-1 % Iterate until no input arguments remain 22 | if iter == 1 % First iteration, assigns the first entry of the arguments 23 | A = varargin{iter}; 24 | else % otherwise, set as the last output 25 | A = out; 26 | end 27 | B = varargin{iter+1}; 28 | 29 | if ischar(A) 30 | A = GAstring2mat(A); 31 | end 32 | if ischar(B) 33 | B = GAstring2mat(B); 34 | end 35 | 36 | [A, B, sizA, sizB] = setDimensions(A, B, size(A), size(B)); 37 | 38 | % Set output matrix 39 | out = zeros(sizA(1)*sizB(1),sizA(2)); 40 | k = 1; 41 | kA = Grade(A); 42 | kB = Grade(B); 43 | for i = 1:sizA(1) 44 | for j = 1:sizB(1) 45 | p = max(kA(i,:)); 46 | q = max(kB(j,:)); 47 | 48 | res = Grade(GeometricProduct(A(i,:),B(j,:)),abs(p-q)); 49 | if ~isempty(res) 50 | out(k,:) = res; 51 | end 52 | k = k + 1; 53 | end 54 | end 55 | 56 | out = simplifyResult(out); 57 | end 58 | 59 | out = simplifyResult(out); 60 | 61 | if nargout > 1 62 | out1 = GAmat2string(out); 63 | % else 64 | % disp(GAmat2string(out)) 65 | end -------------------------------------------------------------------------------- /MATLAB/cliffordv07/CDE/AlgoCDE.m: -------------------------------------------------------------------------------- 1 | function [c, B] = AlgoCDE(A, treshold, verbose) 2 | 3 | if nargin < 2 || isempty(treshold) 4 | treshold = eps; 5 | end 6 | if nargin < 3 7 | verbose = 1; 8 | end 9 | 10 | if verbose 11 | disp('**************************************************'); 12 | disp('A:'); 13 | disp(num2str(A)); 14 | end 15 | 16 | AT = A'; 17 | 18 | CanonicalB = [zeros(length(AT),1), eye(length(AT))]; 19 | 20 | a = cell(1,length(AT)); 21 | for i = 1:length(AT) 22 | a{i} = ToBasis(AT(i,:)); 23 | end 24 | 25 | if verbose, tic; end 26 | 27 | c = cell(1,length(AT)); 28 | c{1} = zeros(1,length(AT)); 29 | B = cell(1,length(AT)); 30 | for i = 1:length(AT) 31 | c{i} = NestReflectByHyper(c, a{i}, i); 32 | c{i} = GAarithmetic('minus', c{i}, ['e' num2str(i)]);%CanonicalB(i,:) 33 | B{i} = phi(c{i}, CanonicalB); 34 | end 35 | 36 | if verbose, toc; end 37 | 38 | if verbose 39 | disp('DISPLAYING RESULTS') 40 | disp('Reflections by hyperplane:') 41 | for i = 1:length(c) 42 | disp(['c[' num2str(i) ']: ' GAmat2string(c{i})]); 43 | end 44 | disp(' '); 45 | for i = 1:length(B) 46 | disp(['B[' num2str(i) ']: ']); 47 | disp(num2str(B{i})); 48 | end 49 | disp(' '); 50 | M1 = prodRecursive(fliplr(B)) * A; 51 | M1 = set2MachinePrecision(M1, treshold); 52 | M2 = prodRecursive(B) - A; 53 | M2 = set2MachinePrecision(M2, treshold); 54 | disp('Validation...') 55 | disp('B[1]*B[2]* ... * B[n] * A'); 56 | disp(M1); 57 | disp('B[1]*B[2]* ... * B[n] - A'); 58 | disp(M2); 59 | disp('**************************************************'); 60 | end 61 | 62 | function out = prodRecursive(in) 63 | 64 | A = in{1}; 65 | B = in{2}; 66 | out = A*B; 67 | 68 | for i = 3:length(in) % Iterate until no input arguments remain 69 | A = out; 70 | B = in{i}; 71 | out = A*B; 72 | end 73 | 74 | function out = set2MachinePrecision(in, treshold) 75 | 76 | idx = abs(in) < treshold; 77 | 78 | in(idx) = 0; 79 | out = in; 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Clifford Toolbox for Mathematica and Matlab 2 | 3 | # This toolbox has been superseeded by: [https://github.com/jlaragonvera/Geometric-Algebra](https://github.com/jlaragonvera/Geometric-Algebra) 4 | 5 | **Authors:** 6 | [Aragón-Camarasa, G.](https://github.com/gerac83), [Aragón-González, G.](https://scholar.google.co.uk/citations?user=kRY33gQAAAAJ&hl=en), [Aragon J. L.](http://www.fata.unam.mx/web/?q=node/6) and [Rodriguez-Andrade, M. A.](https://scholar.google.co.uk/citations?user=lkR2_C0AAAAJ&hl=en) 7 | 8 | [LICENSE](https://github.com/gerac83/clifford_toolbox/blob/master/LICENSE) 9 | 10 | ## Introduction 11 | 12 | Clifford Toolbox is a collection of functions for doing general calculations with Clifford Algebra (i.e. Geometric Algebra) of ![fig6](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_6.png), using _Mathematica 9.0_ or higher and _Matlab R2013a_ or higher. All results are given in terms of the orthonormal basis vectors ![fig7](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_7.png). 13 | 14 | ## What are Clifford Algebras? 15 | 16 | The Clifford algebra of the vector space ![fig1](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_1.png), with a bilinear form `` of signature `p`, `q`, and an orthonormal basis 17 | ![fig2](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_2.png), `i=1,2,...,n (=p+q)`, is generated by ![fig3](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_3.png) with the relation 18 | 19 | ![fig4](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_4.png) 20 | 21 | where 22 | 23 | ![fig5](https://raw.githubusercontent.com/wiki/gerac83/clifford_toolbox/Intro_images/UserGuide_5.gif) 24 | 25 | ## Online Help 26 | 27 | - [General Information and Description](https://github.com/gerac83/clifford_toolbox/wiki) 28 | - [Getting Clifford Toolbox and Installation](https://github.com/gerac83/clifford_toolbox/wiki#installation) 29 | - [Listing of Functions for Wolfram Mathematica](https://github.com/gerac83/clifford_toolbox/wiki/Listing-of-Functions-for-Wolfram-Mathematica) 30 | - [Listing of Functions for Matlab](https://github.com/gerac83/clifford_toolbox/wiki/Listing-of-Functions-for-Matlab) 31 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/untransform.m: -------------------------------------------------------------------------------- 1 | function out = untransform(in) 2 | 3 | %UNTRANSFORM(IN) untransforms IN from Clifford algebra to quaternion 4 | % representation 5 | % 6 | % Version: 1.0 (Nov, 2010) 7 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ischar(in) 11 | in = GAstring2mat(in); 12 | end 13 | 14 | tuples = cell(size(in,1),1); 15 | for i = 1:size(in,1) 16 | idx = find(in(i,:)); 17 | tuples{i} = [in(i,idx(1)), tuples{i}, idx - 1]; 18 | end 19 | 20 | Q = [-1, 2, 3; % I 21 | 1, 1, 3; % J 22 | -1, 1, 2]; % K 23 | 24 | strcell = cell(size(in,1),1); 25 | scalarFlag = 0; % To indicate wether a scalar has been indexed 26 | for i = 1:size(in,1) 27 | if length(tuples{i}) == 2 28 | strcell{1} = num2str(tuples{i}(:,1)); 29 | scalarFlag = 1; 30 | else 31 | test = sum(Q(:,2:3) == repmat(tuples{i}(:,2:3), 3 ,1),2) == 2; % Find entries of quaternion basis 32 | idx = find(test, 1); 33 | if ~isempty(idx) 34 | temp = (abs(tuples{i}(:,1))/tuples{i}(:,1)) * Q(idx,1); 35 | if temp == 1; % Test if it's negative 36 | if abs(tuples{i}(:,1)) ~= 1 37 | strcell{idx+scalarFlag} = [num2str(abs(tuples{i}(:,1))), strQ(idx)]; 38 | else 39 | strcell{idx+scalarFlag} = strQ(idx); 40 | end 41 | else 42 | if abs(tuples{i}(:,1)) ~= 1 43 | strcell{idx+scalarFlag} = ['-' num2str(abs(tuples{i}(:,1))), strQ(idx)]; 44 | else 45 | strcell{idx+scalarFlag} = ['-' strQ(idx)]; 46 | end 47 | end 48 | end 49 | end 50 | end 51 | 52 | strcell = strcell(~cellfun('isempty',strcell)); 53 | % Create expression 54 | out = []; 55 | for i = 1:length(strcell) 56 | idx = strfind(strcell{i},'-'); 57 | if isempty(idx) && i ~= 1 58 | out = [out '+' strcell{i}]; %#ok<*AGROW> 59 | else % it's negative!! 60 | out = [out strcell{i}]; 61 | end 62 | end 63 | 64 | function out = strQ(in) 65 | 66 | switch in 67 | case 1 68 | out = 'i'; 69 | case 2 70 | out = 'j'; 71 | case 3 72 | out = 'k'; 73 | otherwise 74 | error('Unknown option in UNTRANSFORM->STRQ'); 75 | end 76 | 77 | -------------------------------------------------------------------------------- /Mathematica/cliffordv07/CHANGELOG: -------------------------------------------------------------------------------- 1 | First version (1996): J.L. Aragon and O. Caballero 2 | 3 | First revised version (1997): J.L. Aragon 4 | Changes: 5 | -MultivectorInverse. 6 | -Subscripted -> SubscriptBox 7 | -Aliases discarded 8 | New: 9 | -Format 10 | -Palette 11 | 12 | Version 0.1 (2007): G. Aragon-Camarasa 13 | New: 14 | -GADraw function. 15 | -Improved Palette. 16 | -Help entries for Mathematica 6.0 17 | 18 | Version 0.2 (Oct,2007): G. Aragon-Camarasa, J.L. Aragon 19 | Changes: 20 | -Updated GADraw function 21 | -Projection error fixed 22 | 23 | Version 0.3 (Oct,2008): J.L. Aragon 24 | Changes: 25 | -geoprod was changed to GeometricProduct and rewitten 26 | -Projection is a function of Mathematica 6.0: Projection -> CProjection 27 | 28 | Version 0.3 (Oct,2009): J.L. Aragon 29 | Changes: 30 | -Grade modified 31 | 32 | Version 0.4 (Jan,2010): J.L. Aragon 33 | Changes: 34 | -Function bilinearform is modified to handle degenerate cases. 35 | 36 | Version 0.5 (Aug,2010): G. Aragon-Camarasa 37 | Changes: 38 | -License included 39 | -New version number convention 40 | -Updated Grade, InnerProduct & OuterProduct in accordance to a more stable version (v. 0.3) 41 | -GADraw not available (Mathematica 7 incompatibility) 42 | 43 | Version 0.6 (Sep,2010): G. Aragon-Camarasa 44 | Changes: 45 | -GeometricProduct is now compatible with Mathematica 7 (changes in v.0.3 has been reverted 46 | to the original form and included a new set delayed rule for expansion and simplification) 47 | -Bug corrected on the MultivectorInverse function. The bug was a simplification 48 | and expansion on the variables in the GeometricProduct function 49 | -Grade has been changed. Mathematica 7 introduced an incompatibility in the If statement, 50 | now instead of the \[Equal] is SameQ. This seems to correct the problem. 51 | 52 | Version 0.7 (Mar,2011): G. Aragon-Camarasa 53 | Changes: 54 | -Chop function integrated in GeometricProduct, InnerProduct, OuterProduct and ToBasis. It 55 | seems to solve problems while doing numeric computations. 56 | -Bug on MultivectorInverse (not returning the inverse of the multivector due to numeric 57 | inconsistencies) seems to be solved with the above solution. Also Chop at the output of 58 | the function intercepts numerical errors. 59 | -$SetEpsilon option included. This is used to "chop" values below $SetEpsilon. 60 | -New functions integrated, kindly provided by Charles Gunn. They have beed modified to suit 61 | the format and notation of the package (e.g. Polarize function not used, left original Dual) 62 | *PointToBasis 63 | *PointFromBasis 64 | *RegressiveProduct 65 | *Dualize 66 | -Added extra line to match bilinearform of Charles Gunn implementation for future implementations; 67 | case e[i]*e[i] = 0. 68 | 69 | 70 | --------- 71 | GARotation 72 | 73 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/GAmat2string.m: -------------------------------------------------------------------------------- 1 | function out = GAmat2string(matrix) 2 | 3 | %GAMAT2STRING(M) transforms from an array to string representation 4 | % 5 | % Version: 1.0 (Nov, 2010) 6 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 7 | % Aragon J. L. & Rodriguez-Andrade, M. A. 8 | 9 | 10 | % Simplify matrix 11 | matrix = simplifyResult(matrix); 12 | 13 | 14 | sizMat = size(matrix); 15 | str = []; 16 | mat = cell(1,sizMat(1)); 17 | for i = 1:sizMat(1) 18 | 19 | vec = matrix(i,:); 20 | sumVec = sum(abs(vec)>0,2); 21 | 22 | if sumVec == 1 % Scalar or 1-blade 23 | idx = find(vec); % Extract basis 24 | coeff = vec(idx); % Extract coeff 25 | if idx == 1 % Scalar case 26 | strTemp = num2str(coeff); 27 | else % 1-blade case 28 | if abs(coeff) - eps ~= 1.0 29 | strTemp = [num2str(coeff) 'e' num2str(idx-1)]; 30 | else 31 | if coeff < 0 32 | strTemp = ['-e' num2str(idx-1)]; 33 | else 34 | strTemp = ['e' num2str(idx-1)]; 35 | end 36 | end 37 | end 38 | end 39 | 40 | if sumVec >= 2 % When k-blade (where k >= 2) 41 | idx = find(vec); % Extract basis 42 | coeff = vec(idx(1)); % Extract coeff 43 | if coeff >= 0 && coeff ~= 1 44 | strTemp = num2str(coeff); 45 | else 46 | if coeff < -eps && coeff ~= -1 47 | strTemp = num2str(coeff); 48 | elseif coeff == -1 49 | strTemp = '-'; 50 | else 51 | strTemp = []; 52 | end 53 | end 54 | for j = 1:length(idx) 55 | strTemp = [strTemp 'e' num2str(idx(j)-1)]; %#ok 56 | end 57 | end 58 | 59 | if sumVec > 0 60 | %str = [str ws strTemp s]; %#ok<*AGROW> 61 | mat{i} = strTemp; 62 | end 63 | 64 | if sumVec == 0 65 | str = '0'; 66 | end 67 | end 68 | 69 | % idx = findstr(str, '-'); 70 | % while ~isempty(idx) 71 | % if ~isempty(idx) 72 | % if idx(1) ~= 1 73 | % str(idx(1)) = []; 74 | % idx2 = findstr(str, '+'); 75 | % str(idx2(1)) = '-'; 76 | % end 77 | % end 78 | % idx3 = findstr(str(idx(1) + 1:end), '-'); 79 | % idx = idx3 + idx(1); 80 | % end 81 | 82 | if sumVec ~= 0 83 | for i = 1:length(mat) 84 | if strcmp(mat{i}(1), '-') && i > 1 85 | mat{i} = [' - ', mat{i}(2:end)]; 86 | elseif i > 1 87 | mat{i} = [' + ', mat{i}]; 88 | end 89 | str = [str, mat{i}]; %#ok 90 | end 91 | end 92 | 93 | out = str; 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/transform.m: -------------------------------------------------------------------------------- 1 | function out = transform(in) 2 | 3 | %TRANSFORM(IN) transforms IN from quaternion to Clifford algebra 4 | % representation 5 | % 6 | % Version: 1.0 (Nov, 2010) 7 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ~ischar(in) 11 | error('Input must be a string!'); 12 | end 13 | 14 | idx = strfind(in,' '); % Remove white spaces 15 | in(idx) = []; 16 | 17 | % Add find +'s and -'s in order to seperate them in cells 18 | idxP = strfind(in,'+'); 19 | idxN = strfind(in,'-'); 20 | idx = sort([idxP idxN]); 21 | 22 | % Seperate into cells 23 | T = cell(1,1); 24 | i = 1; 25 | while ~isempty(in) 26 | if idx(1) == 1 && length(idx) > 1 27 | T{i} = in(1:idx(2) - 1); 28 | in(1:idx(2) - 1) = []; 29 | idx = idx - idx(2) + 1; 30 | idx(1:2) = []; 31 | elseif idx(1) == 1 && ~(length(idx) > 1) 32 | T{i} = in(1:end); 33 | in(1:end) = []; 34 | idx = []; 35 | else 36 | T{i} = in(1:idx(1) - 1); 37 | in(1:idx(1) - 1) = []; 38 | idx = idx - idx(1) + 1; 39 | if length(idx) ~= 1 40 | idx(1) = []; 41 | end 42 | end 43 | i = i + 1; 44 | end 45 | 46 | % Clear +'s 47 | idx = strfind(T, '+'); 48 | for i = 1:length(idx) 49 | if ~isempty(idx) 50 | T{i}(idx{i}) = []; 51 | end 52 | end 53 | 54 | % Look for i's 55 | idx = strfind(T,'i'); 56 | T = processQuaternions(idx, T, '-e2e3'); 57 | 58 | % Look for j's 59 | idx = strfind(T,'j'); 60 | T = processQuaternions(idx, T, 'e1e3'); 61 | 62 | % Look for k's 63 | idx = strfind(T,'k'); 64 | T = processQuaternions(idx, T, '-e1e2'); 65 | 66 | % Create expression 67 | out = T{1}; 68 | for i = 2:length(T) 69 | idx = strfind(T{i}, '-'); 70 | if isempty(idx) 71 | out = [out ' + ' T{i}]; %#ok<*AGROW> 72 | else 73 | out = [out ' ' T{i}]; 74 | end 75 | end 76 | 77 | out = GAstring2mat(out); 78 | 79 | function T = processQuaternions(idx, T, bases) 80 | 81 | idxSign = strfind(bases, '-'); 82 | if ~isempty(idxSign) 83 | sign = bases(idxSign); 84 | bases(idxSign) = []; 85 | else 86 | sign = []; 87 | end 88 | 89 | for i = 1:length(idx) 90 | if ~isempty(idx{i}) 91 | if idx{i} == 1 92 | T{i} = []; 93 | T{i} = [sign bases]; 94 | else 95 | test = T{i}; 96 | idx2 = strfind(test, sign); 97 | test(idx2) = []; 98 | if ~isempty(idx2) && length(test) == 1 99 | T{i} = []; 100 | T{i} = bases; 101 | else 102 | c = T{i}(1:idx{i}-1); 103 | idx3 = strfind(c, sign); 104 | c(idx3) = []; 105 | if isempty(idx3) 106 | T{i} = [sign c bases]; 107 | else 108 | T{i} = [c bases]; 109 | end 110 | 111 | end 112 | end 113 | end 114 | end 115 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Core/GeometricProduct.m: -------------------------------------------------------------------------------- 1 | function [out, out1] = GeometricProduct(varargin) 2 | 3 | %GEOMETRICPRODUCT(A1,A2,...) calculates the geometric product of 4 | % multivectors m1,m2,..., mn 5 | % 6 | % INPUTS 7 | % Inputs may be a string or a matrix. They are explained below... 8 | % STRING: it should be expresed in terms of the geometric algrabra basis. 9 | % See example below. 10 | % MATRIX: it should be a matrix like: [scalar, e1, e2, e3, ..., en; ....] 11 | % such that for each row denotes addition. Thus, writting: 12 | % A = 2 + e1 + 4e2e3 + 8e1e2e5 shoud be 13 | % 14 | % A = [2, 0, 0, 0, 0, 0; 15 | % 0, 1, 0, 0, 0, 0; 16 | % 0, 0, 4, 4, 0, 0; 17 | % 0, 8, 8, 0, 0, 8]; 18 | % 19 | % 20 | % OUTPUTS 21 | % Two different outputs are available, a matrix or a string representation. 22 | % The former is by default whereas the latter is invoke by defining a 23 | % second ouput in the function. For example: 24 | % 25 | % out = GeometricProduct(...) -> Matrix representation 26 | % [out, out1] = GeometricProduct(...) -> Matrix and string representation 27 | % accordingly 28 | % 29 | % Examples. 30 | % 31 | % MATRIX REPRESENTATION 32 | % A = [0, 1]; 33 | % B = [0, 7, 7, 0; 0, 1, 1, 1]; 34 | % MAT = GeometricProduct(A,B) 35 | % 36 | % MAT = [0 0 7 0; 37 | % 0 0 1 1]; 38 | % 39 | % STRING REPRESENTATION 40 | % A = 'e1'; 41 | % B = '7e1e2 + e1e2e3'; 42 | % [MAT, STR] = GeometricProduct(A,B) 43 | % 44 | % STR = '7e2 + e2e3' 45 | % 46 | % Based on: Clifford Algebra with Mathematica (2008) http://arxiv.org/abs/0810.2412 47 | % Version: 0.7 (Oct, 2011) 48 | % Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 49 | % Aragon J. L. & Rodriguez-Andrade, M. A. 50 | 51 | 52 | numVar = size(varargin,2); 53 | if numVar < 2 54 | error('At least two inputs are required'); 55 | end 56 | 57 | for iter = 1:numVar-1 % Iterate until no input arguments remain 58 | if iter == 1 % First iteration, assigns the first entry of the arguments 59 | A = varargin{iter}; 60 | else % otherwise, set as the last output 61 | A = out; 62 | end 63 | B = varargin{iter+1}; 64 | 65 | if ischar(A) 66 | A = GAstring2mat(A); 67 | end 68 | if ischar(B) 69 | B = GAstring2mat(B); 70 | end 71 | 72 | % Check that both has the same number of columns (dimensions) 73 | [A, B, sizA, sizB] = setDimensions(A, B, size(A), size(B)); 74 | 75 | % Set output matrix 76 | out = zeros(sizA(1)*sizB(1),sizA(2)); 77 | k = 1; 78 | for i = 1:sizA(1) 79 | for j = 1:sizB(1) 80 | % Coefficients 81 | tupleA = abs(A(i,:)) > 0; tupleB = abs(B(j,:)) > 0; 82 | coeff1 = A(i,tupleA); coeff2 = B(j,tupleB); 83 | if isempty(coeff1) 84 | coeff1 = 0; 85 | end 86 | if isempty(coeff2) 87 | coeff2 = 0; 88 | end 89 | coeff = coeff1(1) * coeff2(1); 90 | 91 | % Product of 2 blades 92 | gp = prodTwoBlades(tupleA, tupleB); 93 | 94 | % Multiply and append it to the output matrix 95 | out(k,:) = coeff * gp; 96 | k = k + 1; 97 | end 98 | end 99 | 100 | out = simplifyResult(out); 101 | end 102 | 103 | if nargout > 1 104 | out1 = GAmat2string(out); 105 | end 106 | 107 | % Geometric function of two blades (Vahlen 1897) 108 | function gp = prodTwoBlades(nx, ny) 109 | 110 | global signature; 111 | 112 | if isempty(signature) 113 | Set_Signature; % Set default 114 | end 115 | 116 | s = 0; 117 | for m = 2:size(nx,2) - 1 % First element in the list is the scalar 118 | for n = m+1:size(ny,2) 119 | s = s + (ny(m) * nx(n)); 120 | end 121 | end 122 | 123 | % ******Before bilinearform 124 | % scalar = bsxfun(@and, nx(1), ny(1)); 125 | % res = bsxfun(@xor, nx(2:end), ny(2:end)); 126 | % ************************* 127 | 128 | scalar = bsxfun(@and, nx(1), ny(1)); 129 | res = bsxfun(@xor, nx(2:end), ny(2:end)); 130 | idx = find((nx(2:end) + ny(2:end)) > 1); 131 | 132 | if sum(res) < 1 133 | scalar = 1; 134 | end 135 | 136 | gp = ((-1)^s) * [scalar, res]; 137 | if ~isempty(idx) 138 | for i = 1:length(idx) 139 | bf = bilinearform(idx(i)); 140 | gp = bf*gp; 141 | end 142 | end 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /MATLAB/cliffordv07/Extra/GAstring2mat.m: -------------------------------------------------------------------------------- 1 | function out = GAstring2mat(str) 2 | 3 | %GASTRING2MAT(STRING) transforms from a string to an array 4 | %representation 5 | % 6 | % Version: 1.0 (Nov, 2010) 7 | % Copyright (c) 2010, Aragon-Camarasa, G., Aragon-Gonzalez, G.; 8 | % Aragon J. L. & Rodriguez-Andrade, M. A. 9 | 10 | if ~ischar(str) 11 | error('Input must be a string!'); 12 | end 13 | 14 | % Eliminate the spaces first 15 | str(strfind(str,' ')) = []; 16 | 17 | % Seperate each vector component in MATLAB cells 18 | idx1 = strfind(str, '+'); 19 | idx2 = -strfind(str, '-'); 20 | idx = [idx1 idx2]; 21 | [~, ix] = sort(abs(idx)); 22 | idx = idx(ix); 23 | temp = cell(length(idx)+1,1); 24 | i = 1; 25 | sign = []; 26 | while ~isempty(str) 27 | if isempty(idx) 28 | temp{i} = [sign str(1:end)]; 29 | str = []; 30 | i = i+1; 31 | else 32 | if abs(idx(1)) == 1 33 | sign = '-'; 34 | str(1:abs(idx(1))) = []; 35 | 36 | idx1 = strfind(str, '+'); 37 | idx2 = -strfind(str, '-'); 38 | idx = [idx1 idx2]; 39 | [~, ix] = sort(abs(idx)); 40 | idx = idx(ix); 41 | else 42 | temp{i} = [sign str(1:abs(idx(1))-1)]; 43 | str(1:abs(idx(1))) = []; 44 | 45 | if idx(1) < 0 46 | sign = '-'; 47 | else 48 | sign = []; 49 | end 50 | 51 | idx1 = strfind(str, '+'); 52 | idx2 = -strfind(str, '-'); 53 | idx = [idx1 idx2]; 54 | [~, ix] = sort(abs(idx)); 55 | idx = idx(ix); 56 | 57 | i = i+1; 58 | end 59 | end 60 | end 61 | temp = temp(~cellfun('isempty',temp)); 62 | 63 | % Create matrix of GA elements 64 | matrix = cell(length(temp),1); 65 | maxDim = 0; 66 | for i = 1:length(matrix) 67 | % Find the grade of each component 68 | idx = strfind(temp{i}, 'e'); 69 | if isempty(idx) %Scalar case, no basis 70 | matrix{i} = zeros(1,2); % Set the entry as 1-blade 71 | matrix{i}(1) = str2double(temp{i}); % Extract coefficient 72 | matrix{i}(2) = 1; % Set type of blade (MATLAB indeces work from 1 to N, so zeros it's not possible) 73 | maxDim = findMaxDimension(maxDim, matrix{i}(2:end)); 74 | else 75 | matrix{i} = zeros(1, size(idx,2)); % Set the entry according to the type of the blade 76 | % If 'e' is the first entry, there's not a coefficient defined; 77 | % therefore it is multiply by one. Also, If first entry in temp{i} 78 | % is '-', set coeffcient to -1 79 | if idx(1) == 1 || strcmp(temp{i}(1),'-') 80 | ix = strfind(temp{i}, 'e'); 81 | if ix(1) ~= 1 82 | if strcmp(temp{i}(1),'-') && strcmp(temp{i}(2),'e') 83 | matrix{i}(1) = -1; 84 | else 85 | matrix{i}(1) = str2double(temp{i}(1:idx(1)-1)); 86 | end 87 | elseif ix(1) == 1 88 | matrix{i}(1) = 1; 89 | end 90 | else % otherwise 91 | matrix{i}(1) = str2double(temp{i}(1:idx(1)-1)); 92 | end 93 | 94 | j = 2; 95 | while ~isempty(idx) % For each entry in idx, iterate and extract the dimension of the basis 96 | if length(idx) == 1 97 | matrix{i}(j) = str2double(temp{i}(idx(1)+1:end)) + 1; % Set type of blade and add one (MATLAB indeces work from 1 to N, so zeros it's not possible) 98 | temp{i}(idx(1):end) = []; % Remove the basis 99 | idx = []; 100 | else 101 | matrix{i}(j) = str2double(temp{i}(idx(1)+1:idx(2)-1)) + 1; % Set type of blade and add one (MATLAB indeces work from 1 to N, so zeros it's not possible) 102 | temp{i}(idx(1):idx(2)-1) = []; % Remove the basis 103 | idx = strfind(temp{i}, 'e'); 104 | end 105 | j = j+1; 106 | end 107 | maxDim = findMaxDimension(maxDim, matrix{i}(2:end)); 108 | end 109 | end 110 | 111 | out = zeros(size(matrix,1),maxDim); 112 | for i = 1:size(matrix,1) 113 | coeff = matrix{i}(1); 114 | idx = matrix{i}(2:end); 115 | out(i,:) = flipSigns(coeff, idx, out(i,:)); 116 | end 117 | 118 | out = simplifyResult(out); 119 | 120 | % Finds the maximum dimension of the current tuple 121 | function dimension = findMaxDimension(dimension, in) 122 | 123 | if dimension < max(in) 124 | dimension = max(in); 125 | end 126 | 127 | % Correct signs of the input vector 128 | function vector = flipSigns(coeff, idx, vector) 129 | 130 | sizIn = length(idx); 131 | if sizIn == 1 % When it is a 1-blade, nothing has to be done in this case 132 | vector(idx) = coeff; 133 | else % When it a k-blade (k >= 2), 134 | tuples = zeros(sizIn,size(vector,2)); % Create tuples for each individual basis in the same order as the input 135 | str = []; % Empty string which is later filled up with the Geometric product command 136 | for i = 1:sizIn % Loop until sizIn creating the GAprod input variables for all the tuples 137 | tuples(i,idx(i)) = 1; 138 | str = [str 'tuples(' num2str(i) ',:),']; %#ok 139 | end 140 | % Evaluate command and finish 141 | command = ['GeometricProduct(' str(1:end-1) ')']; 142 | vector = eval(command); 143 | vector = coeff .* vector; 144 | end 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /Mathematica/cliffordv07/cliffordv07.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | (* Copyright (c) 2011, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & 4 | Rodriguez-Andrade, M. A. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 20 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation are those of the 28 | authors and should not be interpreted as representing official policies, either expressed 29 | or implied, of the copyright holders. 30 | *) 31 | 32 | 33 | 34 | (* Set up the Package Context. *) 35 | 36 | (* :Title: Clifford Algebra with Mathematica *) 37 | 38 | (* :Summary: 39 | This file contains declarations for calculations with Clifford 40 | algebra of a n-dimensional vector space. When loaded, 41 | vectors (and multivectors) must be given as linear combinations 42 | of a canonical (orthonormal basis) that are denoted by 43 | e[1],e[2],..,e[n]. 44 | 45 | Examples: The vector {1,2,0,-1} should be written as 46 | e[1] + 2 e[2] - e[4]. 47 | 48 | The multivector a + 5e1 + e123 is written as 49 | a + 5 e[1] + e[1]e[2]e[3]. 50 | 51 | With the exception of the function Dual[m,n], it is not 52 | neccesary to define the dimension of the vector space, it 53 | is calculated automatically by the function dimensions[ ]. 54 | The signature of the bilinear form is set by 55 | $SetSignature, sets the indices (p,q,s) of the bilinear 56 | form (s is the degeneracy index) if not specified, the 57 | default value is {20,20,20} *) 58 | 59 | (* :References: 60 | 1. D. Hestenes, 1987. New Foundations for Classical Mechanics. 61 | D. Reidel Publishing Co. Holland 62 | 2. S. Gull, A. Lasenby and C. Doran, 1993. 63 | Imaginary Numbers are not Real- The Geometric Algebra of Spacetime. 64 | Foundations of Physics, Vol. 23, No. 9: 1175-1201. 65 | 3. T. Wickham-Jones, 1994. Mathematica Graphics: Techniques and Applications. 66 | Springer-Verlag New York Inc.; Har/Dsk edition (Dec 1994). *) 67 | 68 | 69 | BeginPackage["cliffordv07`"] 70 | 71 | 72 | (* Usage message for the exported function and the Context itself *) 73 | 74 | Clifford::usage = "Clifford.m is a package to resolve operations with 75 | Clifford Algebra." 76 | 77 | e::usage = "e is used to denote the elements of the canonical basis of Euclidean vector 78 | space where the Clifford Algebra is defined, so e[i] is used as i-th basis 79 | element" 80 | 81 | i::usage = "i represents the first component of a quaternion. i^2=-1" 82 | 83 | j::usage = "j represents the second component of a quaternion. j^2=-1" 84 | 85 | k::usage = "k represents the third component of a quaternion. k^2=-1" 86 | 87 | ntuple::usage = "..." 88 | 89 | dimensions::usage = "..." 90 | 91 | GeometricProduct::usage = "GeometricProduct[m1,m2,...] calculates the Geometric 92 | Product of multivectors m1,m2,..." 93 | 94 | Coeff::usage = "Coeff[m,b] gives the coefficient of the r-blade b in the multivector m." 95 | 96 | Grade::usage = "Grade[m,r] gives the r-vector part of the multivector m." 97 | 98 | HomogeneousQ::usage = "HomogeneousQ[x,r] gives True if x is a r-blade and False 99 | otherwise." 100 | 101 | Turn::usage = "Turn[m] gives the Reverse of the multivector m." 102 | 103 | Magnitude::usage = "Magnitude[m] calculates the Magnitude of the multivector m." 104 | 105 | Dual::usage = "Dual[m,n] calculates the Dual of the multivector m in a 106 | n-dimensional space." 107 | 108 | Dualize::usage = "Similar to Dual but for a nondegenerate metric" 109 | 110 | InnerProduct::usage = "InnerProduct[m1,m2,...] calculates the Inner Product of 111 | multivectors m1,m2,..." 112 | 113 | OuterProduct::usage = "OuterProduct[m1,m2,...] calculates the Outer Product of 114 | multivectors m1,m2,..." 115 | 116 | GARotation::usage = "GARotation[v,w,x,theta] Rotates the vector v by an angle theta 117 | (in degrees), along the plane defined by w and x. The sense of the rotation 118 | is from w to x. Default value of theta is the angle between w and x." 119 | 120 | MultivectorInverse::usage = "MultivectorInverse[m] gives the inverse of a 121 | multivector m." 122 | 123 | GAReflection::usage = "GAReflection[v,w,x] reflects the vector v by the plane 124 | formed by the vectors w and x." 125 | 126 | GAProjection::usage = "GAProjection[v,w] calculate the projection of the vector v 127 | on the subspace defined by the r-blade w." 128 | 129 | GARejection::usage = "GARejection[v,w] calculate the rejection of the vector v on 130 | the subspace defined by the r-blade w." 131 | 132 | RegressiveProduct::usage = "RegressiveProduct[v,w] calculate the dual outer product 133 | of v and w. If OuterProduct is meet, then this is join." 134 | 135 | ToBasis::usage = "ToBasis[x] Transform the vector x from {a,b,...} to the 136 | standard form used in this Package: a*e[1]+b*e[2]+...." 137 | 138 | ToVector::usage ="ToVector[x,n] transform the n-dimensional vector x from 139 | a*e[1]+b*e[2]+... to the standard Mathematica form {a,b,...}. The defaul value of 140 | n is the highest of all e[i]'s." 141 | 142 | ToVectorBase::usage = "..." 143 | 144 | PointToBasis::usage "PointToBasis[vec] converts a homogenous point into the geometric algebra; 145 | similar to ToBasis." 146 | 147 | PlaneToBasis::usage "Same as ToBasis." 148 | 149 | PointFromBasis::usage "PointFromBasis[x, n] converts the Clifford Algebra element x (a point) 150 | of dimension n to the standard Mathematica form {a,b,...}." 151 | 152 | PlaneFromBasis::usage "Same as ToVector." 153 | 154 | QuaternionProduct::usage = "QuaternionProduct[q1,q2,...] gives the product of 155 | quaternions q1,q2,..." 156 | 157 | QuaternionInverse::usage = "QuaternionInverse[q] finds the inverse of a 158 | quaternion q." 159 | 160 | QuaternionMagnitude::usage = "QuaternionMagnitude[q] gives the magnitude of 161 | a quaternion q." 162 | 163 | QuaternionConjugate::usage = "QuaternionConjugate[q] gives the conjugated of a 164 | quaternion q." 165 | 166 | Pseudoscalar::usage = "Pseudoscalar[n] gives the n-dimensional pseudoscalar." 167 | 168 | GeometricPower::usage = "GeometricPower[m,n] calculates the Geometic Product of 169 | a multivector m, n-times." 170 | 171 | GeometricProductSeries::usage = "GeometricProductSeries[sym,m,n] calculates the 172 | series of the function sym, of a multivector m up to a power n. Default value of n is 10." 173 | 174 | GeometricExp::usage = "GeometricExp[m,n] calculates the series of the function 175 | Exp, of a multivector m up to a power n. Default value of n is 10." 176 | 177 | GeometricSin::usage = "GeometricSin[m,n] calculates the series of the function 178 | Sin, of a multivector m up to a power n. Default value of n is 10." 179 | 180 | GeometricCos::usage = "GeometricCos[m,n] calculates the series of the function 181 | Cos, of a multivector m up to a power n. Default value of n is 10." 182 | 183 | GeometricTan::usage = "GeometricTan[m,n] calculates the series of the function 184 | Tan, of a multivector m up to a power n. Default value of n is 10." 185 | 186 | $SetSignature::usage = "$SetSignature sets the indices (p,q,s) of the bilinear form 187 | used to define the Clifford Algebra (s is the index of degeneracy). Thus it is assumed 188 | that for i>p+q+s we have GeometricProduct[e[i],e[i]]=0. 189 | The default value is {20,0}. Once changed, it can be recovered by Clear[$SetSignature];." 190 | 191 | $SetEpsilon::usage = "$SetEpsilon sets the machine working precision to be used for numerical 192 | computations. The default value is 10^-14. Once changed, it can be recovered by Clear[$SetEpsilon];." 193 | 194 | GADraw::usage = "GADraw function plots vectors, bi-vectors and trivectors in the canonical 195 | basis of Clifford Algebra. To change the view of the plot, it must be 196 | used the ViewPoint function, e.g. Draw[x,ViewPoint->{0,1,0}]. Default 197 | value of ViewPoint is {1.3,-2.4,2}"; 198 | 199 | 200 | (* Set the indices (p,q,s) of the bilinear form *) 201 | $SetSignature = {20,0,0} 202 | $SetEpsilon = 10^-14 203 | 204 | Begin["`Private`"] (* Begin the Private Context *) 205 | 206 | (* Unprotect functions Re, Im and Clear to define our rules *) 207 | protected = Unprotect [Re, Im, Clear] 208 | 209 | 210 | (* Error Messages *) 211 | Clifford::messagevectors = "`1` function works only with vectors." 212 | Clifford::messagedim = "Function works in three dimensions." 213 | DrawBiVec::"Out of Dimension" = "Dimension must be less or equal to 3 dimension."; 214 | 215 | 216 | (* Clear function *) 217 | Clear[$SetSignature] := $SetSignature = {20,0,0} 218 | Clear[$SetEpsilon] := $SetEpsilon = $MachineEpsilon 219 | 220 | 221 | (* Output mimics standard mathematical notation *) 222 | Format[e[x_]] := SubscriptBox[e, x] //DisplayForm 223 | 224 | 225 | (* Begin Geometric Product Section *) 226 | GeometricProduct[ _] := $Failed 227 | GeometricProduct[x_, y_, z__] := Fold[GeometricProduct, x, {y, z}] // Simplify 228 | GeometricProduct[x_ , y_ ] := Chop[Simplify[geoprod[Expand[x],Expand[y]]],$SetEpsilon] // Expand 229 | geoprod[x_,y_] := Module[{ 230 | nx = ntuple[Expand[x], Max[dimensions[Expand[x]], dimensions[Expand[y]]]], 231 | ny = ntuple[Expand[y], Max[dimensions[Expand[x]], dimensions[Expand[y]]]], gp}, 232 | gp = (Times @@ e /@ Flatten[Position[nx + ny, 1]]) * Apply[Times, Apply[bilinearform, Map[{e[#], e[#]} &, Flatten[Position[nx + ny, 2]]], {1}]]; 233 | Return[gp*(-1)^Sum[ny[[m]]*nx[[n]], {m, Length[nx] - 1}, {n, m + 1, Length[ny]}]]] 234 | geoprod[a_ x_,y_] := a geoprod[x,y] /; FreeQ[a,e[_?Positive]] 235 | geoprod[x_,a_ y_] := a geoprod[x,y] /; FreeQ[a,e[_?Positive]] 236 | geoprod[x_, y_] := x y /; (FreeQ[x, e[_?Positive]] || FreeQ[y, e[_?Positive]]) 237 | geoprod[x_,y_Plus] := Distribute[f[x,y],Plus] /. f->GeometricProduct 238 | geoprod[x_Plus,y_] := Distribute[f[x,y],Plus] /. f->GeometricProduct 239 | (* End of Geometric Product Section *) 240 | 241 | 242 | (* Begin Grade Section *) 243 | Grade[m_Plus,r_?NumberQ] := Distribute[tmp[m,r],Plus] /. tmp->Grade 244 | Grade[m_,r_?NumberQ] := If[gradeAux[m]===r,m,0] (*Here was the bug. Before If[grados[m]==r,m,0]*) 245 | gradeAux[a_] := 0 /; FreeQ[a,e[_?Positive]] 246 | gradeAux[x_] := gradeAux[x] = Plus @@ ntuple[x,Max[dimensions[x]]] 247 | gradeAux[a_ x_] := gradeAux[x] /; FreeQ[a,e[_?Positive]] 248 | (* End of Grade Section *) 249 | 250 | 251 | (* Begin Inner Product Section *) 252 | InnerProduct[ _] := $Failed 253 | InnerProduct[m1_,m2_,m3__] := tmp[InnerProduct[m1,m2],m3] /. tmp->InnerProduct 254 | InnerProduct[m1_,m2_] := Chop[innprod[Expand[m1],Expand[m2]],$SetEpsilon] // Expand 255 | innprod[a_,y_] := 0 /; FreeQ[a,e[_?Positive]] 256 | innprod[x_,a_] := 0 /; FreeQ[a,e[_?Positive]] 257 | innprod[x_,y_] := innprod[x,y] = Module[ 258 | {p=Plus @@ ntuple[x,Max[dimensions[x],dimensions[y]]], 259 | q=Plus @@ ntuple[y,Max[dimensions[x],dimensions[y]]]}, 260 | Grade[GeometricProduct[x,y],Abs[p-q]] ] 261 | innprod[a_ x_,y_] := a innprod[x,y] /; FreeQ[a,e[_?Positive]] 262 | innprod[x_,a_ y_] := a innprod[x,y] /; FreeQ[a,e[_?Positive]] 263 | innprod[x_,y_Plus] := Distribute[tmp[x,y],Plus] /. tmp->innprod 264 | innprod[x_Plus,y_] := Distribute[tmp[x,y],Plus] /. tmp->innprod 265 | (* End of Inner Product Section *) 266 | 267 | 268 | (* Begin Outer Product Section *) 269 | OuterProduct[ _] := $Failed 270 | OuterProduct[m1_,m2_,m3__] := tmp[OuterProduct[m1,m2],m3] /. tmp->OuterProduct 271 | OuterProduct[m1_,m2_] := Chop[outprod[Expand[m1],Expand[m2]],$SetEpsilon] // Expand 272 | outprod[a_,y_] := a y /; FreeQ[a,e[_?Positive]] 273 | outprod[x_,a_] := a x /; FreeQ[a,e[_?Positive]] 274 | outprod[x_,y_] := outprod[x,y] = Module[ 275 | {p=Plus @@ ntuple[x,Max[dimensions[x],dimensions[y]]], 276 | q=Plus @@ ntuple[y,Max[dimensions[x],dimensions[y]]]}, 277 | Grade[GeometricProduct[x,y],p+q] ] 278 | outprod[a_ x_,y_] := a outprod[x,y] /; FreeQ[a,e[_?Positive]] 279 | outprod[x_,a_ y_] := a outprod[x,y] /; FreeQ[a,e[_?Positive]] 280 | outprod[x_,y_Plus] := Distribute[tmp[x,y],Plus] /. tmp->outprod 281 | outprod[x_Plus,y_] := Distribute[tmp[x,y],Plus] /. tmp->outprod 282 | (* End of Outer Product Section *) 283 | 284 | 285 | (* Begin Turn Section *) 286 | Turn[m_] := backside[Expand[m]] 287 | backside[a_] := a /; FreeQ[a,e[_?Positive]] 288 | backside[x_] := x /; Length[x]==1 289 | backside[x_] := bakside[x] = GeometricProduct @@ e/@Reverse[dimensions[x]] 290 | backside[a_ x_] := a backside[x] /; FreeQ[a,e[_?Positive]] 291 | backside[x_Plus] := Distribute[tmp[x],Plus] /. tmp->backside 292 | (* End of Turn Section *) 293 | 294 | 295 | (* Pseudoscalar function *) 296 | Pseudoscalar[x_?Positive] := Apply[Times, e /@ Range[x]] 297 | 298 | 299 | (* HomogeneousQ function *) 300 | HomogeneousQ[x_,r_?NumberQ] := SameQ[Expand[x],Expand[Grade[x,r]]] 301 | 302 | 303 | (* Magnitude function *) 304 | Magnitude[v_] := Sqrt[Grade[GeometricProduct[v,Turn[v]],0]] 305 | 306 | 307 | (* Dual function *) 308 | Dual[v_,x_?Positive] := GeometricProduct[v,Turn[Pseudoscalar[x]]] 309 | 310 | (* Dualize function. Author: Charles Gunn, 2011 *) 311 | Dualize[v_,x_?Positive] := Block[{$SetSignature = {x,0,0}}, Dual[v, x]] 312 | 313 | (* Function provided by Charles Gunn; leave it for reference 314 | (* Polarize function *) 315 | Polarize[v_,x_?Positive] := GeometricProduct[v,Turn[Pseudoscalar[x]]] 316 | Dual[v_,x_?Positive] := Polarize[v,x] *) 317 | 318 | 319 | (* Begin GARotation function *) 320 | GARotation[v_,w_,x_,angle_:Automatic] := garotation[Expand[v],Expand[w],Expand[x],angle] 321 | garotation[v_,w_,x_,angle_:Automatic] := Module[{r,theta=angle*Pi/180, 322 | plano=OuterProduct[w,x]}, 323 | If[(!HomogeneousQ[v,1]) || (!HomogeneousQ[w,1]) || (!HomogeneousQ[x,1]), 324 | Message[Clifford::messagevectors,GARotation]; $Failed, 325 | If[angle === Automatic, 326 | theta=InnerProduct[w,x]/(Magnitude[w]*Magnitude[x]); 327 | r=Sqrt[(1+theta)/2]+Sqrt[(1-theta)/2]*plano/Magnitude[plano], 328 | r=Cos[theta/2]+Sin[theta/2]*plano/Magnitude[plano]]; 329 | GeometricProduct[Turn[r],v,r] ] ] 330 | (* End of GARotation *) 331 | 332 | 333 | (* Begin MultivectorInverse function *) 334 | MultivectorInverse[v_] := Module[{v1=GeometricProduct[v,Turn[v]]}, 335 | If[v1 === Grade[v1,0], 336 | Chop[Turn[v] / Magnitude[v]^2,$SetEpsilon], 337 | Return[ StringForm["MultivectorInverse[``]", InputForm[v] ] ] 338 | ] 339 | ] 340 | (* End of MultivectorInverse *) 341 | 342 | 343 | (* PointToBasis function. Author: Charles Gunn, 2011 *) 344 | PointToBasis[vec_] := Dualize[ToBasis[vec], Length[vec]] 345 | 346 | 347 | (* Update: 03/2011 version 0.7 *) 348 | (* PointFromBasis function. Author: Charles Gunn, 2011 *) 349 | PointFromBasis[x_, n_] := ToVector[Dualize[x,n], n] 350 | 351 | 352 | (* GAProjection function *) 353 | GAProjection[v_,w_] := GeometricProduct[InnerProduct[v,w],MultivectorInverse[w]] 354 | 355 | 356 | (* Begin GAReflection function *) 357 | GAReflection[v_,w_,x_] := Module[{u,plane=OuterProduct[w,x]}, 358 | If[(!HomogeneousQ[v,1]) || (!HomogeneousQ[w,1]) || (!HomogeneousQ[x,1]), 359 | Message[Clifford::messagevectors,GAReflection]; $Failed, 360 | u=Dual[plane/Magnitude[plane],3]; 361 | (* Added by Charles Gunn, not used but left it JIC: 362 | u=Polarize[plano/Magnitude[plano],3]; *) 363 | GeometricProduct[-u,v,u] ] ] 364 | (* End of GAReflection *) 365 | 366 | (* RegressiveProduct function. Author: Charles Gunn, 2011 *) 367 | RegressiveProduct[v_, w_] := RegressiveProduct[v, w, Total[$SetSignature]] 368 | RegressiveProduct[v_, w_, x_?Positive] := Dualize[OuterProduct[Dualize[v, x], Dualize[w, x]], x] 369 | 370 | 371 | (* GARejection function *) 372 | GARejection[v_,w_] := GeometricProduct[OuterProduct[v,w],MultivectorInverse[w]] 373 | 374 | 375 | (* Begin ToBasis function *) 376 | ToBasis[x_?VectorQ] := Chop[Dot[x, List @@ e /@ Range[Length[x]]],$SetEpsilon] 377 | (* PlaneToBasis function. Author: Charles Gunn, 2011 *) 378 | (* PlaneToBasis[vec_] := ToBasis[vec] *) 379 | (* End of ToBasis *) 380 | 381 | 382 | (* Begin ToVector funtion *) 383 | ToVector[x_,d_:Automatic] := Module[{dim=d,aux,v=Expand[x]}, 384 | If[HomogeneousQ[v,1], 385 | aux=Flatten[dimensions[v]]; 386 | If[d === Automatic, dim=Max[aux]]; 387 | Table[ Coefficient[v, e[k]], {k,dim}], 388 | Message[Clifford::messagevectors,ToVector]; $Failed ] ] 389 | (* Update: 03/2011 version 0.7 *) 390 | (* PlaneFromBasis function. Author: Charles Gunn, 2011 *) 391 | (* PlaneFromBasis[x_, n_] := ToVector[x,n] *) 392 | (* End of ToVector *) 393 | 394 | (* Begin ToVectorBase function *) 395 | (* Update: 03/2011 version 0.7*) 396 | ToVectorBase[x_, W_: List] := If[(GeometricProduct @@ W - OuterProduct @@ W) == 0, 397 | Table[InnerProduct[x, W[[i]]]/GeometricProduct[W[[i]], W[[i]]], {i, Length[W]}], 398 | Print["The defined base is non-orthogonal"]] 399 | (* End of ToVector *) 400 | 401 | 402 | (* Coeff function *) 403 | Coeff[x_,y_] := Grade[Coefficient[Expand[x],y],0] 404 | 405 | 406 | (* Re function *) 407 | Re[m_] := Grade[transform[Expand[m]],0] 408 | 409 | 410 | (* Im function *) 411 | Im[x_] := {Coefficient[x,i], Coefficient[x,j], Coefficient[x,k]} 412 | 413 | 414 | (* Begin QuaternionProduct function *) 415 | QuaternionProduct[ _] := $Failed 416 | QuaternionProduct[q1_,q2_,q3__] := QuaternionProduct[QuaternionProduct[q1,q2],q3] 417 | QuaternionProduct[q1_,q2_] := untransform[ 418 | GeometricProduct[transform[q1],transform[q2]] ] 419 | (* End of QuaternionProduct *) 420 | 421 | 422 | (* QuaternionInverse function *) 423 | QuaternionInverse[q_] := untransform[MultivectorInverse[transform[Expand[q]]]] 424 | 425 | 426 | (* QuaternionMagnitude function *) 427 | QuaternionMagnitude[q_] := untransform[Magnitude[transform[Expand[q]]]] 428 | 429 | 430 | (* QuaternionConjugate function *) 431 | QuaternionConjugate[q_] := untransform[Turn[transform[Expand[q]]]] 432 | 433 | 434 | (* Begin Geometric Power Section *) 435 | GeometricPower[m_,n_Integer] := MultivectorInverse[GeometricPower[m,-n]] /; n < 0 436 | GeometricPower[m_,0] := 1 437 | GeometricPower[m_,n_Integer] := GeometricProduct[GeometricPower[m,n-1],m] /; n >= 1 438 | (* End of Geometric Power *) 439 | 440 | 441 | (* Geometric Exp function *) 442 | GeometricExp[m_,n_:10] := GeometricProductSeries[Exp,m,n] 443 | 444 | 445 | (* Geometric Sin function *) 446 | GeometricSin[m_,n_:10] := GeometricProductSeries[Sin,m,n] 447 | 448 | 449 | (* Geometric Cos function *) 450 | GeometricCos[m_,n_:10] := GeometricProductSeries[Cos,m,n] 451 | 452 | 453 | (* Geometric Tan function *) 454 | GeometricTan[m_,n_:10] := GeometricProductSeries[Tan,m,n] 455 | 456 | 457 | (* Begin Geometric Product Series function *) 458 | GeometricProductSeries[sym_Symbol,m_,n_:10] := Module[ 459 | {s=Series[sym[x],{x,0,n}],res=0,a=1}, 460 | Do[If[i != 0, a=GeometricProduct[a,m]]; 461 | res += Coefficient[s,x,i]*a, {i,0,n}]; 462 | res ] /; IntegerQ[n] && Positive[n] 463 | (* End of Geometric Product Series *) 464 | 465 | 466 | (* Begin bilinearform Section *) 467 | bilinearform[e[i_],e[i_]] := 1 /; i <= $SetSignature[[1]] 468 | bilinearform[e[i_],e[i_]] := -1 /; (i > $SetSignature[[1]]) && (i <= $SetSignature[[1]] + $SetSignature[[2]]) 469 | bilinearform[e[i_],e[i_]] := 0 /; i > $SetSignature[[1]] + $SetSignature[[2]] + $SetSignature[[3]] 470 | 471 | (* Same as Charles Gunn implementation*) 472 | (*bilinearform[e[i_],e[i_]] := 0 /; (i <= $SetSignature[[1]] + $SetSignature[[2]] + $SetSignature[[3]])*) 473 | 474 | (* Begin dimensions Section *) 475 | (*dimensions[x_] := dimensions[x] = List @@ x /. e[k_?Positive] -> k 476 | dimensions[x_Plus] := dimensions /@ List @@ x 477 | dimensions[a_] := {0} /; FreeQ[a,e[_?Positive]] 478 | dimensions[a_ x_] := dimensions[x] /; FreeQ[a,e[_?Positive]]*) 479 | 480 | dimensions[x_] := List @@ x /. e[k_?Positive] -> k 481 | dimensions[x_Plus] := dimensions /@ List @@ x 482 | dimensions[a_] := {0} /; FreeQ[a,e[_?Positive]] 483 | dimensions[a_ x_] := dimensions[x] /; FreeQ[a,e[_?Positive]] 484 | (* End of dimensions Section *) 485 | 486 | 487 | (* Begin ntuple function *) 488 | (* ntuple[x_,dim_] := ntuple[x,dim] = ReplacePart[ Table[0,{dim}], 1, List @@ x /. 489 | e[k_?Positive] -> {k}] 490 | *) 491 | ntuple[x_,dim_] := ReplacePart[ Table[0,{dim}], 1, List @@ x /. 492 | e[k_?Positive] -> {k}] 493 | (* End of ntuple *) 494 | 495 | 496 | (* transform function *) 497 | transform[x_] := x //. {i -> -e[2]e[3], j -> e[1]e[3], k -> -e[1]e[2]} 498 | 499 | 500 | (* untransform function *) 501 | untransform[x_] := x //. {e[2]e[3] -> -i, e[1]e[3] -> j, e[1]e[2] -> -k} 502 | 503 | 504 | Protect[Evaluate[protected]] (* Restore protection of the functions *) 505 | 506 | 507 | End[] (* End the Private Context *) 508 | 509 | 510 | (* Protect exported symbols *) 511 | 512 | Protect[ GeometricProduct, Grade, Turn, Magnitude, Dual, InnerProduct, 513 | OuterProduct, GARotation, MultivectorInverse, GAReflection, HomogeneousQ, 514 | GAProjection, GARejection, ToBasis, ToVector, QuaternionProduct, 515 | QuaternionInverse, QuaternionMagnitude, QuaternionConjugate, 516 | GeometricPower, GeometricProductSeries, GeometricExp, GeometricSin, 517 | GeometricCos, GeometricTan, Pseudoscalar, e, i, j, k, Coeff, GADraw, 518 | ToVectorBase, PointToBasis, PointFromBasis, RegressiveProduct, Dualize, ntuple,dimensions] 519 | 520 | 521 | EndPackage[] (* End the Package Context *) 522 | -------------------------------------------------------------------------------- /Mathematica/cliffordv07/palettev07.nb: -------------------------------------------------------------------------------- 1 | (* Content-type: application/mathematica *) 2 | 3 | (*** Wolfram Notebook File ***) 4 | (* http://www.wolfram.com/nb *) 5 | 6 | (* CreatedBy='Mathematica 7.0' *) 7 | 8 | (*CacheID: 234*) 9 | (* Internal cache information: 10 | NotebookFileLineBreakTest 11 | NotebookFileLineBreakTest 12 | NotebookDataPosition[ 145, 7] 13 | NotebookDataLength[ 25325, 617] 14 | NotebookOptionsPosition[ 24001, 570] 15 | NotebookOutlinePosition[ 24419, 587] 16 | CellTagsIndexPosition[ 24376, 584] 17 | WindowFrame->Normal*) 18 | 19 | (* Beginning of Notebook Content *) 20 | Notebook[{ 21 | 22 | Cell[CellGroupData[{ 23 | Cell["Clifford Algebra Palette (Source file)", "Title", 24 | CellChangeTimes->{{3.5090283547067747`*^9, 3.509028373072336*^9}}], 25 | 26 | Cell["\<\ 27 | Authors : 28 | \tAragon - Camarasa, G. 29 | \tAragon - Gonzalez, G. 30 | \tAragon J.L. 31 | \tRodriguez - Andrade, M.A.\ 32 | \>", "Text", 33 | CellChangeTimes->{{3.5090291799785414`*^9, 3.5090291844797964`*^9}}, 34 | FontSize->16, 35 | FontWeight->"Bold"], 36 | 37 | Cell["Version 0.7, February 2015", "Text", 38 | CellChangeTimes->{{3.509028441305402*^9, 3.509028455729059*^9}, { 39 | 3.632049057459877*^9, 3.632049060384384*^9}}, 40 | FontSize->14, 41 | FontWeight->"Bold"], 42 | 43 | Cell[CellGroupData[{ 44 | 45 | Cell["BSD License", "Section", 46 | CellChangeTimes->{{3.509028344606469*^9, 3.5090283530859146`*^9}, { 47 | 3.5090288374371243`*^9, 3.5090288399272313`*^9}}], 48 | 49 | Cell["\<\ 50 | Copyright (c) 2015, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & \ 51 | Rodriguez-Andrade, M. A. 52 | All rights reserved. 53 | 54 | Redistribution and use in source and binary forms, with or without \ 55 | modification, are permitted provided that the following conditions are met: 56 | 57 | * Redistributions of source code must retain the above copyright notice, this \ 58 | list of conditions and the following disclaimer. 59 | 60 | * Redistributions in binary form must reproduce the above copyright notice, \ 61 | this list of conditions and the following disclaimer in the documentation \ 62 | and/or other materials provided with the distribution. 63 | 64 | * Neither the name of clifford_toolbox nor the names of its contributors may \ 65 | be used to endorse or promote products derived from this software without \ 66 | specific prior written permission. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \ 69 | \[OpenCurlyDoubleQuote]AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, \ 70 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND \ 71 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE \ 72 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \ 73 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \ 74 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, \ 75 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF \ 76 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING \ 77 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \ 78 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ 79 | \>", "Text", 80 | CellGroupingRules->"NormalGrouping", 81 | CellChangeTimes->{{3.5090285070902824`*^9, 3.5090286353799443`*^9}, { 82 | 3.50902874699942*^9, 3.509028747436221*^9}, {3.632049071732759*^9, 83 | 3.632049114846643*^9}}] 84 | }, Open ]], 85 | 86 | Cell[CellGroupData[{ 87 | 88 | Cell["Definitions", "Section", 89 | CellChangeTimes->{{3.5090283175426865`*^9, 3.509028326648177*^9}, { 90 | 3.5090287896684732`*^9, 3.5090287962330894`*^9}}], 91 | 92 | Cell["Wiki Button", "Text", 93 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, { 94 | 3.5090282946209984`*^9, 3.5090283008225813`*^9}}, 95 | FontSize->24], 96 | 97 | Cell[BoxData[ 98 | RowBox[{ 99 | RowBox[{"helpBLarge", "=", 100 | RowBox[{"Button", "[", 101 | RowBox[{ 102 | RowBox[{"Style", "[", 103 | RowBox[{"\"\\"", ",", "\"\\""}], 104 | "]"}], ",", 105 | RowBox[{"NotebookLocate", "[", 106 | RowBox[{"{", 107 | RowBox[{ 108 | RowBox[{ 109 | "URL", "[", "\"\\"", 110 | "]"}], ",", "None"}], "}"}], "]"}], ",", 111 | RowBox[{"Appearance", "\[Rule]", "None"}], ",", 112 | RowBox[{"ImageSize", "\[Rule]", 113 | RowBox[{"{", 114 | RowBox[{"360", ",", "25"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 115 | InitializationCell->True, 116 | CellChangeTimes->{{3.5090240361286554`*^9, 3.509024042446495*^9}, { 117 | 3.50902413304519*^9, 3.5090242012820272`*^9}, {3.509024239046291*^9, 118 | 3.5090242427130866`*^9}, {3.509024326426508*^9, 3.509024354969675*^9}, { 119 | 3.50902439602954*^9, 3.5090244276423483`*^9}, 3.509024572232905*^9, { 120 | 3.5090257168716817`*^9, 3.509025723981864*^9}, {3.5090280224890995`*^9, 121 | 3.509028115449463*^9}, {3.509028180257367*^9, 3.5090281806143875`*^9}, { 122 | 3.509028304268446*^9, 3.509028304678452*^9}, {3.6320491300669107`*^9, 123 | 3.632049134655615*^9}, {3.632049254972259*^9, 3.632049260207377*^9}, { 124 | 3.632049399568049*^9, 3.632049419784198*^9}, {3.63204945232622*^9, 125 | 3.6320494548519278`*^9}}], 126 | 127 | Cell["Basic Operations", "Text", 128 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}}, 129 | FontSize->24], 130 | 131 | Cell[BoxData[{ 132 | RowBox[{ 133 | RowBox[{"basicOp1", "=", 134 | RowBox[{"Grid", "[", 135 | RowBox[{ 136 | RowBox[{"Partition", "[", 137 | RowBox[{ 138 | RowBox[{ 139 | RowBox[{ 140 | RowBox[{"PasteButton", "[", 141 | RowBox[{ 142 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 143 | RowBox[{"ImageSize", "\[Rule]", 144 | RowBox[{"{", 145 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 146 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 147 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 148 | RowBox[{"{", 149 | RowBox[{ 150 | "\"\\"", ",", "\[IndentingNewLine]", 151 | "\"\\"", ",", 152 | "\[IndentingNewLine]", 153 | "\"\<$SetSignature={\[SelectionPlaceholder],\[Placeholder],\ 154 | \[Placeholder]}\>\"", ",", "\[IndentingNewLine]", 155 | "\"\<$SetEpsilon=\[SelectionPlaceholder]\>\"", ",", 156 | "\[IndentingNewLine]", "\"\\"", 157 | ",", "\[IndentingNewLine]", 158 | "\"\\""}], 159 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 160 | RowBox[{"Spacings", "\[Rule]", 161 | RowBox[{"{", 162 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], 163 | ";"}], "\[IndentingNewLine]", 164 | RowBox[{ 165 | RowBox[{"basicOp2", "=", 166 | RowBox[{"Grid", "[", 167 | RowBox[{ 168 | RowBox[{"Partition", "[", 169 | RowBox[{ 170 | RowBox[{ 171 | RowBox[{ 172 | RowBox[{"PasteButton", "[", 173 | RowBox[{ 174 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 175 | RowBox[{"ImageSize", "\[Rule]", 176 | RowBox[{"{", 177 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 178 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 179 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 180 | RowBox[{"{", 181 | RowBox[{ 182 | "\"\\"", ",", 183 | "\[IndentingNewLine]", 184 | "\"\\"", ",", 185 | "\[IndentingNewLine]", 186 | "\"\\"", ",", "\[IndentingNewLine]", 188 | "\"\\"", ",", "\[IndentingNewLine]", 190 | "\"\\"", ",", "\[IndentingNewLine]", 192 | "\"\\"", ",", "\[IndentingNewLine]", 194 | "\"\\"", ",", 195 | "\[IndentingNewLine]", 196 | "\"\\"", 197 | ",", "\[IndentingNewLine]", 198 | "\"\\"", ",", 199 | "\[IndentingNewLine]", "\"\\"", 200 | ",", "\[IndentingNewLine]", 201 | "\"\\"", ",", 202 | "\[IndentingNewLine]", 203 | "\"\\""}], 204 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 205 | RowBox[{"Spacings", "\[Rule]", 206 | RowBox[{"{", 207 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], 208 | ";"}], "\[IndentingNewLine]", 209 | RowBox[{ 210 | RowBox[{"basicOp3", "=", 211 | RowBox[{"PasteButton", "[", 212 | RowBox[{ 213 | RowBox[{ 214 | "RawBoxes", "[", "\"\\"", "]"}], ",", 215 | RowBox[{"ImageSize", "\[Rule]", 216 | RowBox[{"{", 217 | RowBox[{"340", ",", "25"}], "}"}]}], ",", 218 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], 219 | ";"}]}], "Input", 220 | InitializationCell->True, 221 | CellChangeTimes->{{3.5090211462733984`*^9, 3.5090211793922567`*^9}, { 222 | 3.509021432333808*^9, 3.5090215184507055`*^9}, {3.5090215485587587`*^9, 223 | 3.5090216076204624`*^9}, {3.509021848672086*^9, 3.5090218773449364`*^9}, { 224 | 3.5090219102141943`*^9, 3.509021956249875*^9}, {3.5090220073272843`*^9, 225 | 3.5090220990554457`*^9}, {3.5090222246572685`*^9, 226 | 3.5090222285372734`*^9}, {3.509022288614891*^9, 3.5090223407310886`*^9}, { 227 | 3.5090223747722178`*^9, 3.5090224066022625`*^9}, {3.509022452172326*^9, 228 | 3.5090225827053337`*^9}, {3.509022921028147*^9, 3.509022976903093*^9}, { 229 | 3.509023037735486*^9, 3.5090231793718977`*^9}, {3.509023219744157*^9, 230 | 3.509023257164027*^9}, {3.509023364967755*^9, 3.509023435969165*^9}, { 231 | 3.5090234879539003`*^9, 3.5090235439032125`*^9}, 3.50902437462254*^9, { 232 | 3.509024470056774*^9, 3.509024472986942*^9}, {3.5090279444947615`*^9, 233 | 3.509027955578396*^9}, {3.509028220032152*^9, 3.509028226171136*^9}, { 234 | 3.6320491443272257`*^9, 3.632049152379724*^9}, {3.632049222839354*^9, 235 | 3.632049238315546*^9}, {3.6320493701860857`*^9, 3.6320493705175753`*^9}, { 236 | 3.6320494574276457`*^9, 3.6320494615564003`*^9}}], 237 | 238 | Cell["Geometric Transformations", "Text", 239 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, { 240 | 3.5090213765470715`*^9, 3.5090213903530955`*^9}}, 241 | FontSize->24], 242 | 243 | Cell[BoxData[ 244 | RowBox[{ 245 | RowBox[{"geomOp", "=", 246 | RowBox[{"Grid", "[", 247 | RowBox[{ 248 | RowBox[{"Partition", "[", 249 | RowBox[{ 250 | RowBox[{ 251 | RowBox[{ 252 | RowBox[{"PasteButton", "[", 253 | RowBox[{ 254 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 255 | RowBox[{"ImageSize", "\[Rule]", 256 | RowBox[{"{", 257 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 258 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 259 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 260 | RowBox[{"{", 261 | RowBox[{ 262 | "\"\\"", ",", "\[IndentingNewLine]", 264 | "\"\\"", ",", "\[IndentingNewLine]", 266 | "\"\\"", 267 | ",", "\[IndentingNewLine]", 268 | "\"\\"", ",", 269 | "\[IndentingNewLine]", 270 | "\"\\"", ",", 271 | "\[IndentingNewLine]", 272 | "\"\\"", ",", 273 | "\[IndentingNewLine]", 274 | "\"\\"", 275 | ",", "\[IndentingNewLine]", 276 | "\"\\""}], 277 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 278 | RowBox[{"Spacings", "\[Rule]", 279 | RowBox[{"{", 280 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 281 | InitializationCell->True, 282 | CellChangeTimes->{ 283 | 3.5090214113819323`*^9, {3.509023608025073*^9, 3.5090238154764853`*^9}, { 284 | 3.509024018961162*^9, 3.5090240235541143`*^9}, 3.509024474653037*^9, { 285 | 3.632049248086742*^9, 3.632049248402977*^9}, 3.6320494635999117`*^9}], 286 | 287 | Cell["Quaternions", "Text", 288 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, 289 | 3.509021379947877*^9}, 290 | FontSize->24], 291 | 292 | Cell[BoxData[{ 293 | RowBox[{ 294 | RowBox[{"quatOp1", "=", 295 | RowBox[{"Grid", "[", 296 | RowBox[{ 297 | RowBox[{"Partition", "[", 298 | RowBox[{ 299 | RowBox[{ 300 | RowBox[{ 301 | RowBox[{"PasteButton", "[", 302 | RowBox[{ 303 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 304 | RowBox[{"ImageSize", "\[Rule]", 305 | RowBox[{"{", 306 | RowBox[{ 307 | RowBox[{"170", "/", "3"}], ",", "25"}], "}"}]}], ",", 308 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 309 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 310 | RowBox[{"{", 311 | RowBox[{ 312 | "\"\\"", ",", "\[IndentingNewLine]", "\"\\"", ",", 313 | "\[IndentingNewLine]", "\"\\""}], "\[IndentingNewLine]", 314 | "}"}]}], ",", "3"}], "]"}], ",", 315 | RowBox[{"Spacings", "\[Rule]", 316 | RowBox[{"{", 317 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], 318 | ";"}], "\[IndentingNewLine]", 319 | RowBox[{ 320 | RowBox[{"quatOp2", "=", 321 | RowBox[{"Grid", "[", 322 | RowBox[{ 323 | RowBox[{"Partition", "[", 324 | RowBox[{ 325 | RowBox[{ 326 | RowBox[{ 327 | RowBox[{"PasteButton", "[", 328 | RowBox[{ 329 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 330 | RowBox[{"ImageSize", "\[Rule]", 331 | RowBox[{"{", 332 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 333 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 334 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 335 | RowBox[{"{", 336 | RowBox[{ 337 | "\"\\"", 338 | ",", "\[IndentingNewLine]", 339 | "\"\\"", ",", 340 | "\[IndentingNewLine]", 341 | "\"\\"", ",", 342 | "\[IndentingNewLine]", 343 | "\"\\""}], 344 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 345 | RowBox[{"Spacings", "\[Rule]", 346 | RowBox[{"{", 347 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], ";"}]}], "Input", 348 | InitializationCell->True, 349 | CellChangeTimes->{ 350 | 3.5090214188387456`*^9, {3.5090249945463247`*^9, 3.509025044743471*^9}, { 351 | 3.509025110699088*^9, 3.5090252233172526`*^9}, {3.509025261592131*^9, 352 | 3.5090252618221445`*^9}, {3.5090252949932137`*^9, 3.509025315745573*^9}, 353 | 3.509025371780881*^9, {3.6320492684480658`*^9, 3.632049273314521*^9}, { 354 | 3.632049468190134*^9, 3.632049470440692*^9}, {3.632049509071879*^9, 355 | 3.632049517814117*^9}}], 356 | 357 | Cell["Special", "Text", 358 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, 359 | 3.509021385017886*^9}, 360 | FontSize->24], 361 | 362 | Cell[BoxData[ 363 | RowBox[{ 364 | RowBox[{"specialOp", "=", 365 | RowBox[{"Column", "[", 366 | RowBox[{ 367 | RowBox[{ 368 | RowBox[{ 369 | RowBox[{"PasteButton", "[", 370 | RowBox[{ 371 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 372 | RowBox[{"ImageSize", "\[Rule]", 373 | RowBox[{"{", 374 | RowBox[{"340", ",", "25"}], "}"}]}], ",", 375 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}], 376 | "&"}], "/@", "\[IndentingNewLine]", 377 | RowBox[{"{", 378 | RowBox[{ 379 | "\"\\"", ",", 380 | "\[IndentingNewLine]", 381 | "\"\\"", ",", 382 | "\[IndentingNewLine]", 383 | "\"\\"", ",", 384 | "\[IndentingNewLine]", 385 | "\"\\"", ",", 386 | "\[IndentingNewLine]", 387 | "\"\\"", ",", 388 | "\[IndentingNewLine]", 389 | "\"\\""}], 390 | "\[IndentingNewLine]", "}"}]}], ",", "Center", ",", 391 | RowBox[{"Spacings", "\[Rule]", 392 | RowBox[{"{", 393 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 394 | InitializationCell->True, 395 | CellChangeTimes->{ 396 | 3.509021421833951*^9, {3.5090253814730043`*^9, 3.5090254820013185`*^9}, { 397 | 3.5090256747435827`*^9, 3.5090256783533754`*^9}, {3.632049275133497*^9, 398 | 3.632049280948473*^9}, {3.632049472964512*^9, 3.632049474278183*^9}}] 399 | }, Open ]], 400 | 401 | Cell[CellGroupData[{ 402 | 403 | Cell["Create Palette", "Section", 404 | CellChangeTimes->{{3.5090212943817267`*^9, 3.509021302337741*^9}, { 405 | 3.5090258189304667`*^9, 3.5090258300364637`*^9}, {3.5090282666999593`*^9, 406 | 3.50902826701196*^9}}], 407 | 408 | Cell[BoxData[ 409 | RowBox[{ 410 | RowBox[{"CreatePalette", "[", 411 | RowBox[{ 412 | RowBox[{"{", "\[IndentingNewLine]", 413 | RowBox[{ 414 | RowBox[{"Button", "[", 415 | RowBox[{ 416 | RowBox[{"Style", "[", 417 | RowBox[{"\"\\"", ",", "20", ",", "Bold"}], "]"}], 418 | ",", 419 | RowBox[{"Appearance", "\[Rule]", "None"}], ",", 420 | RowBox[{"ImageSize", "\[Rule]", 421 | RowBox[{"{", 422 | RowBox[{"340", ",", "30"}], "}"}]}]}], "]"}], ",", 423 | "\[IndentingNewLine]", 424 | RowBox[{"DynamicModule", "[", 425 | RowBox[{ 426 | RowBox[{"{", 427 | RowBox[{ 428 | RowBox[{"opener1", "=", "True"}], ",", 429 | RowBox[{"opener2", "=", "False"}], ",", 430 | RowBox[{"opener3", "=", "False"}], ",", 431 | RowBox[{"opener4", "=", "False"}]}], "}"}], ",", 432 | "\[IndentingNewLine]", 433 | RowBox[{"Column", "[", 434 | RowBox[{"{", "\[IndentingNewLine]", 435 | RowBox[{ 436 | RowBox[{"OpenerView", "[", 437 | RowBox[{ 438 | RowBox[{"{", 439 | RowBox[{ 440 | RowBox[{"Style", "[", 441 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 442 | "\[IndentingNewLine]", 443 | RowBox[{"Column", "[", 444 | RowBox[{ 445 | RowBox[{"{", 446 | RowBox[{ 447 | RowBox[{"Style", "[", 448 | RowBox[{ 449 | "\"\\"", ",", "11", ",", "Bold"}], 450 | "]"}], ",", "basicOp1", ",", 451 | RowBox[{"Style", "[", 452 | RowBox[{"\"\\"", ",", "11", ",", "Bold"}], 453 | "]"}], ",", "basicOp2", ",", 454 | RowBox[{"Style", "[", 455 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], "]"}], 456 | ",", "basicOp3"}], "}"}], ",", 457 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 458 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 459 | RowBox[{"Dynamic", "[", 460 | RowBox[{"opener1", ",", 461 | RowBox[{ 462 | RowBox[{"(", 463 | RowBox[{ 464 | RowBox[{"opener1", "=", "True"}], ";", 465 | RowBox[{"opener2", "=", "False"}], ";", 466 | RowBox[{"opener3", "=", "False"}], ";", 467 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 468 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 469 | RowBox[{"OpenerView", "[", 470 | RowBox[{ 471 | RowBox[{"{", 472 | RowBox[{ 473 | RowBox[{"Style", "[", 474 | RowBox[{"\"\\"", ",", "15"}], 475 | "]"}], ",", "\[IndentingNewLine]", 476 | RowBox[{"Column", "[", 477 | RowBox[{ 478 | RowBox[{"{", 479 | RowBox[{ 480 | RowBox[{"Style", "[", 481 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 482 | "]"}], ",", "geomOp"}], "}"}], ",", 483 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 484 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 485 | RowBox[{"Dynamic", "[", 486 | RowBox[{"opener2", ",", 487 | RowBox[{ 488 | RowBox[{"(", 489 | RowBox[{ 490 | RowBox[{"opener2", "=", "#"}], ";", 491 | RowBox[{"opener1", "=", "True"}], ";", 492 | RowBox[{"opener3", "=", "False"}], ";", 493 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 494 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 495 | RowBox[{"OpenerView", "[", 496 | RowBox[{ 497 | RowBox[{"{", 498 | RowBox[{ 499 | RowBox[{"Style", "[", 500 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 501 | "\[IndentingNewLine]", 502 | RowBox[{"Column", "[", 503 | RowBox[{ 504 | RowBox[{"{", 505 | RowBox[{ 506 | RowBox[{"Style", "[", 507 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 508 | "]"}], ",", "quatOp1", ",", 509 | RowBox[{"Style", "[", 510 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 511 | "]"}], ",", "quatOp2"}], "}"}], ",", 512 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 513 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 514 | RowBox[{"Dynamic", "[", 515 | RowBox[{"opener3", ",", 516 | RowBox[{ 517 | RowBox[{"(", 518 | RowBox[{ 519 | RowBox[{"opener3", "=", "#"}], ";", 520 | RowBox[{"opener1", "=", "True"}], ";", 521 | RowBox[{"opener2", "=", "False"}], ";", 522 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 523 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 524 | RowBox[{"OpenerView", "[", 525 | RowBox[{ 526 | RowBox[{"{", 527 | RowBox[{ 528 | RowBox[{"Style", "[", 529 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 530 | "\[IndentingNewLine]", 531 | RowBox[{"Column", "[", 532 | RowBox[{ 533 | RowBox[{"{", 534 | RowBox[{ 535 | RowBox[{"Style", "[", 536 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 537 | "]"}], ",", "specialOp"}], "}"}], ",", 538 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 539 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 540 | RowBox[{"Dynamic", "[", 541 | RowBox[{"opener4", ",", 542 | RowBox[{ 543 | RowBox[{"(", 544 | RowBox[{ 545 | RowBox[{"opener4", "=", "#"}], ";", 546 | RowBox[{"opener1", "=", "True"}], ";", 547 | RowBox[{"opener2", "=", "False"}], ";", 548 | RowBox[{"opener3", "=", "False"}]}], ")"}], "&"}]}], 549 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", "helpBLarge"}], 550 | "\[IndentingNewLine]", "}"}], "]"}]}], "\[IndentingNewLine]", 551 | "]"}]}], "\[IndentingNewLine]", "}"}], ",", 552 | RowBox[{"WindowTitle", "\[Rule]", "\"\\""}], ",", 553 | RowBox[{"WindowSize", "\[Rule]", "All"}]}], "]"}], ";"}]], "Input", 554 | InitializationCell->True, 555 | CellChangeTimes->{{3.509025835209553*^9, 3.509025913416439*^9}, { 556 | 3.509025948059537*^9, 3.509026159064742*^9}, {3.509026231608511*^9, 557 | 3.509026249207259*^9}, {3.509026280860793*^9, 3.5090263245201826`*^9}, { 558 | 3.509026358930064*^9, 3.5090263770560665`*^9}, {3.509026473827566*^9, 559 | 3.509026564563169*^9}, {3.5090266014557962`*^9, 3.5090266473873196`*^9}, { 560 | 3.509026748753461*^9, 3.509026762369809*^9}, {3.5090269392354755`*^9, 561 | 3.5090270048060703`*^9}, {3.5090270451158752`*^9, 3.5090270522648706`*^9}, { 562 | 3.509027446998807*^9, 3.509027447262822*^9}, {3.509027541175969*^9, 563 | 3.509027544251334*^9}, {3.5090275779089837`*^9, 3.5090276524432807`*^9}, { 564 | 3.509027685252898*^9, 3.509027756524858*^9}, {3.5090279799637456`*^9, 565 | 3.5090280009409065`*^9}, {3.5090281367684155`*^9, 3.509028164064642*^9}, { 566 | 3.5090293239766045`*^9, 3.509029325155672*^9}, {3.509029399765939*^9, 567 | 3.5090294213541737`*^9}}] 568 | }, Open ]] 569 | }, Open ]] 570 | }, 571 | WindowSize->{1052, 564}, 572 | WindowMargins->{{23, Automatic}, {106, Automatic}}, 573 | FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (June 27, \ 574 | 2014)", 575 | StyleDefinitions->FrontEnd`FileName[{"Utility"}, "Memo.nb", CharacterEncoding -> 576 | "UTF-8"] 577 | ] 578 | (* End of Notebook Content *) 579 | 580 | (* Internal cache information *) 581 | (*CellTagsOutline 582 | CellTagsIndex->{} 583 | *) 584 | (*CellTagsIndex 585 | CellTagsIndex->{} 586 | *) 587 | (*NotebookFileOutline 588 | Notebook[{ 589 | Cell[CellGroupData[{ 590 | Cell[567, 22, 123, 1, 92, "Title"], 591 | Cell[693, 25, 239, 9, 139, "Text"], 592 | Cell[935, 36, 193, 4, 32, "Text"], 593 | Cell[CellGroupData[{ 594 | Cell[1153, 44, 151, 2, 55, "Section"], 595 | Cell[1307, 48, 1828, 34, 408, "Text", 596 | CellGroupingRules->"NormalGrouping"] 597 | }, Open ]], 598 | Cell[CellGroupData[{ 599 | Cell[3172, 87, 151, 2, 55, "Section"], 600 | Cell[3326, 91, 165, 3, 45, "Text"], 601 | Cell[3494, 96, 1337, 28, 104, "Input", 602 | InitializationCell->True], 603 | Cell[4834, 126, 117, 2, 45, "Text"], 604 | Cell[4954, 130, 4955, 105, 403, "Input", 605 | InitializationCell->True], 606 | Cell[9912, 237, 179, 3, 45, "Text"], 607 | Cell[10094, 242, 1925, 42, 182, "Input", 608 | InitializationCell->True], 609 | Cell[12022, 286, 138, 3, 45, "Text"], 610 | Cell[12163, 291, 2536, 63, 199, "Input", 611 | InitializationCell->True], 612 | Cell[14702, 356, 134, 3, 45, "Text"], 613 | Cell[14839, 361, 1525, 36, 148, "Input", 614 | InitializationCell->True] 615 | }, Open ]], 616 | Cell[CellGroupData[{ 617 | Cell[16401, 402, 204, 3, 55, "Section"], 618 | Cell[16608, 407, 7365, 159, 437, "Input", 619 | InitializationCell->True] 620 | }, Open ]] 621 | }, Open ]] 622 | } 623 | ] 624 | *) 625 | 626 | (* End of internal cache information *) 627 | -------------------------------------------------------------------------------- /Mathematica/cliffordv07/palettev07_src.nb: -------------------------------------------------------------------------------- 1 | (* Content-type: application/mathematica *) 2 | 3 | (*** Wolfram Notebook File ***) 4 | (* http://www.wolfram.com/nb *) 5 | 6 | (* CreatedBy='Mathematica 7.0' *) 7 | 8 | (*CacheID: 234*) 9 | (* Internal cache information: 10 | NotebookFileLineBreakTest 11 | NotebookFileLineBreakTest 12 | NotebookDataPosition[ 145, 7] 13 | NotebookDataLength[ 25325, 617] 14 | NotebookOptionsPosition[ 24001, 570] 15 | NotebookOutlinePosition[ 24419, 587] 16 | CellTagsIndexPosition[ 24376, 584] 17 | WindowFrame->Normal*) 18 | 19 | (* Beginning of Notebook Content *) 20 | Notebook[{ 21 | 22 | Cell[CellGroupData[{ 23 | Cell["Clifford Algebra Palette (Source file)", "Title", 24 | CellChangeTimes->{{3.5090283547067747`*^9, 3.509028373072336*^9}}], 25 | 26 | Cell["\<\ 27 | Authors : 28 | \tAragon - Camarasa, G. 29 | \tAragon - Gonzalez, G. 30 | \tAragon J.L. 31 | \tRodriguez - Andrade, M.A.\ 32 | \>", "Text", 33 | CellChangeTimes->{{3.5090291799785414`*^9, 3.5090291844797964`*^9}}, 34 | FontSize->16, 35 | FontWeight->"Bold"], 36 | 37 | Cell["Version 0.7, February 2015", "Text", 38 | CellChangeTimes->{{3.509028441305402*^9, 3.509028455729059*^9}, { 39 | 3.632049057459877*^9, 3.632049060384384*^9}}, 40 | FontSize->14, 41 | FontWeight->"Bold"], 42 | 43 | Cell[CellGroupData[{ 44 | 45 | Cell["BSD License", "Section", 46 | CellChangeTimes->{{3.509028344606469*^9, 3.5090283530859146`*^9}, { 47 | 3.5090288374371243`*^9, 3.5090288399272313`*^9}}], 48 | 49 | Cell["\<\ 50 | Copyright (c) 2015, Aragon-Camarasa, G., Aragon-Gonzalez, G.; Aragon J. L. & \ 51 | Rodriguez-Andrade, M. A. 52 | All rights reserved. 53 | 54 | Redistribution and use in source and binary forms, with or without \ 55 | modification, are permitted provided that the following conditions are met: 56 | 57 | * Redistributions of source code must retain the above copyright notice, this \ 58 | list of conditions and the following disclaimer. 59 | 60 | * Redistributions in binary form must reproduce the above copyright notice, \ 61 | this list of conditions and the following disclaimer in the documentation \ 62 | and/or other materials provided with the distribution. 63 | 64 | * Neither the name of clifford_toolbox nor the names of its contributors may \ 65 | be used to endorse or promote products derived from this software without \ 66 | specific prior written permission. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \ 69 | \[OpenCurlyDoubleQuote]AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, \ 70 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND \ 71 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE \ 72 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \ 73 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \ 74 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, \ 75 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF \ 76 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING \ 77 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \ 78 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ 79 | \>", "Text", 80 | CellGroupingRules->"NormalGrouping", 81 | CellChangeTimes->{{3.5090285070902824`*^9, 3.5090286353799443`*^9}, { 82 | 3.50902874699942*^9, 3.509028747436221*^9}, {3.632049071732759*^9, 83 | 3.632049114846643*^9}}] 84 | }, Open ]], 85 | 86 | Cell[CellGroupData[{ 87 | 88 | Cell["Definitions", "Section", 89 | CellChangeTimes->{{3.5090283175426865`*^9, 3.509028326648177*^9}, { 90 | 3.5090287896684732`*^9, 3.5090287962330894`*^9}}], 91 | 92 | Cell["Wiki Button", "Text", 93 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, { 94 | 3.5090282946209984`*^9, 3.5090283008225813`*^9}}, 95 | FontSize->24], 96 | 97 | Cell[BoxData[ 98 | RowBox[{ 99 | RowBox[{"helpBLarge", "=", 100 | RowBox[{"Button", "[", 101 | RowBox[{ 102 | RowBox[{"Style", "[", 103 | RowBox[{"\"\\"", ",", "\"\\""}], 104 | "]"}], ",", 105 | RowBox[{"NotebookLocate", "[", 106 | RowBox[{"{", 107 | RowBox[{ 108 | RowBox[{ 109 | "URL", "[", "\"\\"", 110 | "]"}], ",", "None"}], "}"}], "]"}], ",", 111 | RowBox[{"Appearance", "\[Rule]", "None"}], ",", 112 | RowBox[{"ImageSize", "\[Rule]", 113 | RowBox[{"{", 114 | RowBox[{"360", ",", "25"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 115 | InitializationCell->True, 116 | CellChangeTimes->{{3.5090240361286554`*^9, 3.509024042446495*^9}, { 117 | 3.50902413304519*^9, 3.5090242012820272`*^9}, {3.509024239046291*^9, 118 | 3.5090242427130866`*^9}, {3.509024326426508*^9, 3.509024354969675*^9}, { 119 | 3.50902439602954*^9, 3.5090244276423483`*^9}, 3.509024572232905*^9, { 120 | 3.5090257168716817`*^9, 3.509025723981864*^9}, {3.5090280224890995`*^9, 121 | 3.509028115449463*^9}, {3.509028180257367*^9, 3.5090281806143875`*^9}, { 122 | 3.509028304268446*^9, 3.509028304678452*^9}, {3.6320491300669107`*^9, 123 | 3.632049134655615*^9}, {3.632049254972259*^9, 3.632049260207377*^9}, { 124 | 3.632049399568049*^9, 3.632049419784198*^9}, {3.63204945232622*^9, 125 | 3.6320494548519278`*^9}}], 126 | 127 | Cell["Basic Operations", "Text", 128 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}}, 129 | FontSize->24], 130 | 131 | Cell[BoxData[{ 132 | RowBox[{ 133 | RowBox[{"basicOp1", "=", 134 | RowBox[{"Grid", "[", 135 | RowBox[{ 136 | RowBox[{"Partition", "[", 137 | RowBox[{ 138 | RowBox[{ 139 | RowBox[{ 140 | RowBox[{"PasteButton", "[", 141 | RowBox[{ 142 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 143 | RowBox[{"ImageSize", "\[Rule]", 144 | RowBox[{"{", 145 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 146 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 147 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 148 | RowBox[{"{", 149 | RowBox[{ 150 | "\"\\"", ",", "\[IndentingNewLine]", 151 | "\"\\"", ",", 152 | "\[IndentingNewLine]", 153 | "\"\<$SetSignature={\[SelectionPlaceholder],\[Placeholder],\ 154 | \[Placeholder]}\>\"", ",", "\[IndentingNewLine]", 155 | "\"\<$SetEpsilon=\[SelectionPlaceholder]\>\"", ",", 156 | "\[IndentingNewLine]", "\"\\"", 157 | ",", "\[IndentingNewLine]", 158 | "\"\\""}], 159 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 160 | RowBox[{"Spacings", "\[Rule]", 161 | RowBox[{"{", 162 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], 163 | ";"}], "\[IndentingNewLine]", 164 | RowBox[{ 165 | RowBox[{"basicOp2", "=", 166 | RowBox[{"Grid", "[", 167 | RowBox[{ 168 | RowBox[{"Partition", "[", 169 | RowBox[{ 170 | RowBox[{ 171 | RowBox[{ 172 | RowBox[{"PasteButton", "[", 173 | RowBox[{ 174 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 175 | RowBox[{"ImageSize", "\[Rule]", 176 | RowBox[{"{", 177 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 178 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 179 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 180 | RowBox[{"{", 181 | RowBox[{ 182 | "\"\\"", ",", 183 | "\[IndentingNewLine]", 184 | "\"\\"", ",", 185 | "\[IndentingNewLine]", 186 | "\"\\"", ",", "\[IndentingNewLine]", 188 | "\"\\"", ",", "\[IndentingNewLine]", 190 | "\"\\"", ",", "\[IndentingNewLine]", 192 | "\"\\"", ",", "\[IndentingNewLine]", 194 | "\"\\"", ",", 195 | "\[IndentingNewLine]", 196 | "\"\\"", 197 | ",", "\[IndentingNewLine]", 198 | "\"\\"", ",", 199 | "\[IndentingNewLine]", "\"\\"", 200 | ",", "\[IndentingNewLine]", 201 | "\"\\"", ",", 202 | "\[IndentingNewLine]", 203 | "\"\\""}], 204 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 205 | RowBox[{"Spacings", "\[Rule]", 206 | RowBox[{"{", 207 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], 208 | ";"}], "\[IndentingNewLine]", 209 | RowBox[{ 210 | RowBox[{"basicOp3", "=", 211 | RowBox[{"PasteButton", "[", 212 | RowBox[{ 213 | RowBox[{ 214 | "RawBoxes", "[", "\"\\"", "]"}], ",", 215 | RowBox[{"ImageSize", "\[Rule]", 216 | RowBox[{"{", 217 | RowBox[{"340", ",", "25"}], "}"}]}], ",", 218 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], 219 | ";"}]}], "Input", 220 | InitializationCell->True, 221 | CellChangeTimes->{{3.5090211462733984`*^9, 3.5090211793922567`*^9}, { 222 | 3.509021432333808*^9, 3.5090215184507055`*^9}, {3.5090215485587587`*^9, 223 | 3.5090216076204624`*^9}, {3.509021848672086*^9, 3.5090218773449364`*^9}, { 224 | 3.5090219102141943`*^9, 3.509021956249875*^9}, {3.5090220073272843`*^9, 225 | 3.5090220990554457`*^9}, {3.5090222246572685`*^9, 226 | 3.5090222285372734`*^9}, {3.509022288614891*^9, 3.5090223407310886`*^9}, { 227 | 3.5090223747722178`*^9, 3.5090224066022625`*^9}, {3.509022452172326*^9, 228 | 3.5090225827053337`*^9}, {3.509022921028147*^9, 3.509022976903093*^9}, { 229 | 3.509023037735486*^9, 3.5090231793718977`*^9}, {3.509023219744157*^9, 230 | 3.509023257164027*^9}, {3.509023364967755*^9, 3.509023435969165*^9}, { 231 | 3.5090234879539003`*^9, 3.5090235439032125`*^9}, 3.50902437462254*^9, { 232 | 3.509024470056774*^9, 3.509024472986942*^9}, {3.5090279444947615`*^9, 233 | 3.509027955578396*^9}, {3.509028220032152*^9, 3.509028226171136*^9}, { 234 | 3.6320491443272257`*^9, 3.632049152379724*^9}, {3.632049222839354*^9, 235 | 3.632049238315546*^9}, {3.6320493701860857`*^9, 3.6320493705175753`*^9}, { 236 | 3.6320494574276457`*^9, 3.6320494615564003`*^9}}], 237 | 238 | Cell["Geometric Transformations", "Text", 239 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, { 240 | 3.5090213765470715`*^9, 3.5090213903530955`*^9}}, 241 | FontSize->24], 242 | 243 | Cell[BoxData[ 244 | RowBox[{ 245 | RowBox[{"geomOp", "=", 246 | RowBox[{"Grid", "[", 247 | RowBox[{ 248 | RowBox[{"Partition", "[", 249 | RowBox[{ 250 | RowBox[{ 251 | RowBox[{ 252 | RowBox[{"PasteButton", "[", 253 | RowBox[{ 254 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 255 | RowBox[{"ImageSize", "\[Rule]", 256 | RowBox[{"{", 257 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 258 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 259 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 260 | RowBox[{"{", 261 | RowBox[{ 262 | "\"\\"", ",", "\[IndentingNewLine]", 264 | "\"\\"", ",", "\[IndentingNewLine]", 266 | "\"\\"", 267 | ",", "\[IndentingNewLine]", 268 | "\"\\"", ",", 269 | "\[IndentingNewLine]", 270 | "\"\\"", ",", 271 | "\[IndentingNewLine]", 272 | "\"\\"", ",", 273 | "\[IndentingNewLine]", 274 | "\"\\"", 275 | ",", "\[IndentingNewLine]", 276 | "\"\\""}], 277 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 278 | RowBox[{"Spacings", "\[Rule]", 279 | RowBox[{"{", 280 | RowBox[{"0.1", ",", "0.1"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 281 | InitializationCell->True, 282 | CellChangeTimes->{ 283 | 3.5090214113819323`*^9, {3.509023608025073*^9, 3.5090238154764853`*^9}, { 284 | 3.509024018961162*^9, 3.5090240235541143`*^9}, 3.509024474653037*^9, { 285 | 3.632049248086742*^9, 3.632049248402977*^9}, 3.6320494635999117`*^9}], 286 | 287 | Cell["Quaternions", "Text", 288 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, 289 | 3.509021379947877*^9}, 290 | FontSize->24], 291 | 292 | Cell[BoxData[{ 293 | RowBox[{ 294 | RowBox[{"quatOp1", "=", 295 | RowBox[{"Grid", "[", 296 | RowBox[{ 297 | RowBox[{"Partition", "[", 298 | RowBox[{ 299 | RowBox[{ 300 | RowBox[{ 301 | RowBox[{"PasteButton", "[", 302 | RowBox[{ 303 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 304 | RowBox[{"ImageSize", "\[Rule]", 305 | RowBox[{"{", 306 | RowBox[{ 307 | RowBox[{"170", "/", "3"}], ",", "25"}], "}"}]}], ",", 308 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 309 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 310 | RowBox[{"{", 311 | RowBox[{ 312 | "\"\\"", ",", "\[IndentingNewLine]", "\"\\"", ",", 313 | "\[IndentingNewLine]", "\"\\""}], "\[IndentingNewLine]", 314 | "}"}]}], ",", "3"}], "]"}], ",", 315 | RowBox[{"Spacings", "\[Rule]", 316 | RowBox[{"{", 317 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], 318 | ";"}], "\[IndentingNewLine]", 319 | RowBox[{ 320 | RowBox[{"quatOp2", "=", 321 | RowBox[{"Grid", "[", 322 | RowBox[{ 323 | RowBox[{"Partition", "[", 324 | RowBox[{ 325 | RowBox[{ 326 | RowBox[{ 327 | RowBox[{"PasteButton", "[", 328 | RowBox[{ 329 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 330 | RowBox[{"ImageSize", "\[Rule]", 331 | RowBox[{"{", 332 | RowBox[{"170", ",", "25"}], "}"}]}], ",", 333 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], 334 | "]"}], "&"}], "/@", "\[IndentingNewLine]", 335 | RowBox[{"{", 336 | RowBox[{ 337 | "\"\\"", 338 | ",", "\[IndentingNewLine]", 339 | "\"\\"", ",", 340 | "\[IndentingNewLine]", 341 | "\"\\"", ",", 342 | "\[IndentingNewLine]", 343 | "\"\\""}], 344 | "\[IndentingNewLine]", "}"}]}], ",", "2"}], "]"}], ",", 345 | RowBox[{"Spacings", "\[Rule]", 346 | RowBox[{"{", 347 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], ";"}]}], "Input", 348 | InitializationCell->True, 349 | CellChangeTimes->{ 350 | 3.5090214188387456`*^9, {3.5090249945463247`*^9, 3.509025044743471*^9}, { 351 | 3.509025110699088*^9, 3.5090252233172526`*^9}, {3.509025261592131*^9, 352 | 3.5090252618221445`*^9}, {3.5090252949932137`*^9, 3.509025315745573*^9}, 353 | 3.509025371780881*^9, {3.6320492684480658`*^9, 3.632049273314521*^9}, { 354 | 3.632049468190134*^9, 3.632049470440692*^9}, {3.632049509071879*^9, 355 | 3.632049517814117*^9}}], 356 | 357 | Cell["Special", "Text", 358 | CellChangeTimes->{{3.5090212017782955`*^9, 3.5090212102803106`*^9}, 359 | 3.509021385017886*^9}, 360 | FontSize->24], 361 | 362 | Cell[BoxData[ 363 | RowBox[{ 364 | RowBox[{"specialOp", "=", 365 | RowBox[{"Column", "[", 366 | RowBox[{ 367 | RowBox[{ 368 | RowBox[{ 369 | RowBox[{"PasteButton", "[", 370 | RowBox[{ 371 | RowBox[{"RawBoxes", "[", "#", "]"}], ",", 372 | RowBox[{"ImageSize", "\[Rule]", 373 | RowBox[{"{", 374 | RowBox[{"340", ",", "25"}], "}"}]}], ",", 375 | RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}], 376 | "&"}], "/@", "\[IndentingNewLine]", 377 | RowBox[{"{", 378 | RowBox[{ 379 | "\"\\"", ",", 380 | "\[IndentingNewLine]", 381 | "\"\\"", ",", 382 | "\[IndentingNewLine]", 383 | "\"\\"", ",", 384 | "\[IndentingNewLine]", 385 | "\"\\"", ",", 386 | "\[IndentingNewLine]", 387 | "\"\\"", ",", 388 | "\[IndentingNewLine]", 389 | "\"\\""}], 390 | "\[IndentingNewLine]", "}"}]}], ",", "Center", ",", 391 | RowBox[{"Spacings", "\[Rule]", 392 | RowBox[{"{", 393 | RowBox[{"0", ",", ".1"}], "}"}]}]}], "]"}]}], ";"}]], "Input", 394 | InitializationCell->True, 395 | CellChangeTimes->{ 396 | 3.509021421833951*^9, {3.5090253814730043`*^9, 3.5090254820013185`*^9}, { 397 | 3.5090256747435827`*^9, 3.5090256783533754`*^9}, {3.632049275133497*^9, 398 | 3.632049280948473*^9}, {3.632049472964512*^9, 3.632049474278183*^9}}] 399 | }, Open ]], 400 | 401 | Cell[CellGroupData[{ 402 | 403 | Cell["Create Palette", "Section", 404 | CellChangeTimes->{{3.5090212943817267`*^9, 3.509021302337741*^9}, { 405 | 3.5090258189304667`*^9, 3.5090258300364637`*^9}, {3.5090282666999593`*^9, 406 | 3.50902826701196*^9}}], 407 | 408 | Cell[BoxData[ 409 | RowBox[{ 410 | RowBox[{"CreatePalette", "[", 411 | RowBox[{ 412 | RowBox[{"{", "\[IndentingNewLine]", 413 | RowBox[{ 414 | RowBox[{"Button", "[", 415 | RowBox[{ 416 | RowBox[{"Style", "[", 417 | RowBox[{"\"\\"", ",", "20", ",", "Bold"}], "]"}], 418 | ",", 419 | RowBox[{"Appearance", "\[Rule]", "None"}], ",", 420 | RowBox[{"ImageSize", "\[Rule]", 421 | RowBox[{"{", 422 | RowBox[{"340", ",", "30"}], "}"}]}]}], "]"}], ",", 423 | "\[IndentingNewLine]", 424 | RowBox[{"DynamicModule", "[", 425 | RowBox[{ 426 | RowBox[{"{", 427 | RowBox[{ 428 | RowBox[{"opener1", "=", "True"}], ",", 429 | RowBox[{"opener2", "=", "False"}], ",", 430 | RowBox[{"opener3", "=", "False"}], ",", 431 | RowBox[{"opener4", "=", "False"}]}], "}"}], ",", 432 | "\[IndentingNewLine]", 433 | RowBox[{"Column", "[", 434 | RowBox[{"{", "\[IndentingNewLine]", 435 | RowBox[{ 436 | RowBox[{"OpenerView", "[", 437 | RowBox[{ 438 | RowBox[{"{", 439 | RowBox[{ 440 | RowBox[{"Style", "[", 441 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 442 | "\[IndentingNewLine]", 443 | RowBox[{"Column", "[", 444 | RowBox[{ 445 | RowBox[{"{", 446 | RowBox[{ 447 | RowBox[{"Style", "[", 448 | RowBox[{ 449 | "\"\\"", ",", "11", ",", "Bold"}], 450 | "]"}], ",", "basicOp1", ",", 451 | RowBox[{"Style", "[", 452 | RowBox[{"\"\\"", ",", "11", ",", "Bold"}], 453 | "]"}], ",", "basicOp2", ",", 454 | RowBox[{"Style", "[", 455 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], "]"}], 456 | ",", "basicOp3"}], "}"}], ",", 457 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 458 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 459 | RowBox[{"Dynamic", "[", 460 | RowBox[{"opener1", ",", 461 | RowBox[{ 462 | RowBox[{"(", 463 | RowBox[{ 464 | RowBox[{"opener1", "=", "True"}], ";", 465 | RowBox[{"opener2", "=", "False"}], ";", 466 | RowBox[{"opener3", "=", "False"}], ";", 467 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 468 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 469 | RowBox[{"OpenerView", "[", 470 | RowBox[{ 471 | RowBox[{"{", 472 | RowBox[{ 473 | RowBox[{"Style", "[", 474 | RowBox[{"\"\\"", ",", "15"}], 475 | "]"}], ",", "\[IndentingNewLine]", 476 | RowBox[{"Column", "[", 477 | RowBox[{ 478 | RowBox[{"{", 479 | RowBox[{ 480 | RowBox[{"Style", "[", 481 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 482 | "]"}], ",", "geomOp"}], "}"}], ",", 483 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 484 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 485 | RowBox[{"Dynamic", "[", 486 | RowBox[{"opener2", ",", 487 | RowBox[{ 488 | RowBox[{"(", 489 | RowBox[{ 490 | RowBox[{"opener2", "=", "#"}], ";", 491 | RowBox[{"opener1", "=", "True"}], ";", 492 | RowBox[{"opener3", "=", "False"}], ";", 493 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 494 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 495 | RowBox[{"OpenerView", "[", 496 | RowBox[{ 497 | RowBox[{"{", 498 | RowBox[{ 499 | RowBox[{"Style", "[", 500 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 501 | "\[IndentingNewLine]", 502 | RowBox[{"Column", "[", 503 | RowBox[{ 504 | RowBox[{"{", 505 | RowBox[{ 506 | RowBox[{"Style", "[", 507 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 508 | "]"}], ",", "quatOp1", ",", 509 | RowBox[{"Style", "[", 510 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 511 | "]"}], ",", "quatOp2"}], "}"}], ",", 512 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 513 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 514 | RowBox[{"Dynamic", "[", 515 | RowBox[{"opener3", ",", 516 | RowBox[{ 517 | RowBox[{"(", 518 | RowBox[{ 519 | RowBox[{"opener3", "=", "#"}], ";", 520 | RowBox[{"opener1", "=", "True"}], ";", 521 | RowBox[{"opener2", "=", "False"}], ";", 522 | RowBox[{"opener4", "=", "False"}]}], ")"}], "&"}]}], 523 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", 524 | RowBox[{"OpenerView", "[", 525 | RowBox[{ 526 | RowBox[{"{", 527 | RowBox[{ 528 | RowBox[{"Style", "[", 529 | RowBox[{"\"\\"", ",", "15"}], "]"}], ",", 530 | "\[IndentingNewLine]", 531 | RowBox[{"Column", "[", 532 | RowBox[{ 533 | RowBox[{"{", 534 | RowBox[{ 535 | RowBox[{"Style", "[", 536 | RowBox[{"\"\\"", ",", "12", ",", "Bold"}], 537 | "]"}], ",", "specialOp"}], "}"}], ",", 538 | RowBox[{"Dividers", "\[Rule]", "True"}]}], "]"}]}], 539 | "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 540 | RowBox[{"Dynamic", "[", 541 | RowBox[{"opener4", ",", 542 | RowBox[{ 543 | RowBox[{"(", 544 | RowBox[{ 545 | RowBox[{"opener4", "=", "#"}], ";", 546 | RowBox[{"opener1", "=", "True"}], ";", 547 | RowBox[{"opener2", "=", "False"}], ";", 548 | RowBox[{"opener3", "=", "False"}]}], ")"}], "&"}]}], 549 | "]"}]}], "]"}], ",", "\[IndentingNewLine]", "helpBLarge"}], 550 | "\[IndentingNewLine]", "}"}], "]"}]}], "\[IndentingNewLine]", 551 | "]"}]}], "\[IndentingNewLine]", "}"}], ",", 552 | RowBox[{"WindowTitle", "\[Rule]", "\"\\""}], ",", 553 | RowBox[{"WindowSize", "\[Rule]", "All"}]}], "]"}], ";"}]], "Input", 554 | InitializationCell->True, 555 | CellChangeTimes->{{3.509025835209553*^9, 3.509025913416439*^9}, { 556 | 3.509025948059537*^9, 3.509026159064742*^9}, {3.509026231608511*^9, 557 | 3.509026249207259*^9}, {3.509026280860793*^9, 3.5090263245201826`*^9}, { 558 | 3.509026358930064*^9, 3.5090263770560665`*^9}, {3.509026473827566*^9, 559 | 3.509026564563169*^9}, {3.5090266014557962`*^9, 3.5090266473873196`*^9}, { 560 | 3.509026748753461*^9, 3.509026762369809*^9}, {3.5090269392354755`*^9, 561 | 3.5090270048060703`*^9}, {3.5090270451158752`*^9, 3.5090270522648706`*^9}, { 562 | 3.509027446998807*^9, 3.509027447262822*^9}, {3.509027541175969*^9, 563 | 3.509027544251334*^9}, {3.5090275779089837`*^9, 3.5090276524432807`*^9}, { 564 | 3.509027685252898*^9, 3.509027756524858*^9}, {3.5090279799637456`*^9, 565 | 3.5090280009409065`*^9}, {3.5090281367684155`*^9, 3.509028164064642*^9}, { 566 | 3.5090293239766045`*^9, 3.509029325155672*^9}, {3.509029399765939*^9, 567 | 3.5090294213541737`*^9}}] 568 | }, Open ]] 569 | }, Open ]] 570 | }, 571 | WindowSize->{1052, 564}, 572 | WindowMargins->{{23, Automatic}, {106, Automatic}}, 573 | FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (June 27, \ 574 | 2014)", 575 | StyleDefinitions->FrontEnd`FileName[{"Utility"}, "Memo.nb", CharacterEncoding -> 576 | "UTF-8"] 577 | ] 578 | (* End of Notebook Content *) 579 | 580 | (* Internal cache information *) 581 | (*CellTagsOutline 582 | CellTagsIndex->{} 583 | *) 584 | (*CellTagsIndex 585 | CellTagsIndex->{} 586 | *) 587 | (*NotebookFileOutline 588 | Notebook[{ 589 | Cell[CellGroupData[{ 590 | Cell[567, 22, 123, 1, 92, "Title"], 591 | Cell[693, 25, 239, 9, 139, "Text"], 592 | Cell[935, 36, 193, 4, 32, "Text"], 593 | Cell[CellGroupData[{ 594 | Cell[1153, 44, 151, 2, 55, "Section"], 595 | Cell[1307, 48, 1828, 34, 408, "Text", 596 | CellGroupingRules->"NormalGrouping"] 597 | }, Open ]], 598 | Cell[CellGroupData[{ 599 | Cell[3172, 87, 151, 2, 55, "Section"], 600 | Cell[3326, 91, 165, 3, 45, "Text"], 601 | Cell[3494, 96, 1337, 28, 104, "Input", 602 | InitializationCell->True], 603 | Cell[4834, 126, 117, 2, 45, "Text"], 604 | Cell[4954, 130, 4955, 105, 403, "Input", 605 | InitializationCell->True], 606 | Cell[9912, 237, 179, 3, 45, "Text"], 607 | Cell[10094, 242, 1925, 42, 182, "Input", 608 | InitializationCell->True], 609 | Cell[12022, 286, 138, 3, 45, "Text"], 610 | Cell[12163, 291, 2536, 63, 199, "Input", 611 | InitializationCell->True], 612 | Cell[14702, 356, 134, 3, 45, "Text"], 613 | Cell[14839, 361, 1525, 36, 148, "Input", 614 | InitializationCell->True] 615 | }, Open ]], 616 | Cell[CellGroupData[{ 617 | Cell[16401, 402, 204, 3, 55, "Section"], 618 | Cell[16608, 407, 7365, 159, 437, "Input", 619 | InitializationCell->True] 620 | }, Open ]] 621 | }, Open ]] 622 | } 623 | ] 624 | *) 625 | 626 | (* End of internal cache information *) 627 | --------------------------------------------------------------------------------