Suppose I have a matrix,

Mat = MatrixForm[{{1.5, 2.83034}, {1.50476, 2.82655}}]

I need to define parameters such that in the matrix 'i'th component is 'Lambda' and 'j'th component is corresponding 'Neff' value.

How is that possible in Mathematica?

I tried this

   For[i = 0; j = 0, i < 21 ; j < 21, i++, j++; Map[LambdaSS[i], NefS1[j]] = Mat[i, j]] 

However, this generates error.

  • 2
    $\begingroup$ Don't use MatrixForm. It is only a wrapper meant for display purposes. $\endgroup$ – Henrik Schumacher Feb 12 at 10:41
  • 1
    $\begingroup$ And, almost certainly, the sub-expression Map[...] is going to cause grief later. Is the assignment the wrong way round ? OP might want to investigate the Array function for programmatic construction of arrays. $\endgroup$ – High Performance Mark Feb 12 at 11:23
  • $\begingroup$ Moreover, indexing into a matrix has to be done with Part, so it should be Mat[[i,j]]. See also The Four Kinds of Bracketing in the Wolfram Language. Moreover, For loops are evil. $\endgroup$ – Henrik Schumacher Feb 12 at 11:49
  • $\begingroup$ @HenrikSchumacher : I removed the MatrixForm. I understand the indexing using Part. However, here I don't need to index individiual entries in the matrix. I want to have a standard definition which signifies that Matrix [LambdaSS, NefS1] = Mat[[i,j]. $\endgroup$ – user35115 Feb 14 at 11:15
  • $\begingroup$ @HighPerformanceMark: Thanks for your inputs. Actually, I need to plot a function with variable LambdaSS. The values of LambdaSS should be limited to the arrray. That is to say it can only take 2 values 1. 5 and 1.50476 if we were to consider the above array $\endgroup$ – user35115 Feb 15 at 7:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.