WP 34S matrix operations


I've added a number of matrix routines to the library/matrix.wp34s file. This along with Marcus's matrix editor is about half a flash region. We'd like to provide a full region of matrix functions if possible.

My question is then "What extra functions should go in?"

Suggestions are welcome, suggestions with code are better :-) These aren't going to be held to the same standard as the internal user code commands -- wreck the stack, use the lettered registers and flags and generally have fun.

I am aware of these functions but thought I'd see what people wanted before diving in and doing the ones I find interesting (and probably completely useless).

The existing functions in user code are:

  • M.1 - Create an identity matrix from a descriptor in X. No stack damage, L changed.
  • M.0 - Create an zero matrix from a descriptor in X. No stack damage, L changed.
  • ATR - Return the sum of the absolute values of the matrix diagonal.
  • TR - Return the trace of the matrix.
  • M- - Matrix subtraction.
  • M+ - Matrix addition.
  • M.y - Multiply matrix by scalar.
  • FNM - Frobenius norm.
  • RNM - Row norm.
  • CNM - Column norm.
  • MFD - Find element in matrix.
  • M^ - Find the maximum element in matrix.
  • Mv - Find the minimum element in a matrix.

Yes, these need better documentation.

These are implemented internally and documented reasonably in doc/matrix.txt:

  • M.TRN - Matrix transpose in-situ.
  • M.times - Matrix multiply.
  • M.+times - Matrix addition & scalar multiplication.
  • M.R<-> - Matrix row swap.
  • M.Rtimes - Multiply row by scalar.
  • M.R+times - Multiply a row by a scalar and add to another row.
  • M.IJ - Convert a register index to row/column indices.
  • M.REG - Convert row/column indices to a register index.
  • M.ALL - Return a loop index to iterate over the entire matrix.
  • M.DIAG - Return a loop index to iterate over the diagonal of the matrix.
  • M.ROW - Return a loop index to iterate over a row of the matrix.
  • M.COL - Return a loop index to iterate over a column of the matrix.
  • M.ROW? - Extract the row count from a matrix descriptor.
  • M.COL? - Extract the column count from a matrix descriptor.
  • M.SQR? - Check if a matrix descriptor is for a square matrix & execute the next step if not.
  • M.COPY - Copy a matrix to another location.
  • M.DET - Calculate the determinant of a matrix.
  • M.LIN - Solve a system of linear equations.
  • M.INV - Invert a matrix in-situ.

This seems like a fairly good selection of operations. Their names might change, but the functions are very unlikely to.

- Pauli


May I suggest my little editor? Code is already there :-)




I did think about this one but didn't act.

I'll put it in.

- Pauli


And done.

- Pauli


Please forgive if the following matrix functions were previously considered or require too many resources, but useful would be:

* eigenvalues
* eigenvectors
* singular value decomposition (svd)
* singular values




All of these are under consideration, although I've coded none of them. I'm not sure how to deal with complex results, at least at the moment.

- Pauli

Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34S] Unfortunate key damage with update to V3 :( svisvanatha 5 2,471 12-10-2013, 11:37 PM
Last Post: Les Bell
  WP-34S (Emulator Program Load/Save) Barry Mead 1 1,345 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  AFTER HP-Prime update, Shift+Matrix CRASHES Joseph Ec 3 1,592 12-06-2013, 11:06 AM
Last Post: Joseph Ec
  DIY HP 30b WP 34s serial flash/programming cable Richard Wahl 2 1,943 12-04-2013, 11:14 AM
Last Post: Barry Mead
  HP Prime Matrix TERRIBLE bug and question uklo 19 3,866 11-25-2013, 12:10 PM
Last Post: Mic
  HP Prime: editing a matrix Alberto Candel 6 1,880 11-20-2013, 06:26 PM
Last Post: Helge Gabert
  Absolute Value and Matrix BruceTTT 5 1,694 11-11-2013, 11:52 PM
Last Post: Walter B
  WP 34S/43 ?'s Richard Berler 3 1,609 11-10-2013, 02:27 AM
Last Post: Walter B
  My FrankenCulator (wp-34s) FORTIN Pascal 4 1,690 11-09-2013, 06:18 PM
Last Post: FORTIN Pascal
  WP 34S Owner's Handbook Walter B 5 2,131 11-09-2013, 05:34 PM
Last Post: Harald

Forum Jump: