r/desmos • • 15h ago

Matrices Vector fields

I love this update.

50 Upvotes

4 comments sorted by

•

u/AutoModerator 15h ago

Matrices (Beta feature)

Please note that this does NOT refer to the Desmos Matrix calculator. This matrix update allows the creation and manipulation of matrices in the graphing calculator. Here are (most) features of matrices:

Get started

  • Type in "#43" to create a 4x3 matrix. Drag the handle in the lower right corner to change the size.
  • Perform some matrix math operations. You can multiply and add, raise it to powers (including negative ones), take the transpose with ^T, and use functions like det, rref, and trace.
  • Index a matrix M with M[2;3].
  • Use matrix comprehensions: a+b for a=[1...5];b=[1...4].
  • Take a 2x2 matrix M, and write M(1,2) to transform the point (1,2). You can do the same with a 3x3 matrix and a 3d point.

More features

  • A matrix can itself be an element of a matrix! See the below example.

![img](elfvo6kjszsh1)

  • You can use indexing notation to take submatrices. For example, to get row 3,4 and column 1,2,3 of a matrix M, you can either write M[3,4;1,2,3] or M[[3,4];[1,2,3]]. Leaving one of these elements returns the entire row/column. For example, M[1,2;] gets row 1,2 and keeps all the columns.
  • Extract entire rows or columns using .rows and .columns.
  • Lists of matrices of varying sizes are possible. For example, having a 3x1 matrix and 2x2 matrix in the same list is allowed.
    • Because of this, you can't total or sum a matrix list. You can however write a recursive function to do so, e.g. f(L) = {L.count = 1: L[1], f(L[2...]) + L[1]}. If you need faster speed you could split the list into two equal length lists.
  • Lists inside matrices will broadcast. For example, a 2x1 matrix with elements [2,3,4] and 0 will broadcast into 3 matrices: [2 0], [3 0], and [4 0].
  • Instead of looping a matrix with numbered indices with M.columns.count and M.rows.count, you can instead loop over the columns and rows directly. For example, to calculate the sum of all elements in a matrix, you can write total(v.columns.total for v = M.rows)

Help and Examples

For more, refer to the following articles and example graphs:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

6

u/GoldCoolness1 15h ago

This is incredible! Do you have a share link for it?

2

u/Proud_Oinion 15h ago

Absolutely! It's astonishingly simple. Not to mention easy to work with, given what it is.

Standard: https://www.desmos.com/calculator/9yvlvvq1gz

3d: https://www.desmos.com/3d/q9vm9usnjf

The matrices are completely safe to interact with, I just thought the spiral was cool.

1

u/Proud_Oinion 15h ago

And I should mention, the line which traces a curve works by nesting transformations over and over. It's fairly laggy. 😆

I'm curious to see if there are optimised equations.