语法数学一点不会?可以学编程吗QAQ

明明想学编程,然儿花在单词阅读的时间上比扣代码的时间还要多…内心崩溃。

这里记录语法、发音和算法、逻辑。在线更新,too lazy to copy.

点赞收藏,天天向上!

  • 颚音化(英语:Palatalization)是一个语言学的名词,指辅音在发音时变得接近硬颚音。通常发生于硬颚无擦通音/j/或者前元音如/i/、/e/的前面,这个现象会使辅音在发音时,除本身的发音动作外,舌根会顶着硬颚部分并发出一个类似短促的/j/。国际音标会在颚音化的辅音右上角加上“ʲ”来表示。

各语言范例
颚化现像在很多语言都有出现。例如,中国的北方方言在近数百年开始出现尖团音的区别。这一种“团音”就是颚音化的形式。另外,在英语里“question”和“nature”里的“t”读成/ʧ/,又或是“soldier”和“procedure”里的“d”读成/ʤ/音。这是因为这些 t 或 d 的后面跟从了/i/和/ju/音,使前面的/t/和/d/发生了颚化现象。

颚音化在拉丁语族、斯拉夫语族、汉语、日语的发展占有很重要的地位。这种现象在世上很多语言都有出现。

In linguistics, palatalization /ˈpælətəlaɪˌzeɪʃən/ is a sound change that either results in a palatal or palatalized consonant or a front vowel, or is triggered by one of them. Palatalization involves change in the place or manner of articulation of consonants, or the fronting or raising of vowels. In some cases, palatalization involves assimilation or lenition.

An example of palatalization in English is the colloquial pronunciation of did you? as [dɪdʒuː] rather than [dɪdjuː]

Palatalization is sometimes an example of assimilation. In some cases, it is triggered by a palatal or palatalized consonant or front vowel, but in other cases, it is not conditioned in any way.

consonant
Palatalization changes place of articulation or manner of articulation of consonants. It may add palatal secondary articulation or change primary articulation from velar to palatal or alveolar, alveolar to postalveolar.
It may also cause a consonant to change its manner of articulation from stop to affricate or fricative. The change in the manner of articulation is a form of lenition. However, the lenition is frequently accompanied by a change in place of articulation.

[k] > [kʲ], [c], [tʃ], [ts], [ʃ], [s]
Palatalization of velar consonants commonly causes them to front, and apical and coronal consonants are usually raised. In the process, stop consonants are often spirantised except for palatalized labials.

Palatalization, as a sound change, is usually triggered only by mid, close (high) front vowels and the semivowel [j]. The sound that results from palatalization may vary from language to language. For example, palatalization of [t] may produce [tʲ], [tʃ], [tɕ], [tsʲ], [ts], etc. A change from [t] to [tʃ] may pass through [tʲ] as an intermediate state, but there is no requirement for that to happen.

In some Zoque languages, [j] does not palatalize velar consonants but it turns alveolars into palato-alveolars. In the Nupe language, /s/ and /z/ are palatalized both before front vowels and /j/, while velars are only palatalized before front vowels. In Ciluba, /j/ palatalizes only a preceding /t/, /s/, /l/ or /n/. In some variants of Ojibwe, velars are palatalized before /j/, but apicals are not. In Indo-Aryan languages, dentals and /r/ are palatalized when occurring in clusters before /j/, but velars are not.

Vowel
Palatalization sometimes refers to vowel shifts, the fronting of a back vowel or raising of a front vowel. The shifts are sometimes triggered by a nearby palatal or palatalized consonant or by a high front vowel. The Germanic umlaut is a famous example.

A similar change is reconstructed in the history of Old French in which Bartsch’s law turned open vowels into [e] or [ɛ] after a palatalized velar consonant. If it was true for all open vowels in Old French, it would explain the palatalization of velar plosives before /a/.

In Erzya, a Uralic language, the open vowel [a] is raised to near-open [æ] after a palatalized consonant, as in the name of the language, [erzʲæ].

In Russian, the back vowels /u o/ are fronted to central [ʉ ɵ], and the open vowel /a/ is raised to near-open [æ], near palatalized consonants. The palatalized consonants also factor in how unstressed vowels are reduced.

uncondition
Palatalization is sometimes unconditioned or spontaneous, not triggered by a palatal or palatalized consonant or front vowel.

