2

Excuse me for this basic question, but when reading some mathematic books I have encountered the following matrix:

W = 2diag([1 1 0,01])

Could anybody explain to me how can I read this? Is it just a diagonal matrix multiplied by 2?

TheMP
  • 127
  • 1
  • 6

2 Answers2

5

My guess would be $\texttt{2diag([1 1 0,01])}=\begin{bmatrix}2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0,02 \end{bmatrix}.$

Ruslan
  • 6,775
user35603
  • 3,002
  • 1
    Presumably the comma is then a decimal separator? – Théophile Jul 03 '14 at 14:32
  • @Théophile, Yes. – user35603 Jul 03 '14 at 14:33
  • I thought that it was more matlab-like style to separate rows, but you kind of opened my eyes. Thank you! – TheMP Jul 03 '14 at 14:35
  • Ahhhh! The different radix fooled me. – John Jul 03 '14 at 14:45
  • I was thinking "second diagonal", perhaps the antidiagonal or the diagonal right above or below the main diagonal. – user2357112 Jul 03 '14 at 15:44
  • @DavidZ your edit has broken the spaces in the formula. – Ruslan Jul 03 '14 at 18:25
  • @Ruslan ah, I missed that... it's odd because for some reason the \texttt didn't work on the computer where I submitted the edit, but on the computer I'm on now, it does work. I guess some sort of MathJax caching issue is at fault? Anyway probably the best solution is for someone to roll back my edit. (I can't) – David Z Jul 03 '14 at 18:26
4

The most reliable way could be to ask your lecturer, otherwise there could be a missing or extra multiplication by $2$.

The line

W = 2diag([1 1 0,01])

in the question has been typeset as it could be a code from the program. It is not clear whether this is deliberate or occasional, and whether this is exactly how it looks like in the thesis. Moreover, []-brackets inside ()-brackets strengthen the conjecture that it could be a code from the program. It seems quite viable that the program has a function 2diag (using a naming convention to put 2 instead of to) that takes a list (cf. [...] syntax) and creates a corresponding diagonal matrix of an appropriate dimension. This way, 2diag([1 1 0,01]) will create $3x3$ matrix with $1$, $1$ and $0,01$ on its main diagonal. However, if this notation actually means $$2\,\times\,\text{diag}\{1,1,0.01\}$$ then the diagonal of the resulting matrix will be $2$, $2$ and $0,02$. That's why one should be careful.

Olexandr Konovalov
  • 7,002
  • 2
  • 34
  • 72
  • 1
    There are languages where a number followed by identifier is parsed as number multiplied by that identifier, e.g. in Mathematica 2a would be equivalent to 2*a. – Ruslan Jul 03 '14 at 18:30
  • @Ruslan - thanks! This remark shows that there could be even more confusion if the formula is taken out of context. As for Mathematica, I presume in this case the 1st character of the identifier can not be a digit? – Olexandr Konovalov Jul 03 '14 at 19:47
  • Yes, a digit can't start identifier name. Frankly, I don't even know what languages do allow this. – Ruslan Jul 03 '14 at 21:07
  • @Ruslan: for example, in GAP, an identifier may contain letters, digits, symbols _ and @, and must contain at least one non-digit, but the position of that is not specified; thus, 100x is a valid identifier in GAP - see here – Olexandr Konovalov Jul 03 '14 at 21:34