Subj : Re: Idea - Tensor could be modelled by 2 arrays and a function To : alt.math,alt.sci.physics,comp.programming From : Mr Pixie Date : Tue Aug 23 2005 07:27 pm "tadchem" wrote in message news:NtmdnZ2dnZ1qA6rdnZ2dnbCnl96dnZ2dRVn-zZ2dnZ0@comcast.com... > > "Mr Pixie" wrote in message > news:XxicnQxrrNewiJfeSa8jmA@karoo.co.uk... > > > > I used to program extensively in APL. > > In APL all variables are treated as arrays. > > Matrix inversion and transposition are monadic operators. > > I wrote a multivariate linear regression in one line. > > What could be simpler? > > Go read up on linear algebra. > > > Tom Davidson > Richmond, VA I think I may have sussed it - here is the code so far: function lorentz(A) array[] { ' Lorentz Transformation by Anthony Smales ' Array A is the input array var B[1]: array; ' B is the result array ' lorentz transformation code var input_velocity : real; ' input_velocity is the relative velocity from reference frame A to frame B var gamma = 1/((1-input_velocity^2)^0.5); var transformed_x0_dimension : real; var transformed_x1_dimension : real; var transformed_x2_dimension : real; var transformed_x3_dimension : real; var transformed_x0_dimension = gamma*(A[0,0]) + (-0 * gamma)*(A[0,1]) + 0*(A[0,2]) + 0*(A[0,3]); var transformed_x1_dimension = gamma*(A[1,0]) + (-0 * gamma)*(A[1,1]) + 0*(A[1,2]) + 0*(A[1,3]); var transformed_x2_dimension = gamma*(A[2,0]) + (-0 * gamma)*(A[2,1]) + 0*(A[2,2]) + 0*(A[2,3]); var transformed_x3_dimension = gamma*(A[3,0]) + (-0 * gamma)*(A[3,1]) + 0*(A[3,2]) + 0*(A[3,3]); B[0] = transformed_x0_dimension; B[1] = transformed_x1_dimension; B[2] = transformed_x2_dimension; B[3] = transformed_x3_dimension; return B[]; } I do seem to have abandoned using 3 arrays though - there are now 2 in total, - which, I suppose, is what I stated originally... Note that array A has 4 dimensions, but array B has only 1 dimension... so, its like : 'you give me 4 numbers and I give you one number back' - sounds about right? So, am I correct in saying that the result array we have here represents the dual space? .