Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need to use four functions of $x$

DD11 = @(x) x+0*x;
DD12 = @(x) x^2+0*x;
DD21 = @(x) cos(x)+0*x;
DD22 = @(x) 1+0*x;

and since they all represent the same physical quantity, and also for the sake of convenience, I would like to define in a matrix form:

DD = @x [x x^2; cos(x) 1];

If I do this, how will I recall the different elements at a given point later on?

For example, the syntax DD[1,2](0) or DD(0)[1,2] don't work... Thanks!

share|improve this question

closed as unclear what you're asking by Mr.Wizard Jun 6 '14 at 11:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Are you sure that you are trying to code something in Mathematica? –  Öskå Jun 6 '14 at 10:24

1 Answer 1

You might try

dd[x_] := {{x, x^2}, {Cos[x], 1}}
dd[2] // MatrixForm


You can extract components with the syntax

dd[2][[2, 1]]
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.