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

MathGroup Archive 2008

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

Search the Archive

Re: help with new symbols (or pointers)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92416] Re: [mg92387] help with new symbols (or pointers)
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 30 Sep 2008 21:48:52 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

m = 8;

ToExpression[
 Table["x" <> ToString[n] <> " = " <> ToString[n^2 - 5 n + 6], {n, 
   m}]]

{2,0,0,2,6,12,20,30}

y = Array[#^2 - 5 # + 6 &, {m}]

{2,0,0,2,6,12,20,30}

Table[z[n] = n^2 - 5 n + 6, {n, m}]

{2,0,0,2,6,12,20,30}

% == %% == %%%

True

x4 == y[[4]] == z[4] == 2

True


Bob Hanlon

---- ag <ashutoshgupta.umd at gmail.com> wrote: 

=============
Hi,

I want to create new symbols inside a module & assign them values=85

e.g. something like: Symbol[=93x=94<>"num"] = 5
It is not working=85

The problem is that I dont know how many symbols I would need (it
could be 5, 50 or 5000)... So I cannot do something like:
Symbol["x"<>"1"];
x1=5;

Is there anything in Mathematica which is like pointers in C
(something which would assign a value to a given location in memory)?

Any help would be appreciated!

Thanks,
AG.


--

Bob Hanlon



  • Prev by Date: Re: help with new symbols (or pointers)
  • Next by Date: Re: ContourStyle -> {{Dashing[0.15, 0.5]}} has no effect
  • Previous by thread: Re: help with new symbols (or pointers)
  • Next by thread: Re: help with new symbols (or pointers)