The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
newRPL: Simplified matrices proposal
06-01-2015, 07:20 PM
Post: #1
newRPL: Simplified matrices proposal
userRPL historically had 4 different objects for vectors and matrices:
Vectors (1D)
Matrices (numeric only)
Symbolic Vectors (implemented as lists)
Symbolic Matrices (implemented as lists of lists)

Here we propose to simplify all this into a single object type: Matrix.

A matrix may contain real or complex numbers, or symbolic expressions mixed in. There is no difference between a symbolic matrix and a numeric one. Operations in newRPL follow generic overloadable operators, so addition and multiplication of individual elements can be done through the same generic operators and will automatically handle cross-type operations.
Vectors are not distinguishable from matrices in newRPL. They share the same object type and same properties and operations. When working with matrices, the following intuitive rules apply:
  • Operations on matrices follow the standard mathematical rules for addition/multiplication of matrices.
  • All 1xN and Nx1 matrices are also considered one-dimensional vectors.
  • One-dimensional vectors can be considered as row or column vectors (1xN and Nx1 matrices respectively) when operating with a matrix, whichever orientation makes the operation possible.
  • Vector-vector additions are performed as matrix additions, but always producing a 1xN (row vector) when orientations don't match.
  • Vector-vector multiplications are performed as matrix multiplications, and when orientations don't allow a valid operation, one vector is transposed to produce a (1xN)*(Nx1) = (1x1) multiplication.

This proposal wouldn't break existing code, except that all conversions between matrix/vector and algebraic/numeric matrix become unnecessary.
In userRPL, multiplying a matrix by a vector works as described above, so it's nothing revolutionary but takes this concept a step further.
In newRPL a row vector (1xN) can be transposed to get a column vector (Nx1) (unlike userRPL, where it has to be converted to a matrix first, then transposed).

Multiplying two vectors of the same size becomes a dot product of vectors in newRPL (unless you specifically transpose one to make a (Nx1)x(1xN) multiplication, producing the expected (NxN) result).

The storage model for unified matrices is already implemented, but the matrix/vector fusion is not (yet), and I think a little feedback could help refine the idea.

Thoughts?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
newRPL: Simplified matrices proposal - Claudio L. - 06-01-2015 07:20 PM



User(s) browsing this thread: 2 Guest(s)