In southwestern Romance, clusters of a voiceless obstruent with /l/ were palatalized once or twice. This first palatalization was unconditioned. It resulted in a cluster with a palatal lateral [ʎ], a palatal lateral on its own, or a cluster with a palatal approximant [j]. In a second palatalization, the /k/ was affricated to [tʃ] or spirantized to [ʃ].

Vulgar Latin clāmāre “to call” > Aromanian cl’imari /kʎimari/, Aragonese clamar /kʎamar/, Spanish llamar /ʎamar/, Italian chiamare /kjaˈmare/

Istriot ciamà /tʃaˈma/, Portuguese chamar /ʃɐˈmaɾ/
In the Western Romance languages, Latin [kt] was palatalized once or twice. The first palatalization was unconditioned: the /k/ was vocalized to [i̯t] or spirantized to [çt]. In a second palatalization, the /t/ was affricated to [tʃ]:
Vulgar Latin noctem “night” > French nuit [nɥi], Portuguese noite [ˈnoj.tɨ], eastern Occitan nuèit, Catalan nit, Mozarabic noxte /noçte/
Spanish noche, western Occitan nuèch, Romansh notg
In many dialects of English, the back vowel /uː/ is fronted to near-back [u̟ː], central [ʉː], or front [yː]. This vowel shift is unconditioned, happening in all cases, and not triggered by another sound.
A similar change is reconstructed for Ancient Greek. In the Attic dialect before the Classical period, the back vowels /u uː/ were fronted to [y yː]. During the Koine or Medieval Greek period, they were unrounded to [i iː], and they finally merged as short [i], the pronunciation that they have in Modern Greek.

Anticipatory and progressive
When palatalization is assimilatory or triggered by a consonant or vowel, it is triggered by a following sound (anticipatory) or by a preceding sound (progressive).

effect
Allophony and phonemic split
Palatalization may result in a phonemic split, a historical change by which a phoneme becomes two new phonemes over time through palatalization.

Old historical splits have frequently drifted since the time they occurred and may be independent of current phonetic palatalization. The lenition tendency of palatalized consonants (by assibilation and deaffrication) is important. According to some analyses, the lenition of the palatalized consonant is still a part of the palatalization process itself.
In Japanese, allophonic palatalization affected the dental plosives /t/ and /d/, turning them into alveolo-palatal affricates [tɕ] and [dʑ] before [i], romanized as ⟨ch⟩ and ⟨j⟩ respectively. Japanese has only recently regained phonetic [ti] and [di] from borrowed words, and the originally allophonic palatalization has thus become lexical. A similar change has also happened in Polish and Belarusian. That would also be true about most dialects of Brazilian Portuguese if not it were nor for the strong phonotactical resistancy of its native speakers that turn dental plosives into post-alveolar affricates even in loanwords: McDonalds [mɛ̞kiˈdõnɐwdʑ(is)].

For example, Votic has undergone such a change historically, *keeli → tšeeli ‘language’, but there is currently an additional distinction between palatalized laminal and non-palatalized apical consonants. An extreme example occurs in Spanish, whose palatalized (‘soft’) g has ended up as [x] from a long process where Latin /a/ became palatalized to [ɡʲ] (Late Latin) and then affricated to [dʒ] (Proto-Romance), deaffricated to [ʒ] (Old Spanish), devoiced to [ʃ] (16th century), and finally retracted to a velar, giving [x] (c. 1650). (See History of the Spanish language and Phonological history of Spanish coronal fricatives for more information).

Palatalization has played a major role in the history of English, and of other languages and language groups throughout the world, such as the Romance, Greek, Slavic, Baltic, Finnic, Mordvinic, Samoyedic, Iranian, Indo-Aryan, Goidelic, Korean, Japanese, Chinese, Twi and Micronesian languages.
English

In Anglo-Frisian, the language that gave rise to English and Frisian, the velar stops /k g/ and the consonant cluster /sk/ were palatalized in certain cases and became the sounds /tʃ/, /dʒ/ and /j/, and /ʃ/. Many words with Anglo-Frisian palatalization survive in Modern English, and the palatalized sounds are typically spelled ⟨ch, (d)ge, y, sh⟩ in Modern English.

Palatalization only occurred in certain environments, and so it did not apply to all words from the same root. This is the origin of some alternations in cognate words, such as speak and speech /ˈspiːk ˈspiːtʃ/, cold and chill /ˈkoʊld ˈtʃɪl/, burrow and bury /ˈbʌroʊ ˈbɛri/, dawn and day /ˈdɔːn ˈdeɪ/. Here ⟨k⟩ originates from unpalatalized /k/ and ⟨w⟩ from unpalatalized /g/.

