Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Ternary numeral system

From Wikipedia, the free encyclopedia
Base-3 numeral system

Part ofa series on
Numeral systems
List of numeral systems

Aternary/ˈtɜːrnəri/numeral system (also calledbase 3 ortrinary[1]) hasthree as itsbase. Analogous to abit, a ternarydigit is atrit (trinary digit). One trit is equivalent tolog2 3 (about 1.58496) bits ofinformation.

Althoughternary most often refers to a system in which the three digits are all non–negative numbers; specifically0,1, and2, the adjective also lends its name to thebalanced ternary system; comprising the digits−1, 0 and +1, used in comparison logic andternary computers.

Comparison to other bases

[edit]

Representations ofinteger numbers in ternary do not get uncomfortably lengthy as quickly as inbinary. For example,decimal365(10) orsenary1405(6) corresponds to binary101101101(2) (ninebits) and to ternary111112(3) (six digits). However, they are still far less compact than the corresponding representations in bases such asdecimal – see below for a compact way to codify ternary using nonary (base 9) andseptemvigesimal (base 27).

A ternarymultiplication table
×12101112202122100
112101112202122100
22112022101110112121200
1010201001101202002102201,000
1111221101212022201,0011,0121,100
12121011202022211,0101,0221,1111,200
20201102002201,0101,1001,1201,2102,000
21211122101,0011,0221,1201,2112,0022,100
22221212201,0121,1111,2102,0022,1012,200
1001002001,0001,1001,2002,0002,1002,20010,000
Numbers from 0 to 33 − 1 in standard ternary
Ternary012101112202122
Binary0110111001011101111000
Senary012345101112
Decimal012345678
Ternary100101102110111112120121122
Binary10011010101111001101111011111000010001
Senary131415202122232425
Decimal91011121314151617
Ternary200201202210211212220221222
Binary100101001110100101011011010111110001100111010
Senary303132333435404142
Decimal181920212223242526
Powers of 3 in ternary
Ternary110100100010000
Binary1111001110111010001
Senary131343213
Decimal1392781
Power3031323334
Ternary1000001000000100000001000000001000000000
Binary1111001110110110011000100010111100110100001100110011100011
Senary104332131404350213231043
Decimal2437292187656119683
Power3536373839

As forrational numbers, ternary offers a convenient way to represent1/3 as same as senary (as opposed to its cumbersome representation as an infinite string ofrecurring digits in decimal); but a major drawback is that, in turn, ternary does not offer a finite representation for1/2 (nor for1/4,1/8, etc.), because2 is not aprimefactor of the base; as with base two, one-tenth (decimal1/10, senary1/14) is not representable exactly (that would need e.g. decimal); nor is one-sixth (senary1/10, decimal1/6).

Fractions in ternary
Fraction1/21/31/41/51/61/71/81/91/101/111/121/13
Ternary0.10.10.020.01210.010.0102120.010.010.00220.002110.0020.002
Binary0.10.010.010.00110.0010.0010.0010.0001110.000110.00010111010.00010.000100111011
Senary0.30.20.130.10.10.050.0430.040.030.03134524210.030.024340531215
Decimal0.50.30.250.20.160.1428570.1250.10.10.090.0830.076923

Sum of the digits in ternary as opposed to binary

[edit]

The value of a binary number withn bits that are all 1 is2n − 1.

Similarly, for a numberN(b,d) with baseb andd digits, all of which are the maximal digit valueb − 1, we can write:

N(b,d) = (b − 1)bd−1 + (b − 1)bd−2 + … + (b − 1)b1 + (b − 1)b0,
N(b,d) = (b − 1)(bd−1 +bd−2 + … +b1 + 1),
N(b,d) = (b − 1)M.
bM =bd +bd−1 + … +b2 +b1 and
M = −bd−1 − bd−2 − ... − b1 − 1, so
bM − M =bd − 1, or
M =bd − 1/b − 1.

Then

N(b,d) = (b − 1)M,
N(b,d) =(b − 1)(bd − 1)/b − 1,
N(b,d) =bd − 1.

For a three-digit ternary number,N(3, 3) = 33 − 1 = 26 = 2 × 32 + 2 × 31 + 2 × 30 = 18 + 6 + 2.

Compact ternary representation: base 9 and 27

[edit]
Comparison between ternary and nonary
ternarynonary
000
011
022
103
114
125
206
217
228

Nonary/ˈnɒnəri/ (base 9, each digit is two ternary digits) orseptemvigesimal (base 27, each digit is three ternary digits) can be used for compact representation of ternary, similar to howoctal andhexadecimal systems are used in place ofbinary.

Practical usage

[edit]
Use of ternary numbers to balance an unknown integer weight from 1 to 40 kg with weights of 1, 3, 9 and 27 kg (4 ternary digits actually gives 34 = 81 possible combinations: −40 to +40, but only the positive values are useful)




In certain analog logic, the state of the circuit is often expressed ternary. This is most commonly seen inCMOS circuits, and also intransistor–transistor logic withtotem-pole output. The output is said to either be low (grounded), high, or open (high-Z). In this configuration the output of the circuit is actually not connected to anyvoltage reference at all. Where the signal is usually grounded to a certain reference, or at a certain voltage level, the state is said to be highimpedance because it is open and serves its own reference. Thus, the actual voltage level is sometimes unpredictable.

