% RFC compliant, synonym for Calc. APU: <> == Calc. % Synonym for Calc. Eval: <> == Calc. % RFC compliant Sum: <> == <$a> == $a <$a $b> == Sum:<Calc:<$a + $b .>> . % RFC compliant Add: <> == <$a $b> == Calc:<$a + $b .> <$a> . % RFC compliant Multiply: <> == <$a $b> == Calc:<$a * $b .> <$a> . % RFC compliant Power: <> == <$a $b> == Calc:<$b ^ $a .> <$a> . % Zdatr internal MathSelect: <try $op $a> == $a <try $op $a $b> == <select $op Calc:<$a $op $b .> $a $b> <select $op 1 $a $b> == <try $op $a> <select $op 0 $a $b> == <try $op $b> . % RFC compliant Max: <> == Fail <$a> == MathSelect:<try '>' $a> . % RFC compliant Min: <> == Fail <$a> == MathSelect:<try '<' $a> . % Zdatr addition Mean: <> == Fail <$i> == CALC:<Sum / Length .> . % Zdatr addition, generates random number sequence from first to second RandomSeries: <> == Fail <$a $b> == Permute:<Series:<$a 1 Calc:<$b - $a + 1 .>>> . % Zdatr addition, generates random number from first to second Random: <> == First:<RandomSeries> . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Some illustrations of DATR CALC applications. D. Gibbon, 7 September 1998 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Median: Odd number of observations, middle observation in a % sorted distribution. Even number of observations the mean of % the two middle observations. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Zdatr addition Median: <> == Fail <$a> == <if OddEvenCheck> <if odd> == OddMedian <if even> == EvenMedian . % Zdatr internal OddEvenCheck: <> == even <$a> == odd <$a $b> == <> . % Zdatr internal OddMedian: <> == SUBSEQ:<CALC:< ( Length + 1 ) / 2 .> 1 SortN .> . % Zdatr internal EvenMedian: <> == Mean:<SUBSEQ:<CALC:< Length / 2 .> 2 SortN> .> . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Variance: Sum of squares of the deviations of the observations % from the mean observation divided by one less than the total % number of observations. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Zdatr addition Variance: <> == CALC:<Sum:<SquaredDifferences:<Mean> .> / ( Length - 1 ) .> . % Zdatr internal SquaredDifferences: <> == 0 <$a $b> == CALC:< ( $a - $b ) * ( $a - $b ) .> <$a> . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Standard Deviation: The positive square root of the variance. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Zdatr addition StandardDeviation: <> == 0 <$a> == CALC:< sqrt ( Variance ) .> . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Base 8 and 16 to base 10 conversions for characters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Zdatr addition Hex2Dec: <> == Ascii . % Zdatr addition Octal2Dec: <> == Ascii .