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

MathGroup Archive 2007

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

Search the Archive

Re: compute distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82499] Re: compute distribution
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 22 Oct 2007 05:42:16 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fff50c$eu3$1@smc.vnet.net>

vickyisai at gmail.com wrote:

> How can i compute the distribution of signals fired from a net . ther
> are 26 different signals that can be fired.
> which is obtained the form below.
> 
> 
> { ammmmmstgretsrdhydtudytyhsdefaweshgffdyhsfdhsgfjsdfdsfhkpgfkjgfjhkjhfdgkbfsdnfjkdsglhdsjfkgndsjgh}
> 
> i ma confused with how to show the distribution plot. If i compute the
> "number of times" each signal has occured, than how it can be
> plotted.  (like a appears 12 times, b appears 13 times....than
> frequency of appearance can be represented on y axis but what can i
> take on x axis.
> 
> I work on mathematica 5.2

I am not sure at all to have correctly understood what you are looking 
for; however, I believe that the following should be close enough to 
help you started. (First in version 5.2, then in version 6.0.1. Graphics 
have been deleted from this post.)

In[1]:=
$Version

Out[1]=
5.2 for Microsoft Windows (June 20, 2005)

In[2]:=
myTally[l_List]:=Map[{#,Count[l,#]}&,Union[l]]

In[3]:=
data=myTally[Characters[ToString[{\
ammmmmstgretsrdhydtudytyhsdefaweshgffdyhsfdhsgfjsdfdsfhkpgfkjgfjhkjhfdgkbfsdnf\
jkdsglhdsjfkgndsjgh}[[1]]]]]

Out[3]=
{{a,2},{b,1},{d,13},{e,3},{f,13},{g,9},{
 
h,10},{j,7},{k,6},{l,1},{m,5},{n,2},{p,1},{r,2},{s,12},{t,4},{u,1},{w,1},{y,
   4}}

In[4]:=
data=Sort@Join[data,{#,0}&/@Complement[CharacterRange["a","z"],data[[All,1]]]]

Out[4]=
{{a,2},{b,1},{
   c,0},{d,13},{e,3},{f,13},{g,9},{h,10},{i,0},{j,7},{k,6},{l,1},{m,5},{
     n,2},{o,0},{p,1},{q,0},{r,2},{s,12},{t,4},{u,1},{v,0},{w,1},{x,0},{y,
   4},{z,0}}

In[5]:=
<<Graphics`Graphics`

In[6]:=
Histogram[data[[All,
     2]],FrequencyData\[Rule]True,Ticks\[Rule]{Transpose[{Range[26],
       CharacterRange["a","z"]}],Automatic}];

(* And now in version 6.0.1. *)

In[1]:= $Version

Out[1]= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

In[2]:= data =
   Tally[Characters[
     ToString[{\
ammmmmstgretsrdhydtudytyhsdefaweshgffdyhsfdhsgfjsdfdsfhkpgfkjgfjhkjhfd\
gkbfsdnfjkdsglhdsjfkgndsjgh}[[1]]]]];
data = Sort@
    Join[data, {#, 0} & /@
      Complement[CharacterRange["a", "z"], data[[All, 1]]]];
<< Histograms`
Histogram[data[[All, 2]], FrequencyData -> True,
  Ticks -> {Transpose[{Range[26], CharacterRange["a", "z"]}],
    Automatic}]

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Satellite Visualization!
  • Next by Date: Problem with Integral in mathematica 5.1
  • Previous by thread: Re: compute distribution
  • Next by thread: Re: Re: compute distribution