Post Reply 
SVD
12-13-2013, 08:17 PM
Post: #1
SVD
I can't seem to get SVD to work for non-square matrices. This works perfectly on the 50g but fails on the Prime...unless I'm doing something wrong. Anyone else seen this?
Find all posts by this user
Quote this message in a reply
12-13-2013, 08:40 PM
Post: #2
RE: SVD
On the latest firmware:

\[ SVD\left ( \begin{bmatrix} 1 & -1 \\ 1 & -1 \\ \sqrt{3} & 0 \end{bmatrix} \right ) \]

Gives "Error: Bad Argument Type" in both Home and CAS.

Looks like a definite bug to me.

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
12-13-2013, 09:16 PM
Post: #3
RE: SVD
If it is a bug, it is a minor bug.

Try entering the SVD command in lowercase:

\[ \textrm{simplify} \left ( \textrm{svd}\left ( \begin{bmatrix} 1 & -1 \\ 1 & -1 \\ \sqrt{3} & 0 \end{bmatrix} \right ) \right ) \]

Gives a result of:

\[ \begin{bmatrix} 0.5477 & 0.7071 & -0.4472 \\ 0.5477 & -0.7071 & -0.4472 \\ 0.6325 & 5.1840 \times 10^{-17} & 0.7746 \end{bmatrix} \]

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
12-13-2013, 09:34 PM (This post was last modified: 12-13-2013 09:37 PM by jgreenb2.)
Post: #4
RE: SVD
Mark,

Thanks. How did you think to do this? The toolbox menu inserts in uppercase and the manual defines SVD in uppercase. Did you just try at random or is there some logic to when this matters?

Also, using SVD() (uppercase) on a square matrix seems to work...very odd!
Find all posts by this user
Quote this message in a reply
12-13-2013, 09:44 PM
Post: #5
RE: SVD
Search the old forum archives. The difference between UPPERCASE/lowercase for commands on the Prime has already generated several other bug reports. It is a matter of confusion that the Prime Team will hopefully address in a future release.

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
12-13-2013, 10:03 PM
Post: #6
RE: SVD
Thanks, I'll check it out. I admit I want to like this calculator but it's been a bit of a trial so far!
Find all posts by this user
Quote this message in a reply
12-15-2013, 10:04 AM
Post: #7
RE: SVD
The current algorithm covered only square real matrices (as you can guess, implementing numeric algorithms is not my main business, and giac/xcas uses LAPACK for svd, therefore it was only required here), svd was also sometimes able to return an answer for rectangular matrices. I'm improving it, it will handle rectangular real or complex matrices that are well conditionned (0 or small singular values will not be handled, I'm not writing a dedicated numerical algorithm for that, just reusing existing routines).
Find all posts by this user
Quote this message in a reply
12-15-2013, 03:42 PM (This post was last modified: 12-15-2013 03:46 PM by jgreenb2.)
Post: #8
RE: SVD
Parisse,

Thanks for the clarification. Nice to know these things are being worked out. As long as there's a reasonable error message for ill-conditioned matrices I'll be happy Smile

It would also be nice if it worked correctly in RPN: svd() should take a matrix from the stack and just push U, S, V back onto the stack.

--jeff
Find all posts by this user
Quote this message in a reply
12-16-2013, 09:22 AM
Post: #9
RE: SVD
Actually, you don't really need a message for ill-conditionned matrix, just look at the ratio between the largest singular value and the smallest one in s.
Find all posts by this user
Quote this message in a reply
Post Reply 




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