MathGroup Archive 1999

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

Search the Archive

Re: I have problem with these functions!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16247] Re: [mg16154] I have problem with these functions!!
  • From: wself at viking.emcmt.edu (Will Self)
  • Date: Fri, 5 Mar 1999 00:41:12 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

"mikael hellstrom" <mikael.hellstrom at swipnet.se>
wrote:

>Hello! Mabe you can help me??
>
>1)
>I'm going to make a function that take a list, the number that are going in
>the list, and the spot
>there the nummer are going to place. The function are leaving the new list
>as a result.
>switchelement[list_,number_,place_]
>
>
>2)
>This function should return the "most common" numbers in the list.(if two
>numbers have same frecvence,the function should take the lower number.)
>like this: mostcommon[list_]
>
>
>3)
>biggerthan[list_,number_]
>This funktion return a list with values bigger or equal with "number"
>
>
>
>
>Thanks mick!!
>


1)
switchelement[list_,number_,place_] := list/.list[[place]]->number


2)
frequencyList[list_] := {#, Length[Position[list,#]]}& /@ Union[list]

mostcommon[list_] := Module[{f=frequencyList[list], m},
m = Max[Transpose[f][[2]]];
First[First[Select[f, #[[2]]==m&]]]]


3)
biggerthan[list_,number_] := Select[list, #>number&]


You are mick velkomm!!

Will Self


  • Prev by Date: Re: How to draw the level curves ?
  • Next by Date: Re: How to draw the level curves ?
  • Previous by thread: I have problem with these functions!!
  • Next by thread: Re: I have problem with these functions!!