Some English words with palatalization have unpalatalized cognates from the Northumbrian dialect and from Old Norse, such as shirt and skirt /ˈʃərt ˈskərt/, church and kirk /ˈtʃərtʃ ˈkərk/, ditch and dike /ˈdɪtʃ ˈdaɪk/. German only underwent palatalization of /sk/: cheese /tʃiːz/ and Käse /kɛːzə/; lie and lay /ˈlaɪ ˈleɪ/, liegen and legen /ˈliːgən ˈleːgən/; fish and Fisch /fɪʃ/.

The pronunciation of wicca as [ˈwɪkə] with a hard c is a spelling pronunciation, since the actual Old English pronunciation gave rise to witch.

Later in English, another palatalization called yod-coalescence occurred. Alveolar stops and affricates were palatalized before the palatal approximant /j/, changing into [dʒ tʃ ʃ ʒ]. In standard English, yod-coalescence applies only in unstressed syllables and causes the words educate /ˈɛdʒʊkeɪt/, nature /ˈneɪtʃər/, pressure /ˈprɛʃər/, measure /ˈmɛʒər/ to have the sounds sometimes spelled ⟨j ch sh zh⟩.
In other dialects, yod-coalescence also applies in stressed syllables, and affects words like dew /ˈdʒuː/, tune /ˈtʃuːn/, assume /əˈʃuːm/, and resume /rəˈʒuːm/.

The Romance languages developed from Vulgar Latin, the colloquial form of Latin spoken in the Roman Empire. Various palatalizations occurred during the historical development of the Romance languages. Some groups of the Romance languages underwent more palatalizations than others. One palatalization affected all groups, some palatalizations affected most groups, and one affected only a few groups.

In Gallo-Romance, Vulgar Latin *[ka] became *[tʃa] very early, with the subsequent deaffrication and some further developments of the vowel. For instance:
cattus “cat” > chat /ʃa/
calva “bald” (fem.) > chauve /ʃov/
*blanca “white” (fem.) > blanche /blɑ̃ʃ/
catēna “chain” > chaîne /ʃɛn/
carus “dear” > cher /ʃɛʁ/
Early English borrowings from French show the original affricate, as chamber /ˈtʃeɪmbəɾ/ “(private) room” < Old French chambre /tʃɑ̃mbrə/ < Vulgar Latin camera; compare French chambre /ʃɑ̃bʁ/ “room”.
Mouillé
Mouillé (French pronunciation: ​[muje], moistened) is a term for palatal consonants in the Romance languages. Palatal consonants in the Romance languages developed from /l/ or /n/ by palatalization.
Spelling of palatal consonants
l mouillé n mouillé
Italian gl(i) gn
French (i)ll (i)gn
Occitan lh nh
Catalan ll ny
Spanish ll ñ
Portuguese lh nh
L and n mouillé have a variety of origins in the Romance languages. In these tables, letters that represent or used to represent /ʎ/ or /ɲ/ are bolded. In French, /ʎ/ merged with /j/ in pronunciation in the 18th century; in many dialects of Spanish, /ʎ/ has merged with /ʝ/. Romanian formerly had both /ʎ/ and /r/, but both have merged with /j/: vīnea > *viɲe > Romanian vie /ˈvi.je/ “vineyard”; mulierem > *muʎere > Romanian muiere /muˈje.re/ “woman”.
Examples of palatal /ʎ/
Latin meliōrem
“better” auric(u)la
“ear” caballum
“horse” lunam
“moon” clavem
“key”
Italian migliore orecchio cavallo luna chiave
French meilleur oreille cheval lune clef
Occitan melhor aurelha caval luna clau
Catalan millor orella cavall lluna clau
Spanish mejor oreja caballo luna llave
Portuguese melhor orelha cavalo lua chave
Romanian — ureche cal lună cheie

Examples of palatal /r/
Latin seniōrem
“older” cognātum
“related” annum
“year” somnum
“sleep” somnium
“dream” ung(u)lam
“claw” vīnum
“wine”
Italian signore cognato anno sonno sogno unghia vino
French seigneur — an somme songe ongle vin
Occitan senhor cunhat an sòm sòmi ongla vin
Catalan senyor cunyat any son somni ungla vi
Spanish señor cuñado año sueño sueño uña vino
Portuguese senhor cunhado ano sono sonho unha vinho
Romanian — cumnat an somn — unghie vin
Satem languages
In certain Indo-European language groups, the reconstructed “palato-velars” of Proto-Indo-European (*ḱ, *ǵ, *ǵʰ) were palatalized into sibilants. The language groups with and without palatalization are called satem and centum languages, after the characteristic developments of the PIE word for “hundred”:
PIE *(d)ḱm̥tóm > Avestan satəm (palatalization)
Latin centum /kentum/ (no palatalization)

In the Slavic languages, two palatalizations took place. Both affected the Proto-Slavic velars *k *g *x. In the first palatalization, the velars before the front vowels *e *ē *i *ī and the palatal approximant *j changed to *č *ž *š. In the second palatalization, the velars changed to c, dz or z, and s or š before the Proto-Slavic diphthongs *aj *āj, which must have been monophthongized to *ē by this time.

In many dialects of Mandarin Chinese, the alveolar sibilants /ts tsʰ s/ and the velars /k kʰ x/ were palatalized before the medials /j ɥ/ and merged in pronunciation, yielding the alveolo-palatal sibilants /tɕ tɕʰ ɕ/. Alveolo-palatal consonants occur in modern Standard Chinese and are written as ⟨j q x⟩ in Pinyin. Postal romanization does not show palatalized consonants, reflecting the dialect of the imperial court during the Qing dynasty. For instance, the name of the capital of China was formerly spelled Peking, but is now spelled Beǐjīng [peɪ̀.tɕíŋ], and Tientsin and Sian were the former spellings of Tiānjīn [tʰjɛ́n.tɕín] and Xī’ān [ɕí.án].

  • 辅音弱化或弱音化(Lenition)是语言学的一种辅音变化现象,存在于多种语言,但以印欧语为主。辅音弱化及语音同化都是历史语言学的一门主要课题,亦是现时语言在历史中变化的主要原因。

这个名词源自拉丁语的lenis,意思就是变弱或变软。弱音化指语音由一对较强的语音转化为较弱的一对。若已转化的辅音与另外的辅音还有配对关系,这个弱化过程还可能会一直继续下去。

辅音的弱化有以下各种:
擦音化或咝音化(spirantization或affrication)
例如:[t] → [s]
浊音化(voicing或sonorization)
例如:[f] → [v]
去口音化(debuccalization)
例如:[s] → [h]
消除辅音重复(degemination)
例如:[kk] → [k]
松音化(deglottalization)
例如:[k’] → [k]
去到最后,辅音可能会弱化至完全脱落(elision ,亦作音节省略)。

弱音化的过程有两大类:
其一是发音部位会向「开口音」的方向演变,
其二是擦音化。

  • 开口音化」是指发音部位每步向着增加张口度的方向弱化,例如:
    双辅塞音 → 塞音 → 擦音 → 咝音 → placeless approximant → 无声
    原来发音 → 去双辅音 → 擦音化 → 咝音化
    (去擦音化) → 非口腔音化 → 省略化
    [pp] or [ppʰ] → [p] or [pʰ] → [pɸ] → [ɸ] → [h] → (zero)
    → [pf] → [f] →
    [tt] or [ttʰ] → [t] or [tʰ] → [tθ] → [θ] →
    → [ts] → [s] →
    [kk] or [kkʰ] → [k] or [kʰ] → [kx] → [ɸ] →
    而「擦音化」的过程,还会令辅音从清音转为浊音:
    塞音 → 浊音化 → continuant
    (咝音化, tap, etc.) → 边音化 → 无声(省略化) (附注)
    原来发音 → voicing
    (sonorization) → spirantization, flapping → approximation → elision
    [p] → [b] → [β] → [β̞] → (zero)
    → [v] → [ʋ] →
    → [w] →
    [t] → [d] → [ð] → [ð̞] →
    → [z] → [ɹ] →
    → [ɾ] →
    [k] → [ɡ] → [ɣ] → [p] →
    → [j], [w] →

  • 凯尔特语的语音及文本
    过去凯尔特语的文本记录中,弱化了的辅音都会在其上加上一圆点。不过,后来的排版机由于不能轻易加上变音符号,所以这种弱化标示的习惯改为在辅音之后加上「h」字表示。例如:「母亲」现在的拼法是"a mháthair",但过去的拼法,却应该写作"a ṁáṫair"。

  • 汉语福州话的声母类化
    主条目:声母类化 在福州话以及宁德地区的闽东方言中的大部分方言点,一些塞音和擦音变为同部位或相近部位的阻碍程度相对较小的音。例如,p,pʰ在大多较常词组中的后字中可发生弱化,变为双唇近音β̞ ,甚至消失,发生的条件是前字为阴声韵或入声韵,如 肉饼 [nyʔ piaŋ]→[ny(ʔ) β̞iaŋ] 。同样的,还有t,tʰ,s,ts,tsʰ和k,kʰ 。其中t,tʰ,s变成ɾ直至l,ts,tsʰ变成z直至通音化,k,kʰ变为零辅音。当前字为阳声韵(鼻音ŋ韵尾),后字上,p,pʰ变为m,t,tʰ,s变为n,ts,tsʰ变为接近龈腭鼻音n̠ʲ (ɲ̟),k,kʰ变为ŋ。

