How to resolve the algorithm Averages/Root mean square step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Averages/Root mean square step by step in the Quackery programming language
Table of Contents
Problem Statement
Compute the Root mean square of the numbers 1..10.
The root mean square is also known by its initials RMS (or rms), and as the quadratic mean. The RMS is calculated as the mean of the squares of the numbers, square-rooted:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Averages/Root mean square step by step in the Quackery programming language
Source code in the quackery programming language
[ $ "bigrat.qky" loadfile ] now!
[ [] swap
witheach
[ unpack 2dup v*
join nested join ] ] is squareall ( [ --> [ )
[ dup size n->v rot
0 n->v rot
witheach
[ unpack v+ ]
2swap v/ ] is arithmean ( [ --> n/d )
[ dip
[ squareall arithmean ]
vsqrt drop ] is rms ( [ n --> n/d )
say "The RMS of the integers 1 to 10, to 80 decimal places with rounding." cr
say "(Checked on Wolfram Alpha. The final digit is correctly rounded up.)" cr cr
' [ [ 1 1 ] [ 2 1 ] [ 3 1 ] [ 4 1 ] [ 5 1 ]
[ 6 1 ] [ 7 1 ] [ 8 1 ] [ 9 1 ] [ 10 1 ] ]
( ^^^ the integers 1 to 10 represented as a nest of nested rational numbers )
80 rms
80 point$ echo$
You may also check:How to resolve the algorithm Babbage problem step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Longest common substring step by step in the langur programming language
You may also check:How to resolve the algorithm Left factorials step by step in the Lambdatalk programming language
You may also check:How to resolve the algorithm Concurrent computing step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Apply a callback to an array step by step in the Brat programming language