How to resolve the algorithm Averages/Pythagorean means step by step in the Ring programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Averages/Pythagorean means step by step in the Ring programming language
Table of Contents
Problem Statement
Compute all three of the Pythagorean means of the set of integers 1 through 10 (inclusive). Show that
A (
x
1
, … ,
x
n
) ≥ G (
x
1
, … ,
x
n
) ≥ H (
x
1
, … ,
x
n
)
{\displaystyle A(x_{1},\ldots ,x_{n})\geq G(x_{1},\ldots ,x_{n})\geq H(x_{1},\ldots ,x_{n})}
for this set of positive integers.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Averages/Pythagorean means step by step in the Ring programming language
Source code in the ring programming language
decimals(8)
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
see "arithmetic mean = " + arithmeticMean(array) + nl
see "geometric mean = " + geometricMean(array) + nl
see "harmonic mean = " + harmonicMean(array) + nl
func arithmeticMean a
return summary(a) / len(a)
func geometricMean a
b = 1
for i = 1 to len(a)
b *= a[i]
next
return pow(b, (1/len(a)))
func harmonicMean a
b = list(len(a))
for nr = 1 to len(a)
b[nr] = 1/a[nr]
next
return len(a) / summary(b)
func summary s
sum = 0
for n = 1 to len(s)
sum += s[n]
next
return sum
You may also check:How to resolve the algorithm Naming conventions step by step in the 360 Assembly programming language
You may also check:How to resolve the algorithm Abbreviations, easy step by step in the Rust programming language
You may also check:How to resolve the algorithm Compiler/virtual machine interpreter step by step in the ObjectIcon programming language
You may also check:How to resolve the algorithm Unbias a random generator step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Color wheel step by step in the Delphi programming language