/
Balanced Ternary Notation Balanced Ternary Notation

Balanced Ternary Notation - PowerPoint Presentation

alida-meadow
alida-meadow . @alida-meadow
Follow
408 views
Uploaded On 2016-07-27

Balanced Ternary Notation - PPT Presentation

The Goldilocks of Numbering Systems Brian Shelburne Department of Mathematics and Computer Science Wittenberg University August 31 2015   Abstract There is base 10 and base 2 and base 16 hexadecimal notation but why not base 3 ternary and in particular ID: 421145

balanced ternary notation current ternary balanced current notation decimal base systems digits digit quotient 10t 1t0 binary square 1t0t

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Balanced Ternary Notation" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Balanced Ternary Notation

The Goldilocks of Numbering Systems

Brian Shelburne

Department of Mathematics and Computer Science

Wittenberg University

August 31, 2015Slide2

 Abstract: There is base 10 and base 2 and base 16 (hexadecimal) notation but why not base 3 (ternary) and in particular balanced ternary notation? We’ll examine what balanced ternary notation is and how to add, subtract, multiply, divide and take square roots. There is some evidence that balanced ternary notation is the most efficient of numbering systems, the so called “Goldilocks” of numbering systems in that “base 2 is too small”, “base 10 is too big”, and “base 3 is just right”.

 

Perhaps the prettiest number system of all … is the balanced ternary notation

” –

Donald

Knuth,

The Art of Programming

 Slide3

A brief historical overview of numbering systems

The standard positional notations: decimal and binary

Why not ternary and balanced ternary?

Arithmetic operations in balanced ternary

Square roots? (with time)

Why ternary is the Goldilocks of positional notation – a proof?Slide4

Type A – Additive Systems (3 subtypes) “simple transcriptions of even more concrete systems of counting”  A.1 Egyptian Hieroglyphic system

A.2

Roman Numerals

A.3

Greek Alphabetic Type B – Hybrid Systems (5 subtypes) “written transcriptions of more or less organized verbal expressions of number” – additive and multiplicative principle  B.1. Common Assyro-Babylonian B.5. Common Chinese Type C – Positional Systems (2 subtype)   C.1. Learned Babylonian; Learned Chinese Mayan (base 20 – modified) C.2. Indian -> Modern Georges Ifrah “The Universal History of Numbers”

An Overview

of

Numbering

SystemsSlide5

Egyptian NumeralsSlide6

Greek Alphabetic (Learned)Slide7

Common Assyro-BabylonianSlide8

Common ChineseSlide9

BabylonianSlide10

Positional Notations: Decimal Base and Binary Notation 2413 = 2×103 + 4×10

2

+ 1×10

1

+ 3×100 1011101 = 1×26 + 0×25 +1×24 + 1×23 + 1×22 + 0×21 + 1×0 = 64 + 16 + 8 + 4 + 1 = 91 Also Octal (0135) and Hexadecimal (0x5D) Notation Binary to Decimal Conversion: Expand by Powers of 2Decimal to Binary Conversion: Subtract out Powers of 2Slide11

Example: Convert 413 to Binary

256

128

64 32 16 8

4

2

1

1 1 0 0 1 1 0 1 1

413 157 29 11 3 1

-256

-128

-16

- 8 -2 -1 157 29 11 3 1 0 Example: Convert 2413 to binary 2048 1024 256 128 64 32 16 8 4 2 1 Why Binary Notation: Pros and Cons?Slide12

Ternary (base 3) NotationIn Ternary natation we use three digits (0, 1, 2) and powers of 3

Example

1201

3 = 1×33 + 2×32 + 0×31 + 1×30 = 27 + 2×9 + 0 + 1 = 46To convert Ternary to Decimal expand by powers of 3To convert Decimal to Ternary subtract out (multiple) powers of 3 729 243 81 27 9 3 1 Slide13

Example: Convert 413 to Ternary

243

81

27 9 3 1

486 162 54 18 6 2

