MathGroup Archive 2011

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

Search the Archive

Re: Weird Position[list,form] behavior when used inside of Module.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117072] Re: Weird Position[list,form] behavior when used inside of Module.
  • From: James Stein <mathgroup at stein.org>
  • Date: Wed, 9 Mar 2011 06:58:13 -0500 (EST)

Well, this returns {{3} as expected:

Module[{A, B, RETURN},
 A = {5.3, 5.4, 5.2, 5.9};(*The function F returns {5.3,5.4,5.2,5.9}*)
 B = Position[A, Min[A]];
 RETURN = B]

so I assume that 'F' does not really return what your comment says it does.
For example, where 'F' is undefined:

Module[{A, B, RETURN}, A = F[];
 B = Position[A, Min[A]];
 RETURN = B]

returns {{}}, which I think is correct if A=F[] ('F' undefined).

-- James

On Tue, Mar 8, 2011 at 2:36 AM, Dwayne <dwaynedcole at gmail.com> wrote:

>
> This works:
>
> Position[A, Min[A]]]
>
> where, A = {5.3, 5.4, 5.2, 5.9}.  the Position function returns ( 3 ).
>
> But this doesn't
>
> Module[{ A, B, RETURN},
>             A = Table[ F, {i,{.1, .2, .3, .4}]; (* The function F
> returns {5.3, 5.4, 5.2, 5.9} *)
>             B = Position[A, Min[A]];
>            RETURN = B]
>
> The above module returns, { }.
>
> Is this a bug?
>
>
>
>


  • Prev by Date: Re: Notebook interface and Wolfram-Alpha
  • Next by Date: Re: random line in a very large file
  • Previous by thread: Re: Contour line colors from z coord of a 3D plot
  • Next by thread: what's new in 8.0.1?