演化语言学
演化语言学,是对人类原始语言的发展,及其社会行为演化的科学。由于语言的声音转眼即逝,令到这学科研究欠缺原始数据。因此过去百多年,这学科都难以发展。由19世界80年代后期起,这学科与心理语言学、神经语言学、演化心理学、普遍文法、认知科学等学科兴起跨学科研究,使演化语言学再为兴盛。

Evolutionary linguistics is a subfield of psycholinguistics that studies the psychosocial and cultural factors involved in the origin of language and the development of linguistic universals. The main challenge in this research is the lack of empirical data: spoken language leaves practically no traces. This led to the abandonment of the field for more than a century, despite the common origins of language hinted at by the evolutionary relationships among individual languages established by the field of historical linguistics. Since the late 1980s, the field has been revived in the wake of progress made in the related fields of psycholinguistics, neurolinguistics, evolutionary anthropology, evolutionary psychology, universal grammar, and cognitive science.

History
Inspired by the natural sciences, especially by biology, August Schleicher (1821–1868) became the first to compare changing languages to evolving species. He introduced the representation of language families as an evolutionary tree (Stammbaumtheorie) in articles published in 1853. Stammbaumtheorie proved very productive for comparative linguistics, but did not solve the major problem of studying the origin of language: the lack of fossil records. Some scholars abandoned the question of the origin of language as unsolvable. Famously, the Société Linguistique de Paris in 1866 refused to admit any further papers on the subject.

Joseph Jastrow published a gestural theory of the evolution of language in the seventh volume of Science, 1886.The field re-appeared in 1988 in the Linguistic Bibliography as a subfield of psycholinguistics. In 1990, Steven Pinker and Paul Bloom published their paper “Natural Language and Natural Selection” which strongly argued for an adaptationist approach to language origins. Development strengthened further with the establishment (in 1996) of a series of conferences on the Evolution of Language (subsequently known as “Evolang”), promoting a scientific, multi-disciplinary approach to the issue, and interest from major academic publishers (e.g., the Studies in the Evolution of Language series has appeared with Oxford University Press since 2001) and from scientific journals.

Recent developments
Evolutionary linguistics as a field is rapidly emerging as a result of developments in neighboring disciplines. To what extent language’s features are determined by genes, a hotly debated dichotomy in linguistics, has had new light shed upon it by the discovery of the FOXP2 gene. An English family with a severe, heritable language dysfunction was found to have a defective copy of this gene. Mutations of the corresponding gene in mice (FOXP2 is fairly well conserved; modern humans share the same allele as Neanderthals) cause reductions in size and vocalization rate. If both copies are damaged, the Purkinje layer (a part of the cerebellum that contains better-connected neurons than any other) develops abnormally, runting is more common, and pups die within weeks due to inadequate lung development. Additionally, higher presence of FOXP2 in songbirds is correlated to song changes, with downregulation causing incomplete and inaccurate song imitation in zebra finches. In general, evidence suggests that the protein is vital to neuroplasticity. There is little support, however, for the idea that FOXP2 is ‘the grammar gene’ or that it had much to do with the relatively recent emergence of syntactical speech.

Another controversial dichotomy is the question of whether human language is solely human or on a continuum with (admittedly far removed) animal communication systems. Studies in ethology have forced researchers to reassess many claims of uniquely human abilities for language and speech. For instance, Tecumseh Fitch has argued that the descended larynx is not unique to humans. Similarly, once held uniquely human traits such as formant perception, combinatorial phonology and compositional semantics are now thought to be shared with at least some nonhuman animal species. Conversely, Derek Bickerton and others argue that the advent of abstract words provided a mental basis for analyzing higher-order relations, and that any communication system that remotely resembles human language utterly relies on cognitive architecture that co-evolved alongside language.
As it leaves no fossils, language’s form and even its presence are extremely hard or impossible to deduce from physical evidence. Computational modeling is now widely accepted as an approach to assure the internal consistency of language-evolution scenarios. Approximately one-third of all papers presented at the 2010 Evolution of Language conference rely at least in part on computer simulations.

Approaches
One original researcher in the field is Luc Steels, head of the research units of Sony CSL in Paris and the AI Lab at the Vrije Universiteit Brussel. He and his team are currently investigating ways in which artificial agents self-organize languages with natural-like properties and how meaning can co-evolve with language. Their research is based on the hypothesis that language is a complex adaptive system that emerges through adaptive interactions between agents and continues to evolve in order to remain adapted to the needs and capabilities of the agents. This research has been implemented in fluid construction grammar (FCG), a formalism for construction grammars that has been specially designed for the origins and evolution of language. The approach of computational modeling and the use of robotic agents grounded in real life is claimed to be theory independent. It enables the researcher to find out exactly what cognitive capacities are needed for certain language phenomena to emerge. It also focuses the researcher in formulating hypotheses in a precise and exact manner, whereas theoretical models often stay very vague.

Some linguists, such as John McWhorter, have analyzed the evolution and construction of basic communication methods such as Pidginization and Creolization.
“Nativist” models of “Universal Grammar” are informed by linguistic universals such as the existence of pronouns and demonstratives, and the similarities in each language’s process of nominalization (the process of verbs becoming nouns) as well as the reverse, the process of turning nouns into verbs. This is a purely descriptive approach to what we mean by “natural language” without attempting to address its emergence.

Finally there are those archaeologists and evolutionary anthropologists – among them Ian Watts, Camilla Power and Chris Knight (co-founder with James Hurford of the EVOLANG series of conferences) — who argue that ‘the origin of language’ is probably an insoluble problem. In agreement with Amotz Zahavi, Knight argues that language — being a realm of patent fictions — is a theoretical impossibility in a Darwinian world, where signals must be intrinsically reliable. If we are going to explain language’s evolution, according to this view, we must tackle it as part of a wider one — the evolutionary emergence of symbolic culture as such.