1

2 0 0 2 2

413 170 8 2

-243

-162

- 6

- 2 170 8 2 0Example: Convert 2413 to TernarySlide14

Balanced (Signed) Ternary NotationInstead the digits 0, 1, and 2 use (-1), 0, 1 so that negative digits are used

Example:

1(-1)0(-1) = 1×3

3 + (-1)×32 + 0×31 + (-1)×30 = 27 – 9 – 1 = 17To make things easier, use T, 0 ,1 for digits instead of (-1), 0, and 1Example: 1T0T = 17Aside: A capital Theta Θ which looks like a minus sign inside a circle can be used for -1 so “T” stands for capital Theta. Slide15

Counting from -1 to 10

Decimal

Binary

Ternary

BalancedTernary-1-1-1T00T0000000

1

1

1

1

001

2

10

2

1T

01T

3

11

10

10010410011110115101121TT1TT6110201T01T07111211T11T1810002210T10T91001100100100101010101101101Slide16

Decimal - Balanced Ternary ConversionsBalanced Ternary to Decimal: Expand by Powers of 3

1T0T

= 3

3 – 32 -30 = 27 – 9 – 1 = 17Decimal to Balanced Ternary (2 steps) Decimal to Ternary then Ternary to Balanced Ternary. From right to left convert 2 to 1T Add the 1 to the next digit 17 = 1223 = 1(1T)(1T) = (1+1)(T+1)T = 1T0T Convert 52 to balanced ternary Slide17

Addition and Subtraction9 rules for addition:1 + T cancel

0 + anything = anything

Only 2 rules have carries

To negate swap 1’s and T’s

To subtract, negate and add T T T T 0 1

--- --- ---

T1 T 0

0 0 0

T 0 1

--- --- ---

T 0 1

1 1 1

T 0 1

--- --- ---

0 1 1T Slide18

Advantages to Balanced Ternary NotationLeading digit indicates sign of the number

Easy to “compare” numbers: 11T> 10T > 1TT

To negate any integer swap T’s and 1’s

if 17 = 1T0T then -17 = T101

Examples 1T0T = 17+10TT = 23----- -- 1111 = 40

1T0T = 17

+T011 = -23

----- --

0T10 = -6

T101 = -17

+T011 = -23

----- --

TTTT = -40

-17

+23

---

??Slide19

Multiplication3 rules for multiplication: 1 × anything is anything - copy 0 × anything = 0

T × anything = swap T & 1: invert

10T = 8

× 10T = 8 ------- T01 invert 000 nothing

+ 10T copy

---------

1T101 = 81 – 27 + 9 + 1 = 64

17 = 1T0T

×23 = 10TT

--- ----

391Slide20

Aside: Doubling a Number (multiplication by 1T)Example: 47 × 2

1TT1T = 47

1T

= 2 T11T1 1TT1T

10111 = 94

Left shift multiplicand

a

nd add inverted

multiplicand Slide21

Division is done the normal way but makes effective use of positive and negative divisors (make copies of both)

110T

10T | 101101

T01 T01 1T1 T01 T0

T01

10T

0

If the current dividend is positive (leading

digit is 1) add the negative divisor, set

Quotient digit to 1 and bring down the

next digit

If the current dividend is

negative (leading

digit

is T) add the positive divisor, setThe quotient digit to T and break down thenext digit.Otherwise bring down next digit and set quotient digit to 0280 / 8 = 35Slide22

More Division Examples

81 / 13 = 6 r 3

111

r 11 100 | 11111

T00

T

00

111

T00

111

T00

11 121/9 = 13 r 4 1T0 r 10 111 | 10000 TTT TTT TT0 111 10 00 10 Slide23

Note: The remainder in division might not be positive

1T0

r T

10 | 1T0TT0 T0 T0 10

0T

00

0T

17 ÷ 3 = 6 r -1

The solution is to

add the divisor to

the remainder and

subtract 1 from the

