From 6cba5dc72cda8c7bd527ae1e094a8bf678a8e83c Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Wed, 20 Nov 2024 21:40:06 -0500 Subject: Change logarithms to binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After thinking about how I want to best represent logarithms, I think the best way is to see them as equivalent to the size of a digit. Binary logarithms allow for using a familiar unit (bits) to represent this size. Nepers exist for the natural logarithm, but almost no one uses them. Also, because binary is the smallest base out there, this value will always be ≥1. This means I'm making the most out of my digits! This does mean that digit length isn't immediately obvious, but this is the same idea as "1 km = 1000 m" meaning that the number of km is 1/1000 the number of m - using the regular logarithm is like associating the km with the number 1000, using the reciprocoal is like associating it with 1/1000=0.001. Documentation has been changed to reflect this. --- README.org | 6 ++---- factor_info.go | 14 ++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index ad462e4..09fab4a 100644 --- a/README.org +++ b/README.org @@ -82,10 +82,8 @@ Some radices fall into certain classes that indicate they have many useful facto - Colossally Abundant :: Pick a positive number e, and adjust the FUS for size by dividing each FUS by the radix to the power of e. Then, one number will have the best adjusted FUS out of all possible radices (the ultimate winner is different for different values of e). These numbers are called colossally abundant numbers, and they can be seen as the best radices (in terms of factors). ** Multiplication Table Complexity The MTC is an estimate of how difficult it is to learn a radix's multiplication table. Every row except 0, 1 and the last one (which have their own patterns) is assigned a difficulty equal to the length of the pattern in its last digit, and these difficulties are summed to get the overall MTC. -** Natural Logarithm -The radix's natural logarithm indicates its information density - how much information it can fit into a digit. Radices with higher logarithms will be able to count higher with fewer digits, and approximations will be more accurate for the same number of decimal places. - -Specifically, numbers in radix a will have ln(b)/ln(a) times as many digits as numbers in radix b. For example, ln(20)/ln(10)≈1.30, so decimal numbers will have around 30% more digits than vigesimal numbers. +** Base-2 Logarithm +The radix's base-2 logarithm indicates its information density - how much information it can fit into a digit. Radices with higher logarithms will be able to count higher with fewer digits, and approximations will be more accurate for the same number of decimal places. Specifically, one digit in radix n is equivalent to log_2(n) bits (base-2 digits). ** Copyright & Contact Info radix_info: gives some information about number radices Copyright (C) 2023 Adrien Hopkins diff --git a/factor_info.go b/factor_info.go index 1988b2c..8939f5a 100644 --- a/factor_info.go +++ b/factor_info.go @@ -55,11 +55,9 @@ type factorInfo struct { // This is not calculated if the radix is too large - in this case // this field will be nil. MTC *uint64 - // The radix's natural logarithm. This determines the length of numbers - // in this radix - higher Ln means numbers take up fewer digits. - // If c = log(a)/log(b), then numbers in radix b will be around - // c times longer than numbers in radix a. - Ln float64 + // The radix's base-2 logarithm. + // One digit in this radix is equivalent to this many bits. + Log2 float64 // Information about each digit's compatibility with the radix. // This determines what kind of decimal expansion the digit's // reciprocoal has and what patterns are in its row of the multiplication @@ -113,7 +111,7 @@ func getFactorInfo(a args) *factorInfo { return &factorInfo{radix, factors.PrimeFactorize(radix), r_factors, factors.Score(radix), totativeCount, totativeRatio, totativeDigits, factors.BasicRank(radix), factors.Type(radix), - mtc_ptr, math.Log(float64(radix)), digitMap} + mtc_ptr, math.Log2(float64(radix)), digitMap} } func (fi *factorInfo) writeTo(w io.Writer) { @@ -140,7 +138,7 @@ func (fi *factorInfo) writeTo(w io.Writer) { "Multiplication Table Complexity is between %.6g and %.6g.\n", low_mtc_est, high_mtc_est) } - fmt.Fprintf(w, "Natural Logarithm: %.3f\n", fi.Ln) + fmt.Fprintf(w, "Base-2 Logarithm: %.3f\n", fi.Log2) if len(fi.DigitMap) > 0 { writeDigitMap(w, fi.DigitMap) } @@ -157,7 +155,7 @@ func (fi *factorInfo) writeToCompact(w io.Writer) { high_mtc_est := float32(fi.Radix) * float32(fi.Radix-2) fmt.Fprintf(w, "%.4g ≤ MTC ≤ %.4g | ", low_mtc_est, high_mtc_est) } - fmt.Fprintf(w, "ln: %.2f", fi.Ln) + fmt.Fprintf(w, "log2: %.2f", fi.Log2) fmt.Fprintln(w) if len(fi.DigitMap) > 0 { writeDigitMapCompact(w, fi.DigitMap) -- cgit v1.2.3