Clever Geek Handbook
📜 ⬆️ ⬇️

Ternary code

A ternary code is a way of representing data in the form of a combination of three characters , usually denoted by the numbers 0, 1, 2.

The ternary code can be non-positional and positional .

It is known from combinatorics that, in the case of non-positional coding , the number of combinations (codes) is the number of combinations with repetitions fromn {\ displaystyle n} n byk {\ displaystyle k} k and equal to the binomial coefficient :

(n+k-onek)=(-one)k(-nk)=(n+k-one)!k!(n-one)!={\ displaystyle {n + k-1 \ choose k} = (- 1) ^ {k} {- n \ choose k} = {\ frac {\ left (n + k-1 \ right)!} {k! \ left (n-1 \ right)!}} =} {n + k-1 \ choose k} = (-1) ^ k {-n \ choose k} = \ frac {\ left (n + k-1 \ right)!} {k! \ left (n-1 \ right)!} =
=(3+k-one)!k!(3-one)!=(k+2)!k!2!=(k+2)!k!2=(k+2)(k+one)2{\ displaystyle = {\ frac {\ left (3 + k-1 \ right)!} {k! \ left (3-1 \ right)!}} = {\ frac {\ left (k + 2 \ right) !} {k! 2!}} = {\ frac {(k + 2)!} {k! 2}} = {\ frac {(k + 2) (k + 1)} {2}}} = \ frac {\ left (3 + k-1 \ right)!} {k! \ left (3-1 \ right)!} = \ frac {\ left (k + 2 \ right)!} {k! 2 !} = \ frac {(k + 2)!} {k! 2} = \ frac {(k + 2) (k + 1)} {2} , [possible states (codes)], i.e.

described by a parabola :

Nnp(n)=(n+2)(n+one)/2{\ displaystyle N_ {np} (n) = (n + 2) (n + 1) / 2} N_ {np} (n) = (n + 2) (n + 1) / 2 , [possible states (codes)], where
n{\ displaystyle n} n - the number of ternary discharges ( throws , trit s).

For example, in a non-position coding system, in one 3-grit code (n = 3) the number of possible states (codes) is equal to:

Nnp(n)=(n+2)(n+one)/2=five⋅four/2=20/2=ten{\ displaystyle N_ {np} (n) = (n + 2) (n + 1) / 2 = 5 \ cdot 4/2 = 20/2 = 10} N_ {np} (n) = (n + 2) (n + 1) / 2 = 5 \ cdot4 / 2 = 20/2 = 10 , [possible states (codes)].

In the case of positional coding , the number of combinations (codes) of the n- digit ternary code is equal to the number of placements with repetitions :

Np(n)=A¯(3,n)=A¯3n=3n{\ displaystyle N_ {p} (n) = {\ bar {A}} (3, n) = {\ bar {A}} _ {3} ^ {n} = 3 ^ {n}} N_ {p} (n) = \ bar {A} (3, n) = \ bar {A} _3 ^ n = 3 ^ n where
A¯(3,n)=A¯3n{\ displaystyle {\ bar {A}} (3, n) = {\ bar {A}} _ {3} ^ {n}} \ bar {A} (3, n) = \ bar {A} _3 ^ n - number of codes
n{\ displaystyle \ n} \ n - the number of bits of the ternary code.

Using two ternary digits and position coding, you can encode any objects using nine different combinations: 00 01 02 10 11 12 20 21 22 (with non-position coding of combinations - 6, because three pairs are 01 and 10, 02 and 20, 12 and 21 count as three combinations); using three ternary digits - using twenty-seven different combinations: 000 001 002 010 011 012 020 021 022 100 101 102 110 111 112 120 121 122 200 201 202 210 211 212 220 221 222 (with non-positional encoding of combinations - 10), and so Further.

As the positional ternary code increases by 1, the number of different combinations in the positional ternary code triple.

Ternary codes are combinations of three elements and are not a ternary number system , but are used in one or another version of ternary number systems as a basis. Moreover, they can be used to encode numbers in number systems with any base. However, for a number system with a base of two (that is, for binary) they are redundant and can only be partially used.

When encoding alphanumeric characters ( signs ), ternary code does not assign weighting factors, as is done in number systems in which the ternary code is used to represent numbers , and only the serial number of the code from the set of repetition arrangements is used .

numerical

value

ternary

code

000
one01
202
3ten
foureleven
five12
620
721
eight22

See also

  • Binary code
  • Trinity number system
  • Trit
Source - https://ru.wikipedia.org/w/index.php?title=Ternational_code&oldid=82701473


More articles:

  • Klostridia
  • Groupage
  • Tablespoon
  • Kuchank, Jakub
  • The Lemon Song
  • Birobidzhan district
  • Hirsutism
  • Kuchko
  • Kuchinsky
  • Adzhigolsky lighthouse

All articles

Clever Geek | 2019