>in mathematica
>how i can produce a general n by n matrix so that each of its elements be a variable of t???
Any number of ways. It depends on what it is you want. An couple
of examples would be:
In[1]:= m = t RandomInteger[5, {2, 2}]
Out[1]= {{0, 5*t}, {2*t, 0}}
In[2]:= m1 = t^RandomInteger[5, {2, 2}]
Out[2]= {{t, 1}, {t^3, t^2}}
>how i can take derivative of this matrix with respect to variable t?
The same way as taking the derivative of any function with
respect to t. Using the examples above;
In[3]:= D[m, t]
Out[3]= {{0, 5}, {2, 0}}
In[4]:= D[m1, t]
Out[4]= {{1, 0}, {3*t^2, 2*t}}
>how i can with equating this n by n matrix with another n by n matrix which its elements are known obtain unknown elements of this general n by n matrix?
Here, I am not clear on what it is you want to do. I can find a
solution by setting corresponding elements equal as follows
In[5]:= y = RandomInteger[5, {2, 2}];
MapThread[Solve[#1 == #2, t] &, {Flatten@y, Flatten@m}]
Out[6]= {{}, {{t -> 1}}, {{t -> 2}}, {{}}}
But it is trivial to find examples where this won't work.
n = 3;
matrix := Table[p[i, j][#], {i, 1, n}, {j, 1, n}] &
then matrix'[t] gives
{{Derivative[1][p[1, 1]][t], Derivative[1][p[1, 2]][t],
Derivative[1][p[1, 3]][t]}, {Derivative[1][p[2, 1]][t],
Derivative[1][p[2, 2]][t],
Derivative[1][p[2, 3]][t]}, {Derivative[1][p[3, 1]][t],
Derivative[1][p[3, 2]][t], Derivative[1][p[3, 3]][t]}}
To set each of the elements of this matrix equal to the elements of another matrix
you can do something like
MapThread[
SetDelayed, {matrix[t_], Table[Sin[i t] j, {i, 1, n}, {j, 1, n}]}, 2];
Heike
On 9 Jul 2011, at 12:32, yashar wrote:
> hi
> in mathematica
> how i can produce a general n by n matrix so that each of its elements be a variable of t???
> how i can take derivative of this matrix with respect to variable t?
fiveByfive = Array[matrixFuncs[#1, #2][t] &, {5, 5}]
The derivative of the matrix with respect to t
fiveByfive = Array[matrixFuncs[#1, #2][t] &, {5, 5}]
I am not sure what you are asking for with your third question, but perhaps this gives you a direction:
anotherfiveByfive = Array[otherFuncs[#1, #2][t] &, {5, 5}]
Table[fiveByfive[[i, j]] == anotherfiveByfive[[i, j]], {i, 5}, {j, 5}]