Thursday, August 16, 2012

تردد الحروف العربية

أستعملت ثلاثة مقالات، واحدة من ويكيبيديا وواحدة من الجزيرة وواحدة من الأهرام، بمجموع حوالي 22 ألف حرف عربي، لحساب التردد النسبي للحروف العربية. هذا التقدير تقريبي وغير صالح لأي أستخدام علمي، وإنما هو مجرد إشارة.
{ا,إ,أ,آ,ى}→0.181314
ل→0.109845
{ي,ئ}→0.0855272
{ت,ة}→0.0805501
م→0.0645274
ر→0.0538747
{و,ؤ}→0.0534381
ن→0.0475879
د→0.0366732
ب→0.0361493
ع→0.0327876
س→0.0265881
ق→0.0223969
ف→0.0222659
ح→0.0212181
ه→0.0188605
ك→0.0178127
ص→0.0142327
{ج,چ}→0.0137088
ش→0.0109146
خ→0.00912465
ث→0.00873172
ط→0.00868806
ز→0.00563196
ض→0.00554464
ذ→0.00497708
ظ→0.00340537
غ→0.00336171
Spikey Created with Wolfram Mathematica 8.0


ثم نزلت القرآن من موقع تنزيل.نت وحسبت تردد الحروف فوجدت الآتي:
إاىآأ0.186902
ل0.11609
ن0.0822685
م0.0813341
ؤو0.076572
ئي0.0699051
ه0.0449529
ةت0.0386495
ر0.0379375
ب0.0348609
ك0.031538
ع0.0282571
ف0.0262801
ق0.0211335
س0.0183994
د0.0179998
ذ0.0148181
ح0.0131115
ج0.00996584
خ0.00750217
ش0.0063815
ص0.00622527
ض0.00506554
ز0.00480415
ء0.00474106
ث0.00424833
ط0.00382469
غ0.00366846
ظ0.00256282
چ

Wednesday, June 13, 2012

On Numbers - Abstract Algebra - Imaginary Numbers

While reading in the magnificent book "Princeton Companion to Mathematics" I tend to ponder on the ideas lurking within. I was reading about solving polynomial equations (I.4 §1.2) and the author introduced square root of two in a rather intriguing way. What caught my attention is not only that we needed to prove that it exists (by the intermediate value theorem), but also that it is defined by the sole property that is the number that squares to two (if it exists) and cannot be defined by other means. He intended to highlight that numbers (or solutions) are opaque and all we care about are their properties. More on that in the next paragraph.

Extrapolating on this line of thought, I ended up thinking about the fraction 2/3. It is, in fact, defined to be the number that, when multiplied by 3, gives you 2. That number doesn't exist in the set of integers, much as the same way square root of two doesn't exist in the set of rational numbers. Now think about the number 4/6. It is the number that when multiplied by 6 gives you 4. Although it might look intuitive to someone who went through elementary education, it is still an interesting thing to highlight: it turns out that both numbers, 4/6 and 2/3, are in fact the same number. What we have just stated in the last sentence is a property of both numbers, both of which being solutions to 3x = 2 and 6x = 4, respectively. But behind that, it is actually a property of the solution of the two equations. It shows that their solutions are the same number, even though these solutions (2/3 and 4/6) might look syntactically different. Put in more accurate words: they define the same number.

What is intriguing about this is that the number i (the square root of negative one) is no more artificial than √2. It is just a number, that similarly to √2, which does not exist in the set of rational numbers, is a number that doesn't exist in the set of real numbers. Moreover, as being the square root of two (and nothing more) is the defining property of √2, and as being the number that multiplied by 3n gives 2n (for positive integer n) is the defining property of the number 2/3, so is being the square root of negative one is the defining property of i. All further properties could be derived from this property alone.  This process is abstract in nature; we may not know what the square root of two is. For instance, did you even need to know that √2 = 1.414... in order to perform calculations in high school ? No. All you did need to know was that it squared to two. Quick, what is the solution to 3 + √341 x = 344 ? Simply enough, it is x = √341. Did you need to know the value of √341 to do that ? (I hope not!) Actually, if you've dealt with the value instead, things would have been more confusing and uglier.

The study of this kind of properties of numbers which are defined this way is heart to Abstract Algebra. In fact this is exactly why it is called "Abstract" and "Algebra". Abstract Algebra may look like this: if we take the field Q (the field of all rationals) and adjoin the number √2 to it (in a process called "field extension"), we end up with the new field Q(√2) which have different structure, fully determined by the properties of √2.

Sunday, May 20, 2012