dividend (add T)

1TT r 1T10 | 1T0T17 ÷ 3 = 5 r 2 Slide24

1 6 . 5 2

|

2 73 . 00 00

1 1 ------- 2 b 1 73 2 6 1 56

----------

32 b 17 00

32 5 16 25

-----------

330 b 75 00

330 2 66 04

----------

8 98 etc.

Square Roots

Compute Starting from decimal pointpartition digits into pairsCall leading paired or unpaireddigits the “current dividend”Slide25

1

6 . 5 2

| 2 73 . 00 00 1 1 ------- 2 b

1 73

2 6 1 56

----------

32 b 17 00

32 5 16 25

-----------

330 b 75 00

330 2 66 04

---------- 8 98 etc. Square RootsStarting with the current dividendestimate the largest digit “currentquotient” whose square is lessthan or equal to the currentdividendSubtract the “quotient squared”from the current dividend and bring down the next two digits.Call the current quotient aSlide26

1

6 . 5 2

| 2 73 . 00 00 1 1 ------- 2 b 1 73

2 6 1 56

----------

32 b 17 00

32 5 16 25

-----------

330 b 75 00

330 2 66 04

---------- 8 98 etc. Square RootsDouble the “current quotient” aand left shift it (multiply by 10). Find the largest digit b such that10×a+b times b is less than thecurrent dividend. Subtract andbring down the next two digits.RepeatSlide27

1 0 T

1 | 1 T1 01

T T 0 T1 bring down next 2 digits 1T b

2 x current quotient + b

1

T T

current dividend negative; try b = T

T1 1 1 TT (

2

x current quotient +

b) ×

T

0 10 & subtract 1T0 b T1 01 T10 T 1T0 1 T10 T T1 0T 00 00 Square RootsSlide28

1 0 T

1 | 1 T1 01

T T 0 T1 1T b

1

T T

T1 1 1 TT

0 10

Problem: |10| > |T1|; Therefore b = 0

T1 01 Bring down next two digits 1T0 b 2 × current quotient + b 1T0 T current dividend negative; try b = T T10 1 (2 x current quotient + b) × T 1T0 T 1T 0T & subtract 00 00

Square RootsSlide29

Balanced Ternary in RetrospectTernary Numbers systems have been called the “Goldilocks” numbering systems – binary is too small, decimal is too big but ternary is just right

Balanced Ternary has less carry propagation; negating numbers is easy; the mechanics of calculation are simplified

In the 1840’s Thomas Fowler an English self-taught mathematician and inventor invented a calculating machine that used balanced ternary to perform its calculations. Fowler observed that the mechanics of calculation were simplified using balanced ternary.

There have been a few attempts to construct

ternary computers. In the 1950’s Nikolai Brousentsov at Moscow State University designed a ternary computer called the Setun with a word length of 18 “trits” (same range as a 28 bit computer) in stead of “bits”. 50 were build between 1958 and 1965. In 1973 G. Frieder at SUNY Buffalo designed a base 3 machine called the “Ternac” along with a software emulator for it.In ternary a Flip-Flop is a Flip-Flap-Flop Slide30

Why is Ternary Notation the Goldilocks of Positional Notation?Slide31

If r is the radix (base) and w is the width of an integer (number of digits) you want to minimize the product y =

r

w

for some fixed value C = rw (constraint).Thus w = ln(C) / ln(r) so if you minimize y = r∙ (ln C /ln r)Note that 3 is closer to e than 2.

If C = 1000

w

10

= 3

w

2

= log

2

(1000)≈9.97

w

3

= log

3

(1000)≈6.26 y10 = 10×3=30y2 = 2×9.97=19.94y3 = 3×6.26=18.78 Slide32

Any Questions? Thank You Brian Shelburne

Department of Mathematics

and Computer Science

Wittenberg University 10T/1011/1TT0 “Perhaps the prettiest number system of all … is the balanced ternary notation” – Donald Knuth, The Art of Programming