Science Fair Projects Ideas - Non-adjacent form

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Non-adjacent form

The non-adjacent form (NAF) of a number is a unique signed-digit representation. Like the name suggests, adjacent values cannot be non-zero. For example:

(0 1 1 1) = 4 + 2 + 1 = 7
(1 0 −1 1) = 8 − 2 + 1 = 7
(1 −1 1 1) = 8 − 4 + 2 + 1 = 7
(1 0 0 −1) = 8 − 1 = 7

All are valid signed-digit representations of 7, but only the final representation (1 0 0 −1) is in NAF.

Obtaining NAF

There are several algorithms for obtaining the NAF representation of a value given in binary. One such is the modified Booth scheme :

Input: E = (em − 1 em − 2 ··· e1 e0)2
Output: E = (zm zm − 1 ··· z1 z0)NAF
em ← 0
e−1 ← 0
Find and replace all sequences of 0 1 ··· 1 0 (with k repeated 1's) with 1 0 ··· 0 −1 0 (with k − 1 repeated 0's)
i ← 0
while i < m do
if ei + 1 · ei ≠ 0 then
zi ← 2 &middot ei + 1 + ei
zi + 1 ← 0
ii + 2
else
ziei
ii + 1
return z

Another way, one that doesn't have to search for and count strings of 1's, is a method using repeated division:

Input: E = (0 em − 1 em − 2 ··· e1 e0)2
Output: E = (zm zm − 1 ··· z1 z0)NAF
i ← 0
while E > 0 do
if E is odd then
zi ← 2 − (E mod 4)
else
zi ← 0
E ← (Ezi)/2
ii + 1
return z

Properties

NAF assures a unique representation of an integer, but the main benefit of it is that the Hamming weight of the value will be minimal. For regular binary representations of values, half of all bits will be non-zero, on average, but with NAF this drops to only one-third of all bits.

Because every non-zero value has to be adjacent to two 0's, the NAF representation can be implemented such that it only takes a maximum of m + 1 bits for a value that would normally be represented in binary with m bits.

The non-zero bits in NAF will toggle between 1 and −1 when examined from left-to-right or right-to-left — that is, if a bit of 1 is encountered, the next non-zero bits on the left and right will be −1 and vice versa.

The properties of NAF make it useful in hardware implementations, especially those in cryptography.

10-26-2009 08:16:03
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice