How to resolve the algorithm Averages/Pythagorean means step by step in the 11l programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Averages/Pythagorean means step by step in the 11l 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 11l programming language
Source code in the 11l programming language
F amean(num)
R sum(num)/Float(num.len)
F gmean(num)
R product(num) ^ (1.0/num.len)
F hmean(num)
return num.len / sum(num.map(n -> 1.0/n))
V numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(amean(numbers))
print(gmean(numbers))
print(hmean(numbers))
You may also check:How to resolve the algorithm Calendar step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Sum of a series step by step in the NewLISP programming language
You may also check:How to resolve the algorithm Rate counter step by step in the Ruby programming language
You may also check:How to resolve the algorithm Anonymous recursion step by step in the Rust programming language
You may also check:How to resolve the algorithm Pangram checker step by step in the AppleScript programming language