Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function Get-Square {
param([double]$Number)
$n = [math]::Abs($Number)
Write-Output ($n * $n)
}
#https://en.wikipedia.org/wiki/Root_mean_square
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)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment