Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,20 +0,0 @@
|
|||
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;
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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.
|
||||
|
|
@ -8,7 +8,7 @@ extension op
|
|||
= (self.selectBy::(x => x * x).summarize(Real.new()) / self.Length).sqrt();
|
||||
}
|
||||
|
||||
public program()
|
||||
public Program()
|
||||
{
|
||||
Console.printLine(new Range(1, 10).RootMeanSquare)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
(defun rms (nums)
|
||||
(sqrt (/ (apply '+ (mapcar (lambda (x) (* x x)) nums))
|
||||
(float (length nums)))))
|
||||
|
||||
(rms (number-sequence 1 10))
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
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)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue