Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82081] Re: Matrices
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 11 Oct 2007 00:25:36 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fei2sd$qf3$1@smc.vnet.net>

KFUPM wrote:

> I have two matrices
> 
> H= {{a,b},{c,d}}
> and
> L ={{1,2},{3,4}}
> 
> and I want  the element "a" in matrix H to have the corresponding
> numerical values of L , i.e 1 and b --> 2 and so on. I am wondering
> how to do that in the simplest way possible? My actual matrices are
> larger than those i introduce here, i did that just for simplicity.
> 
> Any help in this regard is highly appreciated.

Reading more carefully your post, I realized that I may have been too 
fast to answer it previously. You want that the symbols a, b, c, and d 
hold the value 1, 2, 3, and 4 respectively. You can do that with 
MapThread[Set, {H, L}] (I cannot think of anything simpler at the 
moment). For instance,

In[1]:= Clear[a, b, c, d]
H = {{a, b}, {c, d}};
L = {{1, 2}, {3, 4}};
MapThread[Set, {H, L}];
{a, b, c, d}

Out[5]= {1, 2, 3, 4}

Best regards,
-- 
Jean-Marc


  • Prev by Date: Re: rule based program for "Deleting repeated members of a list."
  • Next by Date: Re: "dereference" variable
  • Previous by thread: Re: Matrices
  • Next by thread: Just for fun: Shortest InputForm to achieve a given Kernel error