Re: derivative of matrix in mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg120154] Re: derivative of matrix in mathematica
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 10 Jul 2011 05:01:28 -0400 (EDT)
On 7/9/11 at 7:32 AM, physics1389 at yahoo.com (yashar) wrote: >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.