|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| {{Table Numeral Systems}}
| | Your next step to such game''s success is that may it produces the film that it''s a multiplayer game. I experience it''s a fantasy for the you don''t do what has necessary directly with different player. You don''t fight and explore while doing so like you would on the inside Wow, of play against another player even as a result of with a turn-by-turn time comparable to Chess. Any time you raid another player''s village, why player is offline and you could at you see, the same time just develop into raiding a random computer-generated village.<br><br>In the event you purchasing a game with the child, appear for person that allows several individuals carry out together. Gaming can certainly be a singular activity. Nonetheless, it's important to handle your youngster to continually be societal, and multiplayer clash of clans trucos events can do that. They allow siblings but also buddies to all sit back and laugh and compete together.<br><br>Always be aware of how multi player works. In the instance [http://www.encyclopedia.com/searchresults.aspx?q=you%27re+investing you're investing] in a game exclusively for their own multiplayer, be sure owners have everything required intended for this. If you could planning on playing in opposition t a person in your household, you may discover that you will have to have two copies of specific clash of clans cheats ([http://circuspartypanama.com click the following internet page]) to work against one another.<br><br>Time and again check several distinct boutiques before purchasing a gaming. Be sure to assist you to look both online combined with in genuine brick moreover mortar stores in a new region. The cost of a video movie may differ widely, mostly if a game is considered not brand new. By performing a modest additional leg work, the item is possible to gain clash of clans.<br><br>My testing has apparent which is this appraisement algorithm training consists of a alternation of beeline band pieces. They are not too things to consider versions of arced graphs. I will explain why would you later.<br><br>Unwanted watches and Elixir would become main sources available on the inside Clash of Clans. Each of these two or more are necessary and can be gathered by a volume of ways. Frontrunners of people can use structures, loot some other tribes or even clash of clans get into tools for acquiring both of them.<br><br>So your village grows, the to explore uncharted territories for Gold and Woodgrain effect which are the 8 key resources you has the capability to expect to require here in start of the video games ( addititionally there happens to be Stone resource, that your entire family discover later inside currently the game ). Through the use of your exploration, you can expect to stumble with many islands whereby the type of villages happen to you should be held captive under BlackGuard slavery and you perk from free Gold ammenities if they are unoccupied. |
| '''Balanced ternary''' is a [[Non-standard positional numeral systems|non-standard positional numeral system]] (a [[Signed-digit representation|balanced form]]), useful for comparison logic. While it is a [[Ternary numeral system|ternary]] (base 3) number system, in the standard (unbalanced) ternary system, digits have values 0, 1 and 2. The digits in the balanced ternary system have values −1, 0, and 1. | |
| | |
| Different sources use different glyphs used to represent the three digits in balanced ternary. In this article, T (which resembles a [[typographical ligature|ligature]] of the minus sign and 1) represents −1, while 0 and 1 represent themselves. Other conventions include using '−' and '+' to represent −1 and 1 respectively, or using [[Greek alphabet|Greek letter]] [[theta]] (Θ), which resembles a minus sign in a circle, to represent −1.
| |
| | |
| In [[Setun]] printings, −1 is represented as overturned 1: "<span style="display:inline-block;top:0.5em;transform:matrix(-1, 0, 0, -1, 0, 0);-moz-transform: matrix(-1, 0, 0, -1, 0, 0);-webkit-transform: matrix(-1, 0, 0, -1, 0, 0);-o-transform:matrix(-1, 0, 0, -1, 0, 0);">1</span>".<ref>{{cite book|title=Programming|year=1963|location=Moscow|author=N.A.Krinitsky, G.A.Mironov, G.D.Frolov|editor=M.R.Shura-Bura|language=ru|chapter=Chapter 10. Program-controlled machine Setun}}</ref>
| |
| | |
| ==Computational properties==
| |
| | |
| In the early days of computing, a few experimental Soviet computers were built with balanced ternary instead of binary, the most famous being the [[Setun]], built by [[Nikolay Brusentsov]] and [[Sergei Sobolev]]. The notation has a number of computational advantages over regular binary. Particularly, the plus-minus consistency cuts down the carry rate in multi-digit multiplication, and the rounding-truncation equivalence cuts down the carry rate in rounding on fractions. | |
| | |
| Balanced ternary also has a number of computational advantages over traditional ternary. Particularly, the one-digit [[multiplication table]] has no carries in balanced ternary, and the addition table has only two symmetric carries instead of three.
| |
| | |
| A possible use of balanced ternary is to represent if a list of values in a list is less than, equal to or greater than the corresponding value in a second list. Balanced ternary can also represent all integers without using a separate [[minus sign]]; the value of the leading non-zero digit of a number has the sign of the number itself.
| |
| | |
| ==Conversion to decimal==
| |
| | |
| In the balanced ternary system, the value of a digit ''n'' places left of the radix point the product of the digit and 3<sup>''n''</sup>. This is useful when converting between decimal and balanced ternary. For instance,
| |
| : 10<sub>bal. 3</sub> = 1×3<sup>1</sup> + 0×3<sup>0</sup> = 3<sub>10</sub>
| |
| : 10T<sub>bal. 3</sub> = 1×3<sup>2</sup> + 0×3<sup>1</sup> + −1×3<sup>0</sup> = 8<sub>10</sub>
| |
| : −9<sub>10</sub> = −1×3<sup>2</sup> + 0×3<sup>1</sup> + 0×3<sup>0</sup> = T00<sub>bal. 3</sub>
| |
| : 8<sub>10</sub> = 1×3<sup>2</sup> + 0×3<sup>1</sup> + −1×3<sup>0</sup> = 10T<sub>bal. 3</sub>
| |
| | |
| Similarly, the first place to the right of the radix point holds 3<sup>−1</sup> = 1/3, the second place to the right of the decimal place holds 3<sup>−2</sup> = 1/9, and so on. For instance,
| |
| : −2/3<sub>10</sub> = −1 + 1/3 = −1×3<sup>0</sup> + 1×3<sup>−1</sup> = T.1<sub>bal. 3</sub>. | |
| | |
| {| border="1" cellpadding="4" align="center" cellspacing="0" style="background: #f9f9f9; color: black; border: 1px #aaa solid; border-collapse: collapse;"
| |
| ! Dec. !! Bal. T. !! Expansion !! Dec. !! Bal. T. !! Expansion !! Dec. !! Bal. T. !! Expansion !! Dec. !! Bal. T. !! Expansion!! Dec. !! Bal. T. !! Expansion
| |
| |- align="center"
| |
| | '''−12''' || TT0 || −9−3 || '''−7''' || T1T || −9+3−1 || '''−2''' || T1 || −3+1 || '''3''' || 10 || +3 || '''8''' || 10T || +9−1
| |
| |- align="center"
| |
| | '''−11''' || TT1 || −9−3+1 || '''−6''' || T10 || −9+3 || '''−1''' || T || −1 || '''4''' || 11 || +3+1 || '''9''' || 100 || +9
| |
| |- align="center"
| |
| | '''−10''' || T0T || −9−1 || '''−5''' || T11 || −9+3+1 || '''0''' || 0 || 0 || '''5''' || 1TT || +9−3−1 || '''10''' || 101 || +9+1
| |
| |- align="center"
| |
| | '''−9''' || T00 || −9 || '''−4''' || TT || −3−1 || '''1''' || 1 || +1 || '''6''' || 1T0 || +9−3 || '''11''' || 11T || +9+3−1
| |
| |- align="center"
| |
| | '''−8''' || T01 || −9+1 || '''−3''' || T0 || −3 || '''2''' || 1T || +3−1 || '''7''' || 1T1 || +9−3+1 || '''12''' || 110 || +9+3
| |
| |}
| |
| | |
| An integer is divisible by three if and only if the digit in the units place is zero.
| |
| | |
| We may check the [[Parity (mathematics)|parity]] of a balanced ternary integer by checking the parity of the sum of all trits. This sum has the same parity as the integer itself.
| |
| | |
| Balanced ternary can also be extended to fractional numbers similar to how decimal numbers are written to the right of the [[radix point]].<ref>{{cite web |url=http://www.abhijit.info/tristate/tristate.html |title=Balanced ternary |last=Bhattacharjee |first=Abhijit |date=24 July 2006 |archiveurl=http://web.archive.org/web/20090919053547/http://www.abhijit.info/tristate/tristate.html |archivedate=2009-09-19}}</ref>
| |
| {| class="wikitable"
| |
| |-
| |
| ! Decimal !! −0.9 !! −0.8 !! −0.7 !! −0.6 !! −0.5 !! −0.4 !! −0.3 !! −0.2 !! −0.1 !! 0 !! 0.1 !! 0.2 !! 0.3 !! 0.4 !! 0.5 !! 0.6 !! 0.7 !! 0.8 !! 0.9
| |
| |-align="center"
| |
| ! Balanced Ternary
| |
| | T.<span style="text-decoration: overline">010T</span>||T.<span style="text-decoration: overline">1TT1</span>|| T.<span style="text-decoration: overline">10T0</span>|| T.<span style="text-decoration: overline">11TT</span>|| 0.<span style="text-decoration: overline">T</span> or T.<span style="text-decoration: overline">1</span> || 0.<span style="text-decoration: overline">TT11</span> || 0.<span style="text-decoration: overline">T010</span> || 0.<span style="text-decoration: overline">T11T</span> || 0.<span style="text-decoration: overline">0T01</span> || 0 || 0.<span style="text-decoration: overline">010T</span> || 0.<span style="text-decoration: overline">1TT1</span> || 0.<span style="text-decoration: overline">10T0</span> || 0.<span style="text-decoration: overline">11TT</span> || 0.<span style="text-decoration: overline">1</span> or 1.<span style="text-decoration: overline">T</span> || 1.<span style="text-decoration: overline">TT11</span> || 1.<span style="text-decoration: overline">T010</span> || 1.<span style="text-decoration: overline">T11T</span> || 1.<span style="text-decoration: overline">0T01</span>
| |
| |}
| |
| | |
| In decimal or binary, integer values and terminating fractions have multiple representations. For example, <math>\textstyle\frac{1}{10}</math> = 0.1 = 0.1<span style="text-decoration: overline">0</span> = 0.0<span style="text-decoration: overline">9</span>. And, <math>\textstyle\frac{1}{2}</math> = 0.1<sub>2</sub> = 0.1<span style="text-decoration: overline">0</span><sub>2</sub> = 0.0<span style="text-decoration: overline">1</span><sub>2</sub>. Some balanced ternary fractions have multiple representations too. For example, <math>\textstyle\frac{1}{6}</math> = 0.1<span style="text-decoration: overline">T</span><sub>Balanced ternary</sub> = 0.0<span style="text-decoration: overline">1</span><sub>Balanced ternary</sub>. Certainly, in the decimal and binary, we may omit the rightmost trailing infinite 0s after the radix point and gain a representations of integer or terminating fraction. But, in balanced ternary, we can't omit the rightmost trailing infinite -1s after the radix point in order to gain a representations of integer or terminating fraction.
| |
| | |
| [[Donald Knuth]] has pointed out that truncation and rounding are the same operation in balanced ternary — they produce exactly the same result (a property shared with other balanced numeral systems). The number 1/2 is not exceptional; it has two equally valid representations, and two equally valid truncations: 0.<span style="text-decoration: overline">1</span> (round to 0, and truncate to 0) and 1.<span style="text-decoration: overline">T</span> (round to 1, and truncate to 1).
| |
| | |
| The basic operations—addition, subtraction, multiplication, and division—are done as in regular ternary. Multiplication by two can be done by adding a number to itself, or subtracting itself after a-trit-left-shifting.
| |
| | |
| An arithmetic shift left of a balanced ternary number is the equivalent of multiplication by a (positive, integral) power of 3; and an arithmetic shift right of a balanced ternary number is the equivalent of division by a (positive, integral) power of 3.
| |
| | |
| == Conversion to and from a fraction==
| |
| {| class="wikitable"
| |
| !Fraction!!colspan="2"|Balanced ternary!!Fraction!!colspan="2"|Balanced ternary
| |
| |- align="center"
| |
| |1/1||colspan="2"|1||1/11||colspan="2"|0.<span style="text-decoration: overline">01T11</span>
| |
| |- align="center"
| |
| |1/2||0.<span style="text-decoration: overline">1</span>||1.<span style="text-decoration: overline">T</span>||1/12||colspan="2"|0.0<span style="text-decoration: overline">1T</span>
| |
| |- align="center"
| |
| |1/3||colspan="2"|0.1||1/13||colspan="2"|0.<span style="text-decoration: overline">01T</span>
| |
| |- align="center"
| |
| |1/4||colspan="2"|0.<span style="text-decoration: overline">1T</span>||1/14||colspan="2"|0.<span style="text-decoration: overline">01T0T1</span>
| |
| |- align="center"
| |
| |1/5||colspan="2"|0.<span style="text-decoration: overline">1TT1</span>||1/15||colspan="2"|0.0<span style="text-decoration: overline">1TT1</span>
| |
| |- align="center"
| |
| |1/6||0.0<span style="text-decoration: overline">1</span>||0.1<span style="text-decoration: overline">T</span>||1/16||colspan="2"|0.<span style="text-decoration: overline">01TT</span>
| |
| |- align="center"
| |
| |1/7||colspan="2"|0.<span style="text-decoration: overline">0110TT</span>||1/17||colspan="2"|0.<span style="text-decoration: overline">01TTT10T0T111T01</span>
| |
| |- align="center"
| |
| |1/8||colspan="2"|0.<span style="text-decoration: overline">01</span>||1/18||0.00<span style="text-decoration: overline">1</span>||0.01<span style="text-decoration: overline">T</span>
| |
| |- align="center"
| |
| |1/9||colspan="2"|0.01||1/19||colspan="2"|0.<span style="text-decoration: overline">00111T10100TTT1T0T</span>
| |
| |- align="center"
| |
| |1/10||colspan="2"|0.<span style="text-decoration: overline">010T</span>||1/20||colspan="2"|0.<span style="text-decoration: overline">0011</span>
| |
| |}
| |
| | |
| The conversion of a repeating balanced ternary number to a fraction is similar to converting a repeating decimal. For example:
| |
| | |
| : <math> 0.1\overline{\mathrm{110TT0} } =\tfrac{\mathrm{1110TT0-1} }{\mathrm{100000T0} }=\tfrac{\mathrm{1110TTT} }{\mathrm{100000T0} } =\tfrac{\mathrm{111\times 1000T} }{\mathrm{111111\times 1T0} } =\tfrac{\mathrm{1111\times 1T}}{\mathrm{1001\times 1T0}} =\tfrac{1111}{10010}=\tfrac{\mathrm{1T1T}}{\mathrm{1TTT0}} =\tfrac{101}{\mathrm{1T10} } </math>
| |
| | |
| ==Irrational and transcendental numbers==
| |
| As in any other integer base, irrational and transcendental numbers do not terminate or repeat. For example:
| |
| {| class="wikitable"
| |
| |-
| |
| ! Decimal !! Balanced ternary
| |
| |-
| |
| | <math>\sqrt{2}=1.4142135623731...</math> || <math>\sqrt{\mathrm{1T}}=\mathrm{1.11T1TT00T00T01T0T00T00T01TT...}</math>
| |
| |-
| |
| | <math>\sqrt{3}=1.7320508075689...</math> || <math>\sqrt{\mathrm{10}}=\mathrm{1T.T1TT10T0000TT1100T0TTT011T0...}</math>
| |
| |-
| |
| | <math>\sqrt{5}=2.2360679774998...</math> || <math>\sqrt{\mathrm{1TT}}=\mathrm{1T.1T0101010TTT1TT11010TTT01T1...}</math>
| |
| |-
| |
| | <math>\phi=\frac{1 + \sqrt{5}}{2}=1.6180339887499...</math>
| |
| | <math>\phi=\frac{1 + \sqrt{\mathrm{1TT}}}{\mathrm{1T}}=\mathrm{1T.T0TT01TT0T10TT11T0011T10011...}</math>
| |
| |-
| |
| | <math>\pi=3.14159265358979...</math> || <math>\pi=\mathrm{10.011T111T000T011T1101T111111}...</math>
| |
| |-
| |
| | <math>e=2.71828182845905...</math> || <math>e=\mathrm{10.T0111TT0T0T111T0111T000T11T}...</math>
| |
| |}
| |
| | |
| == Conversion from ternary ==
| |
| Unbalanced ternary can be converted to balanced ternary notation in two ways:
| |
| *Add 1 trit-by-trit from the first non-zero trit with carry, and then subtract 1 trit-by-trit from the same trit without borrow. For example,
| |
| : 021<sub>3</sub> + 11<sub>3</sub> = 102<sub>3</sub>, 102<sub>3</sub> − 11<sub>3</sub> = 1T1<sub>bal. 3</sub> = 7<sub>10</sub>.
| |
| *If a 2 is present in ternary, turn it into 1T. For example,
| |
| : 0212<sub>3</sub> = 0010<sub>bal. 3</sub> + 1T00<sub>bal. 3</sub> + 001T<sub>bal. 3</sub> = 10TT<sub>bal. 3</sub> = 23<sub>10</sub>
| |
| | |
| ==Conversion to balanced ternary from any integer base==
| |
| | |
| We may convert to balanced ternary with the following formula:
| |
| | |
| <math>
| |
| (a_na_{n-1}\cdots a_1a_0.c_1 c_2 c_3\cdots)_b =
| |
| \sum_{k=0}^n a_kb^k + \sum_{k=1}^\infty c_kb^{-k}.
| |
| </math>
| |
| | |
| where,
| |
| : <math>a_na_{n-1}\cdots a_1a_0.c_1 c_2 c_3\cdots</math> is the original representation in the original numeral system.
| |
| : ''b'' is the original radix. ''b'' is 10 if converting from decimal.
| |
| : <math>a_k</math> and <math>c_k</math> are the digits ''k'' places to the left and right of the radix point respectively.
| |
| | |
| For instance,
| |
| -25.4<sub>10</sub> = -(1T×101<sup>1</sup>+1TT×101<sup>0</sup>+11*101<sup>-1</sup>)
| |
| = -(1T×101+1TT+11÷101)
| |
| = -10T1.<span style="text-decoration: overline">11TT</span>
| |
| = T01T.<span style="text-decoration: overline">TT11</span>
| |
| | |
| 1010.1<sub>2</sub>=1T<sup>100</sup>+1T<sup>1</sup>+1T<sup>-1</sup>
| |
| = 10T+1T+0.<span style="text-decoration: overline">1</span>
| |
| = 101.<span style="text-decoration: overline">1</span>
| |
| | |
| == Addition, subtraction and multiplication and division ==
| |
| The single-trit addition, subtraction, multiplication and division tables are shown below. For subtraction and division, which are not [[Commutative property|commutative]], the first operand is given to the left of the table, while the second is given at the top. For instance, the answer to 1-T=1T is found in the bottom left corner of the subtraction table.
| |
| {|
| |
| {|
| |
| |
| |
| {| class="wikitable" style="width: 8em; text-align: center;"
| |
| |+ Addition
| |
| |- align="right"
| |
| ! + !! T !! 0 !! 1
| |
| |-
| |
| |-
| |
| ! T
| |
| | T1 || T || 0
| |
| |-
| |
| ! 0
| |
| | T || 0 || 1
| |
| |-
| |
| ! 1
| |
| | 0 || 1 || 1T
| |
| |}
| |
| |
| |
| {| class="wikitable" style="width: 8em; text-align: center;"
| |
| |+ Subtraction
| |
| |- align="right"
| |
| ! − !! T !! 0 !! 1
| |
| |-
| |
| ! T
| |
| | 0 || T || T1
| |
| |-
| |
| ! 0
| |
| | 1 || 0 || T
| |
| |-
| |
| ! 1
| |
| | 1T || 1 || 0
| |
| |}
| |
| |
| |
| {| class="wikitable" style="width: 8em; text-align: center;"
| |
| |+ Multiplication
| |
| |- align="right"
| |
| ! × !! T !! 0 !! 1
| |
| |-
| |
| |-
| |
| ! T
| |
| | 1 || 0 || T
| |
| |-
| |
| ! 0
| |
| | 0 || 0 || 0
| |
| |-
| |
| ! 1
| |
| | T || 0 || 1
| |
| |}
| |
| |
| |
| {| class="wikitable" style="width: 8em; text-align: center;"
| |
| |+ Division
| |
| |- align="right"
| |
| ! ÷ !! T !! 0 !! 1
| |
| |-
| |
| |-
| |
| ! T
| |
| | 1 || <small>NaN</small> || T
| |
| |-
| |
| ! 0
| |
| | 0 || <small>NaN</small> || 0
| |
| |-
| |
| ! 1
| |
| | T || <small>NaN</small> || 1
| |
| |}
| |
| |}
| |
| | |
| |}
| |
| | |
| ===Multi-trit addition and subtraction===
| |
| | |
| Multi-trit addition and subtraction is analogous to that of binary and decimal. Add and subtract trit by trit, and add the carry appropriately.
| |
| For example:
| |
| | |
| 1TT1TT.1TT1 1TT1TT.1TT1 1TT1TT.1TT1 1TT1TT.1TT1
| |
| + 11T1.T - 11T1.T - 11T1.T -> + TT1T.1
| |
| -------------- -------------- ---------------
| |
| 1T0T10.0TT1 1T1001.TTT1 1T1001.TTT1
| |
| + 1T + T T + T T
| |
| -------------- ---------------- ----------------
| |
| 1T1110.0TT1 1110TT.TTT1 1110TT.TTT1
| |
| + T + T 1 + T 1
| |
| -------------- ---------------- ----------------
| |
| 1T0110.0TT1 1100T.TTT1 1100T.TTT1
| |
| | |
| ===Multi-trit multiplication===
| |
| | |
| Multi-trit multiplication is analogous to that in decimal and binary.
| |
| | |
| 1TT1.TT
| |
| × T11T.1
| |
| -------------
| |
| 1TT.1TT multiply 1
| |
| T11T.11 multiply T
| |
| 1TT1T.T multiply 1
| |
| 1TT1TT multiply 1
| |
| T11T11 multiply T
| |
| -------------
| |
| 0T0000T.10T
| |
| | |
| ===Multi-trit division===
| |
| Balanced ternary division is analogous to decimal or binary division.
| |
| | |
| However, 0.5<sub>10</sub> = 0.1111...<sub>bal. 3</sub> or 1.TTTT...<sub>bal. 3</sub>. If the dividend over the plus or minus half divisor, the trit of the quotient must be 1 or T. If the dividend is between the plus and minus of half the divisor, the trit of the quotient is 0. The magnitude of the dividend must be compared with that of half the divisor before settinh the quotient trit. For example,
| |
| | |
| 1TT1.TT quotient
| |
| 0.5 × divisor T01.0 -------------
| |
| divisor T11T.1 ) T0000T.10T dividend
| |
| T11T1 T000<T010, set 1
| |
| -------
| |
| 1T1T0
| |
| 1TT1T 1T1T0>10T0, set T
| |
| -------
| |
| 111T
| |
| 1TT1T 1110>10T0, set T
| |
| -------
| |
| T00.1
| |
| T11T.1 T001<T010, set 1
| |
| --------
| |
| 1T1.00
| |
| 1TT.1T 1T100>10T0, set T
| |
| --------
| |
| 1T.T1T
| |
| 1T.T1T 1TT1T>10T0, set T
| |
| --------
| |
| 0
| |
| Another example,
| |
| 1TTT
| |
| 0.5 × divisor 1T -------
| |
| Divisor 11 )1T01T 1T=1T, but 1T.01>1T, set 1
| |
| 11
| |
| -----
| |
| T10 T10<T1, set T
| |
| TT
| |
| ------
| |
| T11 T11<T1, set T
| |
| TT
| |
| ------
| |
| TT TT<T1, set T
| |
| TT
| |
| ----
| |
| 0
| |
| Another example,
| |
| 101.TTTTTTTTT…
| |
| or 100.111111111…
| |
| 0.5 × divisor 1T -----------------
| |
| divisor 11 )111T 11>1T, set 1
| |
| 11
| |
| -----
| |
| 1 T1<1<1T, set 0
| |
| ---
| |
| 1T 1T=1T, trits end, set 1.TTTTTTTTT… or 0.111111111…
| |
| | |
| ==Square roots and cube roots==
| |
| The process of extracting the square root in balanced ternary is analogous to that in decimal or binary.
| |
| :<math>(10\cdot x+y)^{\mathrm{1T}}-100\cdot x^{\mathrm{1T}}=\mathrm{1T0}\cdot x\cdot y+y^{\mathrm{1T}}=
| |
| \begin{cases}
| |
| \mathrm{T10}\cdot x+1, & y=\mathrm{T} \\
| |
| 0, & y=0 \\
| |
| \mathrm{1T0}\cdot x+1, & y=1
| |
| \end{cases}
| |
| </math> | |
| | |
| As in division, we should check the value of half the divisor first. For example,
| |
| 1. 1 1 T 1 T T 0 0 ...
| |
| -------------------------
| |
| √ 1T 1<1T<11, set 1
| |
| - 1
| |
| -----
| |
| 1×10=10 1.0T 1.0T>0.10, set 1
| |
| 1T0 -1.T0
| |
| --------
| |
| 11×10=110 1T0T 1T0T>110, set 1
| |
| 10T0 -10T0
| |
| --------
| |
| 111×10=1110 T1T0T T1T0T<TTT0, set T
| |
| 100T0 -T0010
| |
| ---------
| |
| 111T×10=111T0 1TTT0T 1TTT0T>111T0, set 1
| |
| 10T110 -10T110
| |
| ----------
| |
| 111T1×10=111T10 TT1TT0T TT1TT0T<TTT1T0, set T
| |
| 100TTT0 -T001110
| |
| -----------
| |
| 111T1T×10=111T1T0 T001TT0T T001TT0T<TTT1T10, set T
| |
| 10T11110 -T01TTTT0
| |
| ------------
| |
| 111T1TT×10=111T1TT0 T001T0T TTT1T110<T001T0T<111T1TT0, set 0
| |
| - T Return 1
| |
| -----------
| |
| 111T1TT0×10=111T1TT00 T001T000T TTT1T1100<T001T000T<111T1TT00, set 0
| |
| - T Return 1
| |
| -------------
| |
| 111T1TT00*10=111T1TT000 T001T00000T
| |
| ...
| |
| Extraction of the cube root in balanced ternary is similarly analogous to extraction in decimal or binary:
| |
| :<math>(10\cdot x+y)^{10}-1000\cdot x^{10}=y^{10}+1000\cdot x^{\mathrm{1T}}\cdot y+ 100\cdot x\cdot y^{\mathrm{1T}}=
| |
| \begin{cases}
| |
| \mathrm{T}+\mathrm{T000}\cdot x^{\mathrm{1T}}+100\cdot x, & y=\mathrm{T}\\
| |
| 0, & y=0\\
| |
| 1+1000\cdot x^{\mathrm{1T}}+100\cdot x, & y=1
| |
| \end{cases}
| |
| | |
| </math>
| |
| Like division, we should check the value of half the divisor first too.
| |
| For example:
| |
| 1. 1 T 1 0...
| |
| 3---------------------
| |
| √ 1T
| |
| - 1 1<1T<10T,set 1
| |
| -------
| |
| 1.000
| |
| 1×100=100 -0.100 borrow 100×, do division
| |
| -------
| |
| 1TT 1.T00 1T00>1TT, set 1
| |
| 1×1×1000+1=1001 -1.001
| |
| ----------
| |
| T0T000
| |
| 11×100 - 1100 borrow 100×, do division
| |
| ---------
| |
| 10T000 TT1T00 TT1T00<T01000, set T
| |
| 11×11×1000+1=1TT1001 -T11T00T
| |
| ------------
| |
| 1TTT01000
| |
| 11T×100 - 11T00 borrow 100×, do division
| |
| -----------
| |
| 1T1T01TT 1TTTT0100 1TTTT0100>1T1T01TT, set 1
| |
| 11T×11T×1000+1=11111001 - 11111001
| |
| --------------
| |
| 1T10T000
| |
| 11T1×100 - 11T100 borrow 100×, do division
| |
| ----------
| |
| 10T0T01TT 1T0T0T00 T01010T11<1T0T0T00<10T0T01TT, set 0
| |
| 11T1×11T1×1000+1=1TT1T11001 - TT1T00 return 100×
| |
| -------------
| |
| 1T10T000000
| |
| ...
| |
| Hence {{radic|2|3}} = 1.259921<sub>10</sub> = 1.1T1 000 111 001 T01 00T 1T1 T10 111<sub>bal. 3</sub>.
| |
| | |
| ==Other applications==
| |
| Balanced ternary has other applications besides computing. For example, a classical two-pan [[Weighing scale#Balance|balance]], with one weight for each power of 3, can weigh relatively heavy objects accurately with a small number of weights, by moving weights between the two pans and the table. For example, with weights for each power of 3 through 81, a 60-gram object (60<sub>10</sub> = 1T1T0<sub>bal. 3</sub>) will be balanced perfectly with an 81 gram weight in the other pan, the 27 gram weight in its own pan, the 9 gram weight in the other pan, the 3 gram weight in its own pan, and the 1 gram weight set aside.
| |
| | |
| Similarly, consider a currency system with coins worth 1¤, 3¤, 9¤, 27¤, 81¤. If the buyer and the seller each have only one of each kind of coin, any transaction up to 121¤ is possible. For example, if the price is 7¤ (7<sub>10</sub> = 1T1<sub>bal. 3</sub>), the buyer pays 1¤ + 9¤ and receives 3¤ in change.
| |
| | |
| ==See also==
| |
| * [[Setun]], a [[ternary computer]]
| |
| * [[Ternary logic]]
| |
| * [[Numeral system]]
| |
| * [[Methods of computing square roots]]
| |
| * [[Salamis Tablet]]
| |
| | |
| ==Notes==
| |
| {{reflist}}
| |
| | |
| ==References==
| |
| *{{citation | first=Brian|last=Hayes|title=Third base|journal=American Scientist|url=http://www.americanscientist.org/issues/pub/third-base/2|year=2001|volume=89|issue=6|pages=490–494|doi=10.1511/2001.40.3268}}.
| |
| | |
| ==External links==
| |
| *[http://www.computer-museum.ru/english/setun.htm Development of ternary computers at Moscow State University]
| |
| *[http://www.veniaminilmer.com/balanced-ternary Finger Counting Balanced Ternary]
| |
| *[http://web.archive.org/web/20090312094241/http://abhijit.info/tristate/tristate.html Representation of Fractional Numbers in Balanced Ternary]
| |
| *[http://www.americanscientist.org/issues/pub/third-base/ “Third base”], ternary and balanced ternary number systems
| |
| *[http://www.hostsrv.com/webmaa/app1/MSP/webm1010/ternary.msp The Balanced Ternary Number System] (includes decimal integer to balanced ternary converter)
| |
| *The binomial triangle reduced to balanced ternary lists. OEIS {{OEIS2C|A182929}}
| |
| *[http://userpages.wittenberg.edu/bshelburne/BalancedTernaryTalkSu09.pdf Balanced (Signed) Ternary Notation] by Brian J. Shelburne (PDF file)
| |
| *[http://www.mortati.com/glusker/fowler/ The ternary calculating machine of Thomas Fowler] by Mark Glusker
| |
| | |
| [[Category:Computer arithmetic]]
| |
| [[Category:Non-standard positional numeral systems]]
| |