"أنتخب أبو الفتوح لأنه صاحب أقوى فرصه في النجاح" - مثال فعلي على التلاعب الإستراتيجي بالأنتخابات‎

توضيح: تفادي تفتيت الأصوات غرض مشروع وأتفق معه، ولكن للإتفاق على الأفضل، وليس على الأكثر شعبية.
توضيح2: أستخدم لفظ "التلاعب بالأنتخابات" وليس "التلاعب بالمنتخبين"، لأنه حتى وإن كان من يقوم بذلك يقوم به عن أقتناع ودون إيحاء أو توجيه من أحد فهو مازال تلاعباً بالنظام الأنتخابي.
توضيح3: لفظ "تلاعب" مقصود به التحايل على المقصود من النظام، حتى وإن كان عن حسن نية. المقصود من نظام الأنتخابات أن يصوت كل فرد بما يراه الأنسب والأفضل، وليس بما يراه الأكثر شعبية.

بسم الله الرحمن الرحيم

كان أحدهم يشجع الناس على عدم التصويت لصباحي والتصويت لأبو الفتوح بأستعمال جمل على شاكلة:

“إنت متخيل إن عندك رفاهية الاختيار لكن الحقيقة إنك بإختيارك لحمدين هيخليك تختار يا مرسي "مجبرا" يا فلول "ودي وحشة في حقك قوي" ففكر بعقلك”

فكان ردي عليه الآتي:

“ما تفعله الآن هو أنك تتعامل مع الأنتخابات إستراتيجياً وهو شئ سئ يهدف مجال تصميم الآليات لجعله مستحيلاً أو صعباً. الهدف من تصميم الآليات هو تصميم آلية (أنتخابية أو غير ذلك) تجبر الناس أن يدلوا بتفضيلهم الحقيقي، بدلاً من تصويتهم إستراتيجياً. شوف المقالة ديه مثلا http://t.co/uPjBnsS8 .المشكلة في كدة أن المرشح اللي ينجح أنصاره في أقناع الأغلبية أن "الأغلبية وراه" هو اللي حيكسب بغض النظر الأغلبية وراه فعلاً ولا لأ !!

عادة التفكير الإستراتيجي حاجة حلوة، بس في الأنتخابات بالذات حاجة وحشة :) أو للتوضيح لكي لا يلتبس الأمر: فكر وخطط إستراتيجياً في المرشح اللذي تراه الأفضل، ولكن لا تخطط أستراتيجاً في التلاعب بنظام التصويت ذات نفسه، حتى لو كان الخِصْم يتلاعب به وما تفعله مجرد رد على كيده. ليه؟ لأنه الأنتخابات لعبة عمياء (simultaneous game)، حيث لا يعرف اللاعبون (أنت وخصومك) لعبة الفريق الآخر إلا بعد النتيجة النهائية، وبعد أن يكونوا قد أختاروا ونفذوا أستراتيجيتهم. يعني أيه؟ يعني ممكن الخصم يتلاعب بيك أنت شخصياً ويوهمك بأنه حيعمل حاجة (وميعملهاش) لمجرد أنه يدفعك أنك تعمل اللي هو عاوزه بدل اللي أنت عاوزه، يبقى كدة تلاعب بيك. (اللي هو بنظام: أنا اشتريت العربية ديه عشان حماتي بتكرهها، حتى لو العربية نفسها مش عاجباني (وممكن تطلع حماتي اوهمتني بكدة وهي فعلا العربية عاجباها!) -- وهذا نظام خطأ لأننا يجب أن نقوم بالاشياء (أي اشياء) لقيمتها لدينا نحن بمعزل عن رأي الآخرين فيها)
قابلة نظم التصويت للتلاعب عيب من عيوبها، ونظرية "آرو" تقول أنه من المستحيل تصميم نظام لا يعاني منها (بصورة مطلقة). ولكن هذا لا يعني أنه لا يمكن تصميم نظام يكون التلاعب به مستحيل "حسابياً" - أي أنه ليس لأحد من الاطراف القدرة الحسابية (الوقت الكافي) لحساب استراتيجيته قبل بدء التصويت.

تحديث:
تغريدة وجدتها على تويتر مؤخراً:




MT @DinaDwidar أرجع و أقول أنا هنتخب #خالد_على مش عشان هيكسب . . أنا هنتخبة عشان يكسب
21/05/12 06:44


Wednesday, May 9, 2012

تذكرت برنامج للعب الشطرنج رأيته منذ عدة سنوات على الأنترنت وكان يرسم خطوط تعبر عن المسارات اللتي أحتسبتها الخوارزمية بشكل منحنيات برتقالية اللون.