MathGroup Archive 1997

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

Search the Archive

Re: Using subscripts in variable _names_!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6169] Re: [mg6143] Using subscripts in variable _names_!!!
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Thu, 27 Feb 1997 02:52:12 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

w.meeussen" <w.meeussen at solair4b.eunet.be>
[mg6143] Re: [mg6136] Re: [mg6104] Using subscripts in variable  
_names_!!!
writes

>define functions f[1][x], f[2][x], ...
>        Array[f[#][x]&,5]
>give x an Integer value 7,
>        %/.x->7
>now make the functions to go numeric
>        %//N
>and you end up with your indices going to Reals too:
>        {f[1.][7.],f[2.][7.],f[3.][7.],f[4.][7.],f[5.][7.]}
>somehow, it seems clear that the indices were supposed to be  
Integer >'type'

Wouter,

The attributes NHoldAll, NHoldFirst, NHoldRest prevent N acting:

SetAttributes[f,NHoldAll]
Array[f[#][x]&,5];
%/.x->7;
%//N
	{f[1][7.], f[2][7.], f[3][7.], f[4][7.], f[5][7.]}

Allan Hayes,
hay at haystack.demon.co.uk
http://haystack.demon.co.uk


  • Prev by Date: Re: conditional package evaluation
  • Next by Date: InputForm
  • Previous by thread: Re: conditional package evaluation
  • Next by thread: Re: Using subscripts in variable _names_!!!