MathGroup Archive 2008

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

Search the Archive

Re: Identical elements

  • To: mathgroup at
  • Subject: [mg88564] Re: Identical elements
  • From: "Dana DeLouis" <dana.del at>
  • Date: Thu, 8 May 2008 04:16:04 -0400 (EDT)

Please disregard my suggestion of KroneckerDelta.
I didn't realize it is not efficient for large data. (By a large factor)

d = Table[5, {100000}];

Timing[KroneckerDelta @@ d]

{93.32, 1}

Timing[Boole[SameQ @@ d]]

{0., 1}

Dana DeLouis
Mathematica 6.01 (Windows Vista)

"KFUPM" <hussain.alqahtani at> wrote in message
news:fvhe2h$3th$1 at
> Dear All
> I have a list  and i need to test whether all the elements in the list
> are identical or no. What is the efficient way to do that? The output
> should be true if all elements are the same and False otherwise. One
> line command is preferred if possible.
> Your help is highly appreciated.
> Regards,

  • Prev by Date: Re: Stop cell tags propagating to generated cells
  • Next by Date: Re: Question about alignment in Grid and TableForm
  • Previous by thread: Re: Identical elements
  • Next by thread: orthonormal eigenvectors