Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -1,8 +1,5 @@
|
|||
func rms v[] .
|
||||
for v in v[]
|
||||
sum += v * v
|
||||
.
|
||||
for v in v[] : sum += v * v
|
||||
return sqrt (sum / len v[])
|
||||
.
|
||||
v[] = [ 1 2 3 4 5 6 7 8 9 10 ]
|
||||
print rms v[]
|
||||
print rms [ 1 2 3 4 5 6 7 8 9 10 ]
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ extension op
|
|||
|
||||
public program()
|
||||
{
|
||||
console.printLine(new Range(1, 10).RootMeanSquare)
|
||||
Console.printLine(new Range(1, 10).RootMeanSquare)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
local function rms(a)
|
||||
local len = #a
|
||||
if len == 0 then return nil end
|
||||
return math.sqrt(a:reduce(|acc, i| -> acc + i * i) / len)
|
||||
end
|
||||
|
||||
print(rms(range(1, 10)))
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
main (parms):+
|
||||
t =: new tuple from 1 upto 10
|
||||
print t, '->', vector t norm
|
||||
|
||||
\ input can be tuple, row or map (class function used)
|
||||
vector (@) norm:
|
||||
sq =: 0.0
|
||||
?# v =: @::give values
|
||||
sq =+ v * v
|
||||
:> float (sq / @.Count) sqrt
|
||||
Loading…
Add table
Add a link
Reference in a new issue