Use array operations to display the numbers \(n^{1/n}\) for \(n=1, \dots, 10\text{.}\) What value of \(n\) has the largest such root?
Answer.
v = 1:10; disp(v.^(1./v))
The root is largest for \(n = 3\text{.}\)
Note that both periods are necessary. Without the second one, Matlab would try to interpet
1/v as a linear system with coefficients v and right hand side 1, which is not what we want. With 1./v we get the vector [1/1 1/2 1/3 ...]. Similarly, without the first period Matlab would try to interpret v^(...) as a matrix power, which would not make sense either.
