Fri Oct 23 20:29:35 2020
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2011-05-01

HANGOUT

2020-10-23 | 2020-09-23 | 2020-08-23 | 2020-07-23 | 2020-06-23 | 2020-05-23 | 2020-04-23 | 2020-03-23 | 2020-02-23 | 2020-01-23 | 2019-12-23 | 2019-11-23 | 2019-10-23 | 2019-09-23 | 2019-08-23 | 2019-07-23 | 2019-06-23 | 2019-05-23 | 2019-04-23 | 2019-03-23 | 2019-02-23 | 2019-01-23 | 2018-12-23 | 2018-11-23 | 2018-10-23 | 2018-09-23 | 2018-08-23 | 2018-07-23 | 2018-06-23 | 2018-05-23 | 2018-04-23 | 2018-03-23 | 2018-02-23 | 2018-01-23 | 2017-12-23 | 2017-11-23 | 2017-10-23 | 2017-09-23 | 2017-08-23 | 2017-07-23 | 2017-06-23 | 2017-05-23 | 2017-04-23 | 2017-03-23 | 2017-02-23 | 2017-01-23 | 2016-12-23 | 2016-11-23 | 2016-10-23 | 2016-09-23 | 2016-08-23 | 2016-07-23 | 2016-06-23 | 2016-05-23 | 2016-04-23 | 2016-03-23 | 2016-02-23 | 2016-01-23 | 2015-12-23 | 2015-11-23 | 2015-10-23 | 2015-09-23 | 2015-08-23 | 2015-07-23 | 2015-06-23 | 2015-05-23 | 2015-04-23 | 2015-03-23 | 2015-02-23 | 2015-01-23 | 2014-12-23 | 2014-11-23 | 2014-10-23 | 2014-09-23 | 2014-08-23 | 2014-07-23 | 2014-06-23 | 2014-05-23 | 2014-04-23 | 2014-03-23 | 2014-02-23 | 2014-01-23 | 2013-12-23 | 2013-11-23 | 2013-10-23 | 2013-09-23 | 2013-08-23 | 2013-07-23 | 2013-06-23 | 2013-05-23 | 2013-04-23 | 2013-03-23 | 2013-02-23 | 2013-01-23 | 2012-12-23 | 2012-11-23 | 2012-10-23 | 2012-09-23 | 2012-08-23 | 2012-07-23 | 2012-06-23 | 2012-05-23 | 2012-04-23 | 2012-03-23 | 2012-02-23 | 2012-01-23 | 2011-12-23 | 2011-11-23 | 2011-10-23 | 2011-09-23 | 2011-08-23 | 2011-07-23 | 2011-06-23 | 2011-05-23 | 2011-04-23 | 2011-03-23 | 2011-02-23 | 2011-01-23 | 2010-12-23 | 2010-11-23 | 2010-10-23 | 2010-09-23 | 2010-08-23 | 2010-07-23 | 2010-06-23 | 2010-05-23 | 2010-04-23 | 2010-03-23 | 2010-02-23 | 2010-01-23 | 2009-12-23 | 2009-11-23 | 2009-10-23 | 2009-09-23 | 2009-08-23 | 2009-07-23 | 2009-06-23 | 2009-05-23 | 2009-04-23 | 2009-03-23 | 2009-02-23 | 2009-01-23 | 2008-12-23 | 2008-11-23 | 2008-10-23 | 2008-09-23 | 2008-08-23 | 2008-07-23 | 2008-06-23 | 2008-05-23 | 2008-04-23 | 2008-03-23 | 2008-02-23 | 2008-01-23 | 2007-12-23 | 2007-11-23 | 2007-10-23 | 2007-09-23 | 2007-08-23 | 2007-07-23 | 2007-06-23 | 2007-05-23 | 2007-04-23 | 2007-03-23 | 2007-02-23 | 2007-01-23 | 2006-12-23 | 2006-11-23 | 2006-10-23 | 2006-09-23 | 2006-08-23 | 2006-07-23 | 2006-06-23 | 2006-05-23 | 2006-04-23 | 2006-03-23 | 2006-02-23 | 2006-01-23 | 2005-12-23 | 2005-11-23 | 2005-10-23 | 2005-09-23 | 2005-08-23 | 2005-07-23 | 2005-06-23 | 2005-05-23 | 2005-04-23 | 2005-03-23 | 2005-02-23 | 2005-01-23 | 2004-12-23 | 2004-11-23 | 2004-10-23 | 2004-09-23 | 2004-08-23 | 2004-07-23 | 2004-06-23 | 2004-05-23 | 2004-04-23 | 2004-03-23 | 2004-02-23 | 2004-01-23 | 2003-12-23 | 2003-11-23 | 2003-10-23 | 2003-09-23 | 2003-08-23 | 2003-07-23 | 2003-06-23 | 2003-05-23 | 2003-04-23 | 2003-03-23 | 2003-02-23 | 2003-01-23 | 2002-12-23 | 2002-11-23 | 2002-10-23 | 2002-09-23 | 2002-08-23 | 2002-07-23 | 2002-06-23 | 2002-05-23 | 2002-04-23 | 2002-03-23 | 2002-02-23 | 2002-01-23 | 2001-12-23 | 2001-11-23 | 2001-10-23 | 2001-09-23 | 2001-08-23 | 2001-07-23 | 2001-06-23 | 2001-05-23 | 2001-04-23 | 2001-03-23 | 2001-02-23 | 2001-01-23 | 2000-12-23 | 2000-11-23 | 2000-10-23 | 2000-09-23 | 2000-08-23 | 2000-07-23 | 2000-06-23 | 2000-05-23 | 2000-04-23 | 2000-03-23 | 2000-02-23 | 2000-01-23 | 1999-12-23

Key: Value:

Key: Value:

MESSAGE
DATE 2011-05-16
FROM Ruben Safir
SUBJECT Re: [NYLXS - HANGOUT] C++ Workshop - Notes
From owner-hangout-outgoing-at-mrbrklyn.com Mon May 16 21:32:47 2011
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix)
id 0E8B13A202; Mon, 16 May 2011 21:32:47 -0400 (EDT)
Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix, from userid 28)
id EF582FFA74; Mon, 16 May 2011 21:32:46 -0400 (EDT)
Delivered-To: hangout-at-nylxs.com
Received: from mail2.panix.com (mail2.panix.com [166.84.1.73])
by www2.mrbrklyn.com (Postfix) with ESMTP id 294213A202
for ; Mon, 16 May 2011 21:32:45 -0400 (EDT)
Received: from panix5.panix.com (panix5.panix.com [166.84.1.5])
by mail2.panix.com (Postfix) with ESMTP id 2C6F638E48;
Mon, 16 May 2011 21:32:09 -0400 (EDT)
Received: by panix5.panix.com (Postfix, from userid 20529)
id 186FB2425A; Mon, 16 May 2011 21:32:09 -0400 (EDT)
Date: Mon, 16 May 2011 21:32:09 -0400
From: Ruben Safir
To: Hangout
Cc: ruben-at-mrbrklyn.com
Subject: Re: [NYLXS - HANGOUT] C++ Workshop - Notes
Message-ID: <20110517013208.GA22571-at-panix.com>
References: <4DBB2E6A.2070901-at-panix.com>
<20110503030158.GA25747-at-panix.com>
<20110509230647.GA3211-at-panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=unknown-8bit
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20110509230647.GA3211-at-panix.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Sender: owner-hangout-at-mrbrklyn.com
Precedence: bulk
Reply-To: hangout-at-mrbrklyn.com

on our way to adding the standard deviation to our Distribution template
class we first created a templated function called mean, to determine
the mean value for the population of all the different values in our
chainlist::List< Distirubtion > objects

The code is as follows


/*
* =====================================================================================
*
* Filename: stats.h
*
* Description: simple distribution execise
*
* Version: 1.0
* Created: 04/15/2011 06:12:42 PM
* Revision: none
* Compiler: gcc
*
* Author: Ruben Safir,
* Company:
*
* =====================================================================================
*/
#ifndef STATS_H
#define STATS_H
#include
#include
#include
#include
#include
#include "linklist.h"

/*
* =====================================================================================
* Class: Distribution
* Description: Keeps Track of Distribution of 6's (or anything else)
* in a series of List
* =====================================================================================
*/


namespace stats{

template
class Distribution {
template friend std::ostream & operator<<(std::ostream &,
const Distribution&);
public:
/* ==================== LIFECYCLE
* ======================================= */
Distribution (T descr, int occurances = 0);
Distribution():freq(NULL),occurances(NULL){};
// Distribution ( const Distribution &other ); /* copy
// constructor */
// ~Distribution (); /*
// destructor */
/* ==================== ACCESSORS
* ======================================= */
T description()const{ return freq;}
int population()const { return occurances; }
/* ==================== MUTATORS
* ======================================= */
void increase_occ(){ ++occurances; std::cout << "description "
<< freq << " occurances " << occurances << std::endl; }
void descrease_occ(){ --occurances; }
/* ==================== OPERATORS
* ======================================= */
//Distribution& operator = ( const Distribution &other ); /*
//assignment operator */
int operator()(){
return freq;
}
bool operator==(Distribution &tmp){
if(this->freq == tmp.freq)
return true;
return false;
}

bool operator<(Distribution &tmp){
if(freq < tmp.freq)
return true;
return false;
}
chainlist::List< stats::Distribution > * tally; //a list of
distribution talleys

float stddev(chainlist::List > *);




protected:
/* ==================== DATA MEMBERS
* ======================================= */
private:
/* ==================== DATA MEMBERS
* ======================================= */
T freq; //description of how many times found in a List
int occurances; //description of how many times a frequency was
found in a list
}; /* ----- end of class Distribution ----- */


template
std::ostream & operator << ( std::ostream & os, const
Distribution & obj )
{
T desc = obj.description();
int pop = obj.population();
os << "The Identification of " << desc << " was seen " << pop ;
return os;
} /* ----- end of function operator << ----- */

template
Distribution::Distribution(T descr, int occ): occurances(occ){
freq = descr;
}


//calculation standard deviation of distribution list
//
template
float
Distribution::stddev(chainlist::List > *
tally){
float dev;



return dev;
}

/* Routine to go though a single list and add it to an existing
* distribution table */
template
void mount_individual_data_point(chainlist::List * tabulate,
chainlist::List > * table);

/* Routine to find all the occurances of a type in a list of lists */
template
void take_tally(chainlist::List
*,chainlist::List > *);






template
void take_tally(chainlist::List * tabulate,
chainlist::List > * table){
for(tabulate->cursor()=tabulate->front();tabulate->cursor() !=
tabulate->endd(); tabulate->cursor( tabulate->cursor()->next() ) ){
//build distribution list
mount_individual_data_point(tabulate, table);
}
//we are at the end of tabulate
mount_individual_data_point(tabulate, table);
table->sort(*table);
}

template
void mount_individual_data_point(chainlist::List * tabulate,
chainlist::List > * table){
int val;
stats::Distribution * j;
val = *(tabulate->cursor()->value()); //get a value
table->cursor()= table->front(); //check to see if the
distribution list exists
if(!table->cursor()){ // if not add a distribution table to the
List of distributions
j = new stats::Distribution (val);
table->insert(*j ); //now we have at least one
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();
}else{
//otherwise search for a distribution node described as
//value
table->find_value(val);
if( table->cursor() ){
j=table->cursor()->value();//and increase its population
j->increase_occ();
}else{//otherwise add a new node
j = new stats::Distribution (val);
table->insert( *j ); //now we have one for that value
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();
}
}
}




template
float mean_list(chainlist::List< Distribution > * tally){
if(tally->endd() == 0){
std::cout << "Empty List" << std::endl;
return;
}

int sum = 0;

tally->cursor() = tally->front();
while(tally->cursor() != tally->endd() ){
sum += tally->cursor()->value()->population() ;
tally->cursor(tally->cursor()->next());
}
sum += tally->cursor()->value()->population() ;


sum += tally->curosor->value()->population();

return sum/(tally->size());
}





}
#endif /* STATS_H */


The homework assignment for Tuesday is to finish the Standard deviation
forumula which is defined as follows