EVOLANG Conference
The Evolution of Language International Conferences have been held biennially since 1996.
1996 Edinburgh:
1998 London:
2000 Paris:
2002 Boston:
2004 Leipzig
2006 Rome:
2008 Barcelona:

  • 生日问题
    生日问题是指,如果一个房间里有23个或23个以上的人,那幺至少有两个人的生日相同的概率要大于50%。这就意味着在一个典型的标准小学班级(30人)中,存在两人生日相同的可能性更高。对于60或者更多的人,这种概率要大于99%。从引起逻辑矛盾的角度来说生日悖论并不是一种悖论,从这个数学事实与一般直觉相抵触的意义上,它才称得上是一个悖论。大多数人会认为,23人中有2人生日相同的概率应该远远小于50%。计算与此相关的概率被称为生日问题,在这个问题之后的数学理论已被用于设计著名的密码攻击方法:生日攻击。
    对此悖论的解释
    我们可以把生日悖论理解成一个盲射打靶的问题。对于一个23人的房间,先考虑问题的补集:23人生日两两不同的概率是多少?为此,我们可以让23个人依次进入,那幺每个人生日都与其他人不同的概率依次是1, 3**/365, 363/365, 362/365, 361/365,等等。先进入房间的这些人生日两两不同的概率是很大的,比如说前面5个是1×3**/365×363/365×362/365×361/365=97.3%。而对于最后进入房间的几个人情况就完全不同。最后几个人进入房间并且找不到同生日者的概率是… 345/365, 344/365, 343/365。我们可以把这种概率看成对一张靶的盲射:靶上有365个小格,其中有17个左右是黑格,其余是白格。假设每枪必中靶并且分布符合几何概型的话,那幺连续射12枪左右任何一发都没有击中黑格的概率(投射于房间里的人生日都两两不同)是多少呢?想必大家立即会感觉到这个概率十分微小。
    因此,理解生日悖论的关键,在于考虑上述“依次进入房间”模型中最后几个进入房间的人“全部都没碰到相同生日的人”概率有多大这件事情。
    概率估计
    假设有n个人在同一房间内,如果要计算有两个人在同一日出生的机率,在不考虑特殊因素的前提下,例如闰年、双胞胎,假设一年365日出生概率是平均分布的(现实生活中,出生机率不是平均分布的)。
    计算概率的方法是,首先找出p(n)表示n个人中,每个人的生日日期都不同的概率。假如n > 365,根据鸽巢原理其概率为1,假设n ≤ 365,则概率为
    2\bar p (n) = 1 \cdot \right[(2(n \frac{1}{365}\right) ]\cdot \right[(2\n \frac{2}{365}\right) ]\cdots \right[( 2\n\ frac{n-1}{365}\right) ]=|\frac{365}{365} \cdot \frac{3**}{365} \cdot \frac{363}{365} \cdot \frac{362}{365} \cdots \frac{365-n+1}{366}|
    ^因为第二个人不能跟第一个人有相同的生日(概率是3**/365),第三个人不能跟前两个人生日相同(概率为363/365),依此类推。用阶乘可以写成如下形式
    { 365! \over 365^n (365-n)! }
    p(n)表示n个人中至少2人生日相同的概率
    p (n) = 1 - \bar p (n)=1 - { 365! \over 365^n (365-n)! }
    n≤365,根据鸽巢原理,n大于365时概率为1。
    当n=23发生的概率大约是0.507。其他数字的概率用上面的算法可以近似的得出来:
    n p(n)
    10 12%
    20 41%
    30 70%
    50 97%
    100 99.99996%
    200 99.9999999999999999999999999998%
    300 1 −(7×10)
    350 1 −(3×10)
    ≥366 100%
    比较p (n) = 任意两个人生日相同概率q (n) =和某人生日相同的概率
    比较p (n) = 任意两个人生日相同概率q (n) =和某人生日相同的概率
    注意所有人都是随机选出的:作为对比,q(n)表示房间中n个其他人中与特定人(比如你)有相同生日的概率:
    q (n) = 1- \left( \frac{3**}{365} \right)^n
    当n = 22时概率只有大约0.059,约高于十七分之一。如果n个人中有50%概率存在某人跟你有相同生日,n至少要达到253。注意这个数字大大高于365/2 = 182.5:究其原因是因为房间内可能有些人生日相同。

^数学论证(数字方法)
在Paul Halmos的自传中,他认为生日悖论仅通过数值上的计算来解释是一种悲哀。为此,Paul Halmos给出了一种概念数学方法的解释,下面就是这种方法(尽管这个方法包含一定的误差)。乘积
\prod_{k=1}^{n-1}\left(1k \over 365}\right)
等于1-p(n),因此我们关注第一个n,欲使乘积小于1/2。由平均数不等式可以得知:
\sqrt[n-1]{\prod_{k=1}^{n-1}\left(1k \over 365}\right)}
<{1 \over n-1}\sum_{k=1}^{n-1}\left(1k \over 365}\right)
再利用已知的1到n-1所有整数和等于n(n-1)/2,然后利用不等式1-x < e,我们可以得到:
\prod_{k=1}^{n-1}\left(1k \over 365}\right)
<\left({1 \over n-1}\sum_{k=1}^{n-1}\left(1k \over 365}\right)\right)^{n-1}
=\left(1n \over 730}\right){n-1}<\left(e{-n/730}\right){n-1}=e{-(n^2-n)/730}
如果仅当
n^2-n>730\log_e 2\cong 505.997\dots
最后一个表达式的值会小于0.5。其中"loge"表示自然对数。这个数略微小于506,如果取n-n=506,我们就得到n=23。
在推导中,Halmos写道:
这个推导是基于一些数学系学生必须掌握的重要工具。生日问题曾经是一个绝妙的例子,用来演示纯思维是如何胜过机械计算:一两分钟就可以写出这些不等式,而乘法运算则需要更多时间,并更易出错,无论使用的工具是一只铅笔还是一台老式电脑。计算器不能提供的是理解力,或数学才能,或产生更高级、普适化理论的坚实基础。
然而Halmos的推导只显示至少超过23人就能保证平等机会下的生日匹配。因为我们不知道给出的不等式有多强(严格、清晰),因此从这个计算过程中无法确定当n=22时是否就能让机率超过0.5。相反的,当代任何人都可以运用个人电脑程序如Microsoft Excel,几分钟就可以把整个机率分布图形画出来,对问题答案很快就有个通盘的掌握,一目了然。
泛化和逼近
生日悖论可以推广一下:假设有n个人,每一个人都随机地从N个特定的数中选择出来一个数(N可能是365或者其他的大于0的整数)。
p(n)表示有两个人选择了同样的数字,这个概率有多大?
下面的逼近公式可以回答这个问题
p (n)\sim 1-1/\exp(n^2/(2N))。,
N=365的结果

