Try   HackMD

2017q3 Homework1(ternary)

contributed by <TsengWen>

tags: Balanced Ternary

Review by williamchangTW

  • 在文章中提到的,設計中有避掉一些容易混淆的字,推測考量到資訊安全問題,這是我在研究中沒有窺見的一隅,受教了謝謝
  • 或許可以針對上述的想法繼續往下個議做延伸,應該是一個可以完成的部份,期待您的討論

小弟坐井觀天,如有冒犯請見諒"williamchangTW"


作業要求

  1. 研讀 Balanced Ternary,並依據 課前測驗參考解答: Q1 的風格和探討方式,涵蓋以下:

    • 解釋 Balanced Ternary 原理;
    • [ ]Balanced Ternary 的設計要解決什麼類型的問題,需要詳述實際應用案例 (如 IOTA/Tangle)。提示:從算術表達的精準度和空間使用效率去探討;
    • 針對特定的領域 (如加密貨幣),列出在 GitHub 裡頭可找到的應用案例,不僅列出程式碼,還要解說;
    • [ ]在研究的過程中,應該會對既有工具進行修改或者重新開發 (不限程式語言),也該一併指出,程式碼應該維護在 GitHub 上;
  2. 其他:

Balanced Ternary

數字與中文間記得以空白隔開!
課程助教

ok
TsengWen

平衡三進位:

是一種以 3 為基數,-1、0、1 為基本數位的進位。

特點

  1. 由於 -1 的引入,這種進位不需要額外的符號就能直接表示負數。正因為這一點,使得平衡三進位在加減法和乘法方面的效率要比二進位高。
  2. 各位上的數字之和為偶數的整數是偶數;各位上的數字之和為奇數的整數是奇數。
例如 :

 += 10 =0 =1


42=3433323130+0812793+ 0


下兩個表格請改以縱向的表格表示,或是切成上下兩部分,塞在一起會超出畫面
課程助教

OKTsengWen

 987654321000+++0++000+00

 987654321+00+0+++0+0++0+00+00+

  • 觀察發現:正負號轉換只需將 + 轉 - 和 - 轉 +
    相較原本2's complement 反向 再加一 ,或許能夠少去加一的步驟。

小數

平衡三進位和十進位一樣,用小數點分隔整數部分和小數部分。

 0.50.40.30.20.10..+0.+ +0. 0+00.++ 0.00 +
 0.50.40.30.20.10.++.0.++ 0.+ 000.+ +0.0+0 

  • 驗算0.5的兩種表示
    • 0.+

      13+19+127+181=13113=1323=12
    • +.

      11319127181=1(13+19+127+181)=112=12

運算

 +0+  ++0 0 +0  + 0+
 0+ +00000 +0+

Ternary

單位

  • 位(trit) > 0,1,2
  • 位元組(tryte) > 9-trit
  • 字元(word) > 27-trit

範圍

  • 一個word - 表達
    327
    =
    7,625,597,484,987

Heptavintimal Encoding of Ternary Values

  • 為了讓人們方便使用Ternary Number,美國愛荷華州立大學將Ternary Number轉換成九進制或是二十七進制,像是將Binary Number轉換成octal(base 8)或是hexadecimal(base 16)。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 其中跳過容易視覺混淆的字母
     inputequivalent I,J,L,Y1 O,Q0 S5 U,WV

浮點數

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 因為balance ternary的特性,可以不須額外trit來表示正負符號。
  • 給定一個27-trit word 表示浮點數,由3個tryte所組成,使用1個tryte表示指數。
  • 指數部分,使用3's complement來表示。
  • 不使用隱藏位元

Fast Ternary Multiplication and Division

乘法

   a=(a<<3c)+d<<3trit


a ×0=0a ×15=(a ×5)×3a ×1=a a ×16=(a ×4)×4a ×2=(a<<30) + aa ×2=(a<<31)  at =a ×8 a ×17=(a<<32) + ta ×3=(a<<31)a ×4=(a<<31) + aa ×18=(a ×6)×3 t =a ×2t =a ×2a ×5=(a<<31) + ta ×19=(t<<32) + a a ×6=(a ×2)×3a ×20=(a ×10)×2 t =a ×2a ×21=(a ×7)×3a ×7=(t<<31) + a a ×22=(a ×11)×2a ×8=(a<<32)  aa ×8=(a ×2)×4t =a ×2 u=(a<<31) + ta ×9=(a<<32)a ×23=(t<<32) + u a ×10=(a<<32) + aa ×24=(a ×6)×4 t =a ×2a ×25=(a ×5)×5a ×11=(a<<32) + t a ×26=(a ×2)×13a ×12=(a ×3)×4 t =a ×4a ×13=(a<<32) + t

除法

將除法轉換成乘一個對應的數。

a2=a×12=a×0.1113a3=a×13=a×0.13a4=a×14=a×0.0202023a5=a×15=a×0.0121012101213a6=a×16=a×0.01113a7=a×17=a×0.0102123a8=a×18=a×0.0101013a9=a×19=a×0.013a10=a×110=a×0.002200223

參考網站

LATEX

  • 是一種基於TEX的排版系統,適用於生成高印刷品質的科技和數學、化學類文件。

MathJax語法

可以使用 MathJax 語法 來產生 LaTeX 數學表達式:

The Gamma function satisfying

Γ(n)=(n1)!nN is via the Euler integral

x=b±b24ac2a.

更多關於 LaTeX 數學表達式 請至這裡

參考網站