A rare "ternary point" in common use is for defensive statistics in Americanbaseball (usually just forpitchers), to denote fractional parts of an inning. Since the team on offense is allowed threeouts, each out is considered one third of a defensive inning and is denoted as.1. For example, if a player pitched all of the 4th, 5th and 6th innings, plus achieving 2 outs in the 7th inning, hisinnings pitched column for that game would be listed as3.2, the equivalent of3+23 (which is sometimes used as an alternative by some record keepers). In this usage, only the fractional part of the number is written in ternary form.[2][3]

Ternary numbers can be used to convey self-similar structures like theSierpinski triangle or theCantor set conveniently. Additionally, it turns out that the ternary representation is useful for defining the Cantor set and related point sets, because of the way the Cantor set is constructed. The Cantor set consists of the points from 0 to 1 that have a ternary expression that does not contain any instance of the digit 1.[4][5] Any terminating expansion in the ternary system is equivalent to the expression that is identical up to the term preceding the last non-zero term followed by the term one less than the last non-zero term of the first expression, followed by an infinite tail of twos. For example: 0.1020 is equivalent to 0.1012222... because the expansions are the same until the "two" of the first expression, the two was decremented in the second expansion, and trailing zeros were replaced with trailing twos in the second expression.

Ternary is the integer base with the lowestradix economy, followed closely bybinary andquaternary. This is due to its proximity to themathematical constante. It has been used for some computing systems because of this efficiency. It is also used to represent three-optiontrees, such as phone menu systems, which allow a simple path to any branch.

A form ofredundant binary representation called a binary signed-digit number system, a form ofsigned-digit representation, is sometimes used in low-level software and hardware to accomplish fast addition of integers because it can eliminatecarries.[6]

Binary-coded ternary

[edit]

Simulation of ternary computers using binary computers, or interfacing between ternary and binary computers, can involve use of binary-coded ternary (BCT) numbers, with two or three bits used to encode each trit.[7][8] BCT encoding is analogous tobinary-coded decimal (BCD) encoding. If the trit values 0, 1 and 2 are encoded 00, 01 and 10, conversion in either direction between binary-coded ternary and binary can be done inlogarithmic time.[9] A library ofC code supporting BCT arithmetic is available.[10]

Tryte

[edit]

Someternary computers such as theSetun defined atryte to be six trits[11] or approximately 9.5bits (holding more information than thede factobinarybyte).[12]

See also

[edit]

References

[edit]
  1. ^Kindra, Vladimir; Rogalev, Nikolay; Osipov, Sergey; Zlyvko, Olga; Naumov, Vladimir (2022)."Research and Development of Trinary Power Cycles".Inventions.7 (3): 56.doi:10.3390/inventions7030056.ISSN 2411-5134.
  2. ^Ashley MacLennan (2019-01-09)."A complete beginner's guide to baseball stats: Pitching statistics, and what they mean".Bless You Boys. Retrieved2020-07-30.
  3. ^"Stats - Team - Pitching". MLB (Major League Baseball). Retrieved2020-07-30.
  4. ^Soltanifar, Mohsen (2006). "On A sequence of cantor Fractals".Rose Hulman Undergraduate Mathematics Journal.7 (1). Paper 9.
  5. ^Soltanifar, Mohsen (2006). "A Different Description of A Family of Middle–α Cantor Sets".American Journal of Undergraduate Research.5 (2):9–12.
  6. ^Phatak, D. S.; Koren, I. (1994)."Hybrid signed–digit number systems: a unified framework for redundant number representations with bounded carry propagation chains"(PDF).IEEE Transactions on Computers.43 (8):880–891.CiteSeerX 10.1.1.352.6407.doi:10.1109/12.295850.
  7. ^Frieder, Gideon; Luk, Clement (February 1975). "Algorithms for Binary Coded Balanced and Ordinary Ternary Operations".IEEE Transactions on Computers.C-24 (2):212–215.doi:10.1109/T-C.1975.224188.S2CID 38704739.
  8. ^Parhami, Behrooz; McKeown, Michael (2013-11-03). "Arithmetic with binary-encoded balanced ternary numbers".2013 Asilomar Conference on Signals, Systems and Computers. Pacific Grove, California, US. pp. 1130–1133.doi:10.1109/ACSSC.2013.6810470.ISBN 978-1-4799-2390-8.S2CID 9603084.{{cite book}}: CS1 maint: location missing publisher (link)
  9. ^Jones, Douglas W. (June 2016)."Binary Coded Ternary and its Inverse".
  10. ^Jones, Douglas W. (2015-12-29)."Ternary Data Types for C Programmers".
  11. ^Impagliazzo, John; Proydakov, Eduard (2006).Perspectives on Soviet and Russian Computing. First IFIP WG 9.7 Conference, SoRuCom 2006. Petrozavodsk, Russia:Springer.ISBN 978-3-64222816-2.
  12. ^Brousentsov, N. P.; Maslov, S. P.; Ramil Alvarez, J.; Zhogolev, E. A."Development of ternary computers at Moscow State University". Retrieved2010-01-20.

Further reading

[edit]

External links

[edit]
Uninterpreted
Numeric
Pointer
Text
Composite
Other
Related
topics
Retrieved from "https://en.wikipedia.org/w/index.php?title=Ternary_numeral_system&oldid=1322896402"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp