A snippet
Statistic .net
Codename: basicstats
I created this class to help me made the Tag Cloud system for this site. It is a simple class to calculate the arithmetic Mean and the Standard Deviation.
Following the full code of the snippet
You can copy and paste it from here, otherwise you can download it in .snippet file format by clicking here.
Public Class clsStatistics
Dim mValueArray As Double()
Dim mMeanValue As Double
Public Property valueArray() As Double()
Get
Return mValueArray
End Get
Set(ByVal value As Double())
mValueArray = value
End Set
End Property
Public ReadOnly Property meanValue() As Double
Get
Return mMeanvalue
End Get
End Property
Public Function Mean(ByVal values As Double()) As Double
Dim sum As Double = 0
Dim count As Integer = 0
For Each d As Double In values
sum += d
count += 1
Next
mMeanValue = sum / count
Return sum / count
End Function
Public Function StdDevFromStored() As Double
Dim meanValue As Double
Dim sumOfDiffSquares As Double = 0
Dim count As Integer = 0
Dim diff As Double
If mValueArray Is Nothing Then
Return 0
Else
meanValue = Mean(mValueArray)
For Each d As Double In mValueArray
diff = (d - meanValue)
sumOfDiffSquares += diff ^ 2
count += 1
Next
Return Math.Sqrt(sumOfDiffSquares / count)
End If
End Function
End Class
|
Go back to snippet page.

Risultato del processo OK
Ajax News temporaneamente sospese in attesa della nuova versione.
Il pulsante di AddThis permette di aggiungere un segnalibro per questa pagina nei
più diffusi siti internet.
Il contenuto di questo sito internet, se non diversamente specificato, è pubblicato
sotto una
Licenza Creative Commons.
The content of this website is published under a
Creative Commons License, unless otherwise stated.
Questo file OPML contiene l'elenco aggiornato di tutti i feed RSS disponibili sul
sito.
|
«And he piled upon the whale's white hump, the sum of all the rage and hate felt by his whole race. If his chest had been a cannon, he would have shot his heart upon it. »
Captain Jean-Luc Picard
"First Contact" - [Quoting 'Moby Dick']
|
Leggi tutte le
citazioni
|
Contrariamente a quanto comunemente si pensa, un veicolo spaziale che rientra nell'atmosfera terrestre viene riscaldato dall'attrito solo per circa il 1% del totale. La gran parte del calore viene dalla compressione adiabatica del gas che sta davanti al veicolo: si calcola che la temperatura all'interno dell'onda d'urto possa raggiungere i 10.000 K. Secondo i calcoli degli ingegneri della NASA, lo scudo termico della futura capsula Orion, di ritorno da un viaggio nell'orbita lunare, raggiungerà una temperatura superiore ai 2.900 K.
NASA (2005)
|
Leggi tutte le curiosità
be sorted @
nimbo.net