numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
200 stars 117 forks source link

the inner product should work for row as well as column vectors #94

Closed BillFoster closed 12 years ago

BillFoster commented 12 years ago

This means that there should be a row vector type or with present types to allow indiscriminately column vectors or row or column matrices to be the arguments of dot.

BillFoster commented 12 years ago

Of course you can always use transpose to make the row vectors into columns and do something lax with matrices.

BillFoster commented 12 years ago

The new transpose function does not work on column vectors. I suppose because the result would have to be a proper vector - at present the rowvector pseudo type is just a 1xn matrix and is not a vector. What is ideal for all sorts of reasons is to have a proper row vector which is displayed in the form (a,b,...,n) with commas included and on which we can do inner products, cross products etc.

christianp commented 12 years ago

Is it OK to close this? There is no distinction between column and row vectors, apart from display.

BillFoster commented 12 years ago

Before we do this can I sum up. All vectors are column vectors. There are no row vector types. The inner or dot product as well as the crossproduct only work for vectors. An nx1 matrix is not a vector. For example, cannot be used in dot or cross products. However a vector can be considered as an nx1 matrix for the purposes of matrix multiplication i.e. as a point being transformed by a linear map and also as the transpose of an nx1 vector produces a 1x n matrix, not a vector. So changes type. So you can do \var{transpose(vector(a,b,c))*vector(d,e,f)} Transpose of a m x n matrix is a n x m matrix. So beware, transpose(transpose(vector)) is not the original vector, it is a matrix. There is a row vector display type, of the form (a,b,c) this is for convenience for displaying vectors via the rowVector rule or elements in some coordinate space.


From: Christian Perfect [reply@reply.github.com] Sent: 28 November 2011 14:39 To: Bill Foster Subject: Re: [Numbas] the inner product should work for row as well as column vectors (#94)

Is it OK to close this? There is no distinction between column and row vectors, apart from display.


Reply to this email directly or view it on GitHub: https://github.com/numbas/Numbas/issues/94#issuecomment-2897516