泛化
下面我们泛化生日问题:给定从符合离散均匀分布的区间[1,d]随机取出n个整数,至少2个数字相同的概率p(n;d)有多大?
类似的结果可以根据上面的推导得出。
p(n;d) = \begin{cases} 1-\prod_{k=1}^{n-1}\left(1k \over d}\right) & n\le d \ 1 & n > d \end{cases}
p(n;d) \approx 1 - e^{-(n(n-1))/2d}             
n(p;d)\approx \sqrt{2d\ln\left({1 \over 1-p}\right)}+{1 \over 2}          
q(n;d) = 1 - \left( \frac{d-1}{d} \right)^n
反算问题
反算问题可能是:
对于确定的概率p …
…找出最大的n(p)满足所有的概率p(n)都小于给出的p,或者
…找出最小的n(p)满足所有的概率p(n)都大于给定的p。
对这个问题有如下逼近公式:
n §\approx \sqrt{2\cdot 365\ln\left({1 \over 1-p}\right)}+{1 \over 2}。
举例
逼近   估计N =365
p   n推广 n 0.01  (0.14178 √N)+0.5  3.208** 3 0.00820 4 0.01636
0.05  (0.32029 √N)+0.5  6.61916 6 0.04046 7 0.05624
0.1  (0.45904 √N)+0.5  9.27002 9 0.09462 10 0.11694
0.2  (0.66805 √N)+0.5  13.26302 13 0.19441 14 0.22310
0.3  (0.84460 √N)+0.5  16.63607 16 0.28360 17 0.31501
0.5  (1.17741 √N)+0.5  22.99439 22 0.47570 23 0.50730
0.7
 (1.55176 √N)+0.5
30.14625
30
0.70632
31 0.73045   (正确值:n↓=29, n↑=30)
0.8  (1.79412 √N)+0.5  34.77666 34 0.79532 35 0.81438
0.9
 (2.14597 √N)+0.5
41.49862
41
0.90315
42 0.91403   (正确值:n↓=40, n↑=41)
0.95
 (2.44775 √N)+0.5
47.2**14
47
0.95477
48 0.96060   (正确值:n↓=46, n↑=47)
0.99
 (3.03485 √N)+0.5
58.48081
58
0.99166
59 0.99299   (正确值:n↓=56, n↑=57)
注意:某些值被着色,说明逼近不总是正确。
经验性测试
生日悖论可以用计算机代码经验性模拟
days := 365;
numPeople := 1;
prob := 0.0;
while prob < 0.5 begin
numPeople := numPeople + 1;
prob := 1 -((1-prob)*(days-(numPeople-1)) / days);
print "Number of people: " + numPeople;
print "Prob. of same birthday: " + prob;
end;
生日悖论也可以用Microsoft Excel Spreadsheet模拟
1 = 1-PERMUT(365,A1)/POWER(365,A1)
=A1+1 = 1-PERMUT(365,A2)/POWER(365,A2)
=A2+1 = 1-PERMUT(365,A3)/POWER(365,A3)
… …
应用
生日悖论普遍的应用于检测哈希函数:N-位长度的哈希表可能发生碰撞测试次数不是2次而是只有2次。这一结论被应用到破解密码学散列函数的生日攻击中。
生日问题所隐含的理论已经在[Schnabel 1938]名字叫做capture-recapture的统计试验得到应用,来估计湖里鱼的数量。
不平衡概率
就像上面提到的,真实世界的人口出生日期并不是平均分布的。这种非均衡生日概率问题也已经被解决。[Klamkin 1967]
近似匹配
此问题另外一个泛化就是求得要在随机选取多少人中才能找到2个人生日相同,相差1天,2天等的概率大于50% 。这是个更难的问题需要用到容斥原理。结果(假设生日依然按照平均分布)正像在标准生日问题中那样令人吃惊:
2人生日相差k天 #需要的人数
0 23
1 14
2 11
3 9
4 8
5 7
7 6
只需要随机抽取6个人,找到两个人生日相差一周以内的概率就会超过50%。

你可能感兴趣的:(笔记)