Adds 2 to each element.
u
.As per linear algebra:
What about this?
Each element of u
multiplied by corresponding element of v
. Could be called elementwise multiplication.
(Don’t confuse with “outer” or “vector” product from linear algebra, or indeed “inner” or “scalar” multiplication, for which the answer is a number.)
u
, add 2 to second.w
to find something to add: add 1 to 3rd element of u
, 2 to 4th element, 1 to 5th.nrow
and ncol
enough, since R knows how many things in the matrix.What happens if you add two matrices?
A
and B
.Like this:
Do this first:
and then all is good:
t()
is transpose):\[ A v = \lambda v \]
eigen
gets these: x y
x 1.0000000 -0.9878783
y -0.9878783 1.0000000
cor
gives the correlation matrix between each pair of variables (correlation between x
and y
is \(-0.988\))eigen() decomposition
$values
[1] 1.98787834 0.01212166
$vectors
[,1] [,2]
[1,] -0.7071068 -0.7071068
[2,] 0.7071068 -0.7071068
x
small and y
large at one end,x
large and y
small at the other.