JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
Back to the library
計算機科學 1843

《分析機概略》及譯者註記

愛達·勒芙蕾絲(註記)與 L. F. 梅納布雷亞

史上第一份公開發表的演算法——也是「機器遠不止於算術」的第一道靈光。

Choose your version
In depth · the introduction

1843 年,在任何電腦問世之前,一位年輕女子寫下了第一段程式——並猜到了電腦有朝一日會變成什麼。

核心想法

查爾斯·巴貝奇設計過一台龐大的機械計算機——分析機,它從打孔卡片上讀取指令。在他眼裡,那是一台強大的計算器。而愛達·勒芙蕾絲,在翻譯一篇介紹它的論文時,添上了自己的註記——看到了更大的東西。

她意識到,這台機器是「通用」的:只要餵給它不同的卡片,就能讓它執行任何你說得清楚的過程,而非某一道固定的算式。為了證明這一點,她一步一步寫出了:這台機器將如何算出一串頗為棘手的數列——這便是史上第一份為機器而公開發表的演算法。接著她更進一步:倘若機器能處理符號,而音樂或別的東西也能被寫成符號,那麼這台機器,有朝一日或許能作曲。此後整整一百年,再沒有人認真看待過這個念頭。

它是如何誕生的

愛達是詩人拜倫勳爵的女兒,由一位一心要把詩歌擋在女兒之外的母親,用數學把她養大。少女時代,她結識了巴貝奇和他的計算機器,二人成了多年的通信者。當一位義大利工程師梅納布雷亞,用法文發表了一篇對分析機的描述,愛達把它譯成了英文。

巴貝奇建議她加些註記。註記越寫越長,最終是論文本身的三倍——而她的思想,正活在其中。她把註記標為 A 到 G,只署名「A.A.L.」——她的全名,並未出現。Note G 裡,藏著那段著名的、計算伯努利數的程式。她 36 歲便去世了,遠在任何這樣的機器被造出來之前;她的工作幾乎被遺忘,直到電腦時代將它重新發現。

它為何重要

勒芙蕾絲看出了「計算器」與「電腦」之別——比那時早了一個世紀,那時根本沒有一台電腦可供指認。計算器做算術;電腦遵循程式——你能精確描述的任何事,無論是用數字、還是用代表別的東西的符號,都能令它去做。正是這一個念頭,讓你口袋裡那台裝置,不只會做加法,還能顯示照片、播放音樂、寫出文字。她被廣泛尊為「第一位程式設計師」,而一門程式語言 Ada,便以她命名。

一個可以想像的畫面

勒芙蕾絲自己的比喻,至今仍是最妙的。提花織機(Jacquard loom)靠讀取一串打孔卡片,織出一幅圖畫——換卡片,就換圖畫,織機本身卻分毫不動。她寫道,分析機「織出代數的圖案,正如提花織機織出花與葉」。換上不同的卡片,同一台機器便算出新的東西。這,恰恰就是你給手機裝上一個不同的應用程式時所發生的事。

一排會繞回自身的運算卡。按「運行」,同一組卡片便重複一遍,每一遍都算出表中的下一個數——這是勒芙蕾絲在 Note G 裡所寫「循環程式」的動手版。

它的位置

這是本圖書館沿著「計算」一路追溯時,最早的一塊路標。一個世紀後,阿蘭·圖靈(1936)用純數學定義了一台通用機器究竟能算什麼;而 1950 年,他指名回應了勒芙蕾絲——她那句機器「無法首創任何東西」,成了「勒芙蕾絲夫人的反駁」,是「機器智能」之爭的第一招。從那裡,這條線穿過馮·諾依曼的儲存程式設計(1945),直抵今天每一台執行著軟體的裝置。

The original document
Original source text
L. F. Menabrea, trans. & notes by A. A. Lovelace · Scientific Memoirs 3 (1843): 666–731
The published work is Lovelace's English translation of Luigi Menabrea's French account of Babbage's unbuilt Analytical Engine, followed by seven Notes of her own, labelled A to G and signed only with her initials. The Notes run to nearly three times the length of the memoir they annotate, and it is in them — not in the translated paper — that the ideas the Library remembers appear.
Note A — a machine beyond mere number
Lovelace draws the crucial line between Babbage's earlier Difference Engine, which could only tabulate by repeated addition, and the Analytical Engine, a general-purpose machine that follows instructions punched on cards. She borrows the image of the Jacquard loom, whose punched cards weave any pattern a designer can specify.
We may say most aptly that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves.
She then takes a step no one else did for a century: if other things besides numbers could be represented by the engine's symbols, it could operate on them too.
Supposing, for instance, that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations, the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent.
Note G — the first program, and a famous limit
Note G lays out, in a step-by-step table of operations and Variable columns, how the engine would compute the Bernoulli numbers — a sequence too laborious for hand calculation — by running a fixed group of operation cards over and over in a cycle. This table is regarded as the first algorithm published for a machine. The same Note sets a careful boundary on what the machine is.
The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform.
[ … ]
Signed A.A.L. · 1843