quote wikipedia:: http://en.wikipedia.org/wiki/Standard_deviation


consider a population consisting of the following eight values:

2,\ 4,\ 4,\ 4,\ 5,\ 5,\ 7,\ 9

These eight data points have the mean (average) of 5:

\frac{2 + 4 + 4 + 4 + 5 + 5 + 7 + 9}{8} = 5 <<===this is the return
value of stats::mean_list

To calculate the population standard deviation, first compute the
difference of each data point from the mean, and square the result of
each:

\begin{array}{lll} (2-5)^2 = (-3)^2 = 9 && (5-5)^2 = 0^2 = 0 \\
(4-5)^2 = (-1)^2 = 1 && (5-5)^2 = 0^2 = 0 \\ (4-5)^2 = (-1)^2 = 1 &&
(7-5)^2 = 2^2 = 4 \\ (4-5)^2 = (-1)^2 = 1 && (9-5)^2 = 4^2 = 16
\end{array}

Next compute the average of these values, and take the square root:

\sqrt{ \frac{(9 + 1 + 1 + 1 + 0 + 0 + 4 + 16)}{8} } = 2

This quantity is the population standard deviation; it is equal to the
square root of the variance. The formula is valid only if the eight
values we began with form the complete population. If they instead were
a random sample, drawn from some larger, “parent” population,
then we should have used 7 (which is n − 1) instead of 8 (which is
n) in the denominator of the last formula, and then the quantity thus
obtained would have been called the sample standard deviation. See the
section Estimation below for more details.

A slightly more complicated real life example, the average height for
adult men in the United States is about 70", with a standard deviation
of around 3". This means that most men (about 68%, assuming a normal
distribution) have a height within 3" of the mean (67"–73") —
one standard deviation — and almost all men (about 95%) have a
height within 6" of the mean (64"–76") — two standard
deviations. If the standard deviation were zero, then all men would be
exactly 70" tall. If the standard deviation were 20", then men would
have much more variable heights, with a typical range of about
50"–90". Three standard deviations account for 99.7% of the sample
population being studied, assuming the distribution is normal
(bell-shaped).



The code is at

http://www.nylxs.com/docs/workshops/stats.h.html

Ruben

  1. 2011-05-02 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  2. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] NYLXS Business
  3. 2011-05-06 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] NYLXS Business
  4. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Business
  5. 2011-05-09 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] UPDATED! NYLUG Presents: 5/18 -at- 6:30PM Cameron L. Fadjo on Construct, Program, Design: An Introduction to Scratch From the Perspective of Computing and Cognition
  6. 2011-05-09 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  7. 2011-05-10 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 10 6:00PM-8:00PM
  8. 2011-05-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  9. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  10. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: [New-York-C-Developers-Group] MongoNYC - MongoDB Conference
  11. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  12. 2011-05-18 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [rick-at-linuxmafia.com: [conspire] YouTube downloading software
  13. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  14. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  15. 2011-05-20 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  16. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  17. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  18. 2011-05-23 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] Membership Dues Address?
  19. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  20. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  21. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Template Argument type deterination
  22. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  23. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  24. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  25. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ian.bruntlett-at-gmail.com: [accu-general] Free e-book:- The
  26. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job Fair
  27. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [billy.donahue-at-gmail.com: Re: [mrbrklyn-at-panix.com: Template
  28. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  29. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  30. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  31. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  32. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  33. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] template implicit converstion
  34. 2011-05-24 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 24 6:00PM-8:00PM
  35. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [mrbrklyn-at-panix.com: (fwd) Template argument determination]
  36. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  37. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  38. 2011-05-26 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Presents: 6/15 -at- 6:30PM Robert Menes on Rockbox: Open Source Jukebox Firmware
  39. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  40. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  41. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  42. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Perl Class
  43. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Perl Class
  44. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Postgres Class
  45. 2011-05-26 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] Postgres Class
  46. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop - next phase
  47. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Consensus from last night's meeting
  48. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Re: [The-New-York-Perl-Meetup-Group] Consensus from last night's
  49. 2011-05-30 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job opennings
  50. 2011-05-31 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!