Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Equality...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125739] Re: Equality...
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 30 Mar 2012 04:38:48 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203290755.CAA21646@smc.vnet.net>

Attributes[Set]

{HoldFirst, Protected, SequenceHold}

Set has Attribute HoldFirst so it is necessary to Evaluate the LHS

Evaluate[Array[Subscript[a, #1, #2] &, {3, 4}]] = Array[b, {3, 4}];

Then for example,

{Subscript[a, 1, 1], Subscript[a, 2, 3]}

{b[1, 1], b[2, 3]}


Bob Hanlon

On Thu, Mar 29, 2012 at 3:55 AM, Roozbeh <rhazrat at gmail.com> wrote:
> Hi,
>
> I have a matrix with nxn varaibles an entry and want to assign values
> to each of the entries. How can I do this in one go?
>
> I was hoping something like this works, but it doesn't...
>
> Array[Subscript[a, #1, #2] &, {3, 4}] = Array[Random[1], {3, 4}]
>
> Any tips are apprecited.
>
> R
>



  • References:
  • Prev by Date: Re: How to count
  • Next by Date: Facegrids at ticks
  • Previous by thread: Equality...
  • Next by thread: Re: Equality...