Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,20 @@
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure calcrms is
type float_arr is array(1..10) of Float;
function rms(nums : float_arr) return Float is
sum : Float := 0.0;
begin
for p in nums'Range loop
sum := sum + nums(p)**2;
end loop;
return sqrt(sum/Float(nums'Length));
end rms;
list : float_arr;
begin
list := (1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0);
put( rms(list) , Exp=>0);
end calcrms;

View file

@ -0,0 +1,21 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. QUADRATIC-MEAN-PROGRAM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 QUADRATIC-MEAN-VARS.
05 N PIC 99 VALUE 0.
05 N-SQUARED PIC 999.
05 RUNNING-TOTAL PIC 999 VALUE 0.
05 MEAN-OF-SQUARES PIC 99V9(16).
05 QUADRATIC-MEAN PIC 9V9(15).
PROCEDURE DIVISION.
CONTROL-PARAGRAPH.
PERFORM MULTIPLICATION-PARAGRAPH 10 TIMES.
DIVIDE RUNNING-TOTAL BY 10 GIVING MEAN-OF-SQUARES.
COMPUTE QUADRATIC-MEAN = FUNCTION SQRT(MEAN-OF-SQUARES).
DISPLAY QUADRATIC-MEAN UPON CONSOLE.
STOP RUN.
MULTIPLICATION-PARAGRAPH.
ADD 1 TO N.
MULTIPLY N BY N GIVING N-SQUARED.
ADD N-SQUARED TO RUNNING-TOTAL.

View file

@ -0,0 +1,5 @@
(defun rms (nums)
(sqrt (/ (apply '+ (mapcar (lambda (x) (* x x)) nums))
(float (length nums)))))
(rms (number-sequence 1 10))

View file

@ -0,0 +1,14 @@
function rms(sequence s)
atom sum
if length(s) = 0 then
return 0
end if
sum = 0
for i = 1 to length(s) do
sum += power(s[i],2)
end for
return sqrt(sum/length(s))
end function
constant s = {1,2,3,4,5,6,7,8,9,10}
? rms(s)

View file

@ -0,0 +1,3 @@
rms[array] := sqrt[sum[map[{|x| x^2}, array]] / length[array]]
println[rms[array[1 to 10]]]

View file

@ -1,7 +1,7 @@
// version 1.0.5-2
fun quadraticMean(vector: Array<Double>) : Double {
val sum = vector.sumByDouble { it * it }
val sum = vector.sumOf { it * it }
return Math.sqrt(sum / vector.size)
}

View file

@ -1,4 +1,4 @@
function sumsq(a, ...) return a and a^2 + sumsq(...) or 0 end
function rms(t) return (sumsq(unpack(t)) / #t)^.5 end
function rms(t) return (sumsq(table.unpack(t)) / #t)^.5 end
print(rms{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})

View file

@ -0,0 +1,6 @@
function get-rms([float[]]$nums){
$sqsum=$nums | foreach-object { $_*$_} | measure-object -sum | select-object -expand Sum
return [math]::sqrt($sqsum/$nums.count)
}
get-rms @(1..10)

View file

@ -0,0 +1,3 @@
RMS ← √÷⊃⧻/+≡ⁿ2
RMS +1⇡10