# How do I use a matrix that has a variable?

I seem to be getting an error whenever I try running this piece of code.

 Matrix12[n_] := {{1, 0}, {0, {\[Kappa]1[n]}/{\[Kappa]2[n]}}}


I've already defined the n dependent functions kappa1 and kappa2 but it still doesn't work. I keep getting a 'Tag list in...... is protected'. Is it that this functionality is not supported by the program itself or is my code wrong in how it's written?

-
Based on the error message you probably have a Set (=) somewhere that you intend to have an Equal (==). – Mr.Wizard Aug 14 '12 at 10:36
Welcome to Mathematica.SE! Please consider registering your account so that any upvotes you get on this question are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). – Sjoerd C. de Vries Aug 14 '12 at 20:42

## 1 Answer

\[Kappa]1[n_] := 2 n + 1;
\[Kappa]2[n_] := n^2 + 1;
matrix12[n_] := {{1, 0}, {0, {\[Kappa]1[n]}/{\[Kappa]2[n]}}}
matrix12[3]


gives

{{1,0},{0,{7/10}}}

-