Ever needed to get the Root Mean Square of a set before? Me neither, but I went ahead and created a small function for it anyway.

Enjoy. ­čÖé

function Get-Square {
$n = [math]::Abs($Number)
Write-Output ($n * $n)
function Get-RootMeanSquare {
param ([double[]]$NumberSet)
$squaredNumberSet = New-Object System.Collections.ArrayList
foreach ($number in $NumberSet) {
[void]$squaredNumberSet.Add((Get-Square $number))
Write-Output ([math]::Sqrt((($squaredNumberSet | Measure-Object Average).Average)))

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s