Astronomy and music

Question: I just got done watching ancient apocalypse on Netflix where Graham Hancock explains how important astronomy was to ancient civilizations. The sky was basically their culture. In the modern day we have so much light pollution and now we have other entertainment like tiktok and Netflix. But that thousands of years ago people would look at the sky as their shared culture.
At some point he started talking about Phrygians. And my mind ofcourse went to the phrygian scale on the guitar. I then remembered that I somewhere heard a guitar student of Pat Martino explaining that when he went to Pat, he would see Pat mapping out star-constellations on sheets of music, connecting notes to eachother and forming geometric shapes and star-constellations. Pat also would make many connections between theory and time, comparing a chromatic circle as a clock etc.
I googled to find this but I could not find it again. I only found a picture that remotely reminded me of it.

I think the idea is very compelling to wonder if Pythagoras, Phrygian's, and the ancient people who invented the guitar, if they used the sky and star constellations to design the guitar.
I'm wondering if there is basically any relationship between music theory and perhaps solstices, constellations, time, or anything beyond that and if so how that could be used.
Comment: A good reference might be Brian May.
Comment: I'm not sure this question is on topic here. That said, the Greeks believed that the motions of the heavens created or were related to music. The distinction between science and the arts that we have today was either nonexistent or very different back then. https://en.wikipedia.org/wiki/Musica_universalis
Comment: _I'm wondering if there is basically any relationship between music theory and_ (...) _anything_. This question seems a bit too broad.
Comment: Perhaps you should clarify what you mean by "invented the guitar."  Judging from the (sadly very poorly written) Wikipedia article on frets, there doesn't seem to be any evidence for them before around 1800 years ago (in China and long before the guitar was invented).  And of course fretless instruments don't tell you much about tuning; our knowledge in that sphere comes from theoretical treatises about tuning rather than evidence related to specific classes of instruments.
Comment: See this previous answer: https://music.stackexchange.com/a/16663/9426
Answer: This is not really an answer, but it's too long for a comment.
The question may contain a bit of a misconception of music theory. Music theory is not a law of nature that's "behind" all music in a way that would be independent of human actions, like the forces of nature cannot be changed, they can only be observed. Music theories are descriptions of musical practices, i.e. descriptions of human cultures, ways of living. These cultures change and evolve all the time. You can even decide to create a new kind of a musical culture. Just start doing something ver differently. Probably your new kind of musical practice will need at least some new theory as well.
If you make music by somehow mapping things from somewhere, for example astronomy, astrology, biology, history, politics, economics, or whatever you want, into your music-making, so that there is some kind of a correlation between the source of inspiration and things you do in your music, then the source of inspiration can and should be a part of a theoretical analysis of your music. Like if a piece of music was structured around a historical event, then that bit of history has to be mentioned when describing the piece.
If you mean to ask, did people in the past use astronomical observations and theories as a source of inspiration for music-making, and if something that's used in existing musical cultures today could be said to have evolved from it? I'd say, most probably, because people have been fascinated by the stars for a long time. Or are you asking for a list of things that originally came to be when someone drew inspiration from astronomical things?
Comment: @teletypist I assume that you mean "music" = Western music culture and its history? And not music as a phenomenon. If that's the case, then that narrower definition already excludes the misconceptions I am trying to debunk, but without clearly explicating it. In the present times this is not self-evident, and it should be explicitly specified, which sub-culture, region, time-period we're talking about.
Comment: I think your description of music theory seems very modern. Boethius' De Musica (6th century CE), was a – if not the – principal text of music theory for most of the medieval period in the West up until the early modern period. He begins by declaring three kinds of music: the cosmic (ie the universe/astronomy/planets), the human, and the instrumental. The Astronomer Johannes Kepler (16th century CE) also develops this idea of universal cosmic music in the orbits of the planets. The connection of astronomy with music definitely has a long precedence.
Comment: I understand that what is understood as music theory has changed in recent times to describe practice, but the original question made references to the Phrygians (related to the Greeks), geometric relationships, astronomy, and instrument development. Historically these were absolutely and explicitly understood as being related, even as "a law of nature that cannot be changed". I'm not suggesting that the guitar is based on the stars, just the people who built instruments had a common mathematical language for both and hence saw them as related even if we don't.
Answer: The guitar was not invented by Pythagoras or Phrygians or anyone at the same period, but in late medieval period in Spain. It is of course base on earlier forms, such as the arabic al-oud. And lute-like instruments have been around an awfully long time. Also what the names of medieval church modes are based on ancient greek music theory, but they messed up a bit. For one thing the ancient greek scales were considered as falling insted of rising, but also what we call phrygian is actually the most regular and thus the "main scale" of greek music theory (not ancient greek music, but music theory!), and was called "doric". On the other hand what we call doric would be phrygian in ancient greek music theory.
Next: Any association between sky and stars and music is either romanticism, uninformedness or esoteric bs. There are always people who do believe in such stuff (even in modern days!), and since of course until a few hundred years back people had quite little understanding of why things behave as they behave it is natural to come to conclusions of such kind.
It is nevertheless quite unlikely that instruments were invented with such intentions or even improved with such inventions. The first people who created pluckable instruments probably did not think about pseudoastrological laws, and improvement of instruments was mostly a thing of experience and luck.
Ancient greek schools such as the pythagorean one liked to think in ratios of numbers. Ancient greek music theory takes much from the subdivision of a string in parts. Similar concepts were also applied to the understanding of cosmos, leading to this idea of music of the spheres, the basic idea of which is that movement of cosmic objects would create notes, and with the cosmos being perfectly ordered they would underlie the same principles as music theory.
Comment: @ToddWilcox Yes, that is true, but you should also know that the greek *kithára* had pretty much nothing else in common with a lute like instrument such as the guitar. The tuba was also not invented by the romans, even if the word came from them ...
Comment: Even though the guitar was not invented in Ancient Greece, the kithara was, and it was also a stringed instrument and it had a kind of whammy bar, and that's where the word "guitar" comes from.
Comment: @ToddWilcox Also still in that case, the *kithára* itself was much less invented but rather derived from different types of lyres such as the *phórminx*, some 200-300 years before Pythagoras was born, so even in this case I think it would be reasonable to point this out.
Comment: @Lazy I did not ask for astrology. I knew I might get comments like this so I clearly and specifically wrote "astronomy" and not "astrology". I'm not trying to figure out if the guitar can determine if I'm a virgo. I simply want to know if ancient cultures who invented the guitar drew inspiration from the stars, since the sky was such a big part of their life.
Answer: While modern music theory doesn't currently have any obvious relation to astronomy, it certainly did historically.
The Pythagoreans were very interested in the relationships between ratios and the natural world, including the orbits of the planets. Their early work on music as being based on harmony and proportions framed how the West approached music for over two thousand years.
The 6th-century Roman Philosopher Boethius declared in the De Musica that anyone schooled in music understood there was three kinds of music: cosmic (aka astronomy), the human (not merely singing but also describing how the body worked) and music "resting in the instruments". He relayed stories and accounts of how certain modes and scales of music would affect mood and could even heal people.
The De Musica was a very important musical text in the West all the way through the medieval era up through the early modern period. The reason that music seemed to have this broad application from astronomy through to medicine was likely because ratios and geometry were the most sophisticated mathematical tools to understand and think about the natural world.
As the medieval period ended, advances in arithmetic techniques (such as Arabic numerals) plus technology such as telescopes enabled astronomers to describe astronomical phenomena more accurately. A huge shift occurred in the way people understood the world as we (humanity) slowly moved from relative geometric measuring to Cartesian-based standardized measurement.
Many instruments we have inherited are from the time when ratio-thinking was dominant with an excellent example of this transition is the violin. The earliest recognizable modern violin shapes were compass and straight-edge constructions, but Stradivarius shapes which are popular nowadays are slightly modified from these more pure geometric constructions (similar to how planet orbits are not actually circles). Even our 12TET scale is a compromise based on–you guessed it–ratios.
Numbers such as seven and twelve show up from this history of ratios to construct scales and dealing with how ratio-based tunings become out of tune as tones are added. Seven tones constructed from simple ratios work well together as a scale: western note-naming is based on this seven notes in a scale system. Most approaches for constructing notes based on simple ratios start to nearly overlap after generating twelve notes, and the latter notes don't play well together without compromising the simple ratios used to construct them.
I can't necessarily explain why there are 12 hours in a day and 12 semitones in a modern western scale (and also 12 inches in a foot). Twelve is a very interesting number as far as factors go. Why the ancient Greeks decided to divide the daylight into 12 hours (from whom we inherited it) doesn't seem overly connected, although there are 12 months in a year and the Horae (goddesses of the hours) were associated with the seasons (Horae means Seasons).
Rather than thinking about how astronomy and music are related, it's better to consider that when geometry was the dominant form of mathematics as it was in the ancient world, applications which fitted geometry really well (astronomy and music) would lend themselves to describing each other and thinkers pondering how they were connected. Similar to how you're pondering that very question now. As for how such relationships could be used, maybe investigate the 16th-century astronomer Johannes Kepler's Music of the Spheres. Better yet, find a copy of De Musica and read it.
Comment: @Tetsujin I agree that the Greeks likely didn't invent 12 hour divisions, but the Horae page on Wikipedia showed an evolution from 9 to 12 suggesting some development on their part. Babylonians and Egyptians absolutely contributed plenty: geometry itself was the means by which the Egyptians re-established the boundaries of fields after the Nile flooded, geometry coming to us from the Greek for earth (geo-) measure (-metry).
Comment: idk why 12 notes works so well, but 12 works for many things because it factors in so many ways. 2, 3, 4, 6... 1/4 or 1/3 of 10 starts to get iffy to calculate on your fingers, 1/4 or 1/3 of 12 is easy. By the same reasoning we use 60 minute & 360 degrees. They divide well [they're also multiples of 12]. (I also think the Greeks & Romans got the 12-hour day from the Babylonians & Egyptians; they didn't invent it.)
Answer: As a physicist let me assure you: besides the fun factor you are wasting your time.
From a musical perspective, the way we tune today differs from the past (the tempered scale is a compromise which overcomes theoretical and practical problems from ancient and other ways to establish "natural" scales).
Many cultures long before us were excellent astronomical observers of the sky. However, impressive as many of their findings are, they won't hold up against modern astronomy, which e.g. takes into account both relativistic and quantum-mechancial effects.
One way to recall and communicate their findings over generations, some astronomic cycles took and take that long, was to present them as stories. Certainly these were proliferated into non-astronomical applications, be it intentionally or by chance.
Finally, a film is just a film, intended to entertain todays audiences.

Astronomy and music


How to restrict a user to stored procedures only?

Question: MySQL version 5.1.70-cll
phpMyAdmin version 3.5.8
cpanel version 11
How do I restrict a user to executing stored procedures only?
In cpanel I can add/remove users, and restrict them to only the 'select' command or only the 'create' command. However, 'call' is not present in the user privileges list.
I also cannot log in as 'root' as far as I can tell. (I am a MySQL newbie sorry.)
Thanks.
Comment: This question is not programming related. Secondly, did you read the manual?
Answer: Just grant the user EXECUTE permissions on any stored procedures you would like them to be able to execute, and don't give them any other permissions on the tables.
Keep in mind that if the user has no permissions on the tables, you'll need to use SQL SECURITY DEFINER when you create your procedures.
Comment: How do I from within cpanel or phpmyadmin restrict a user to a particular table? So far I've only been able to restrict them to a particular database.
Comment: @posfan12 - Just use the SQL editor in phpMyAdmin to manually run the appropriate GRANT statements.
Answer: The EXECUTE privilege is required to call stored procedures.
Documentation here: http://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html


Como juntar 2 select no mysql

Question: Tenho 2 select que são basicamente idênticos, mudando apenas 1 tabela. Estou tentando juntar os 2 em um único select, mas não estou conseguindo.
Segue os select:
SELECT DISTINCT
            a.id,
            a.unidade,
            a.posicao,
            a.nome,
            a.peso
        FROM
            produtos a,
            produtos_pedidos b
        WHERE
            a.id = b.id_produto
            and b.id_pedido IN (1,2)
        ORDER BY a.nome

Select 2:
 SELECT DISTINCT
            a.id,
            a.unidade,
            a.posicao,
            a.nome,
            a.peso
        FROM
            produtos a,
            pedidos_barganha b
        WHERE
            a.id = b.id_produto
            and b.id_pedido IN (1,2)
        ORDER BY a.nome

Alguém sabe como posso juntar os 2?
Answer: Você terá que usar o operador UNION entre eles, no seu caso ficaria assim:
SELECT DISTINCT
    a.id,
    a.unidade,
    a.posicao,
    a.nome,
    a.peso
FROM
    produtos a,
    produtos_pedidos b
WHERE
    a.id = b.id_produto
    and b.id_pedido IN (1,2)

UNION

SELECT DISTINCT
    p.id,
    p.unidade,
    p.posicao,
    p.nome,
    p.peso
FROM
    produtos p,
    pedidos_barganha pb
WHERE
    p.id = pb.id_produto
    and pb.id_pedido IN (1,2)
ORDER BY nome

Vale observar que caso você utilize o UNION o Order BY deve ser escrito somente ao final de toda sua consulta.
Além do UNION, você também pode utilizar o UNION ALL nesse link você pode ver a diferença entre eles e escolher o que irá te atender melhor
Comment: achei o erro, é so mudar o ' ORDER BY
        nome'
Comment: Deu o seguinte erro #1250 - Tabela 'a' de um dos SELECTs não pode ser usada em field list
Comment: @HugoBorges editei a resposta, vc poderia testar?
Comment: agora esta assim #1250 - Tabela 'p' de um dos SELECTs não pode ser usada em field list
Comment: @HugoBorges corrigir isso e adicionei mais uma informação no final
Answer: Usa o UNION.
SELECT DISTINCT
    a.id,
    a.unidade,
    a.posicao,
    a.nome,
    a.peso
FROM
    produtos a,
    produtos_pedidos b
WHERE
    a.id = b.id_produto
AND b.id_pedido IN (1, 2)
UNION
    SELECT DISTINCT
        c.id,
        c.unidade,
        c.posicao,
        c.nome,
        c.peso
    FROM
        produtos c,
        pedidos_barganha d
    WHERE
        c.id = d.id_produto
    AND d.id_pedido IN (1, 2)
    ORDER BY
        c.nome

Comment: Bom da sua forma deu o seguinte erro, #1221 - Uso errado de UNION e ORDER BY
Comment: Verdade. Tirei o `order by` do primeiro SELECT.
Comment: o erro mudou para #1250 - Tabela 'a' de um dos SELECTs não pode ser usada em field list

Como juntar 2 select no mysql


How to transform a table from an rts file into a pandas DataFrame?

Question: I have a file in rich text format with a table:

And I would like to get it in a pandas dataframe, but in a csv. Here is the file as we see it in notepad:
<code>{\rtf1\mac\deff2 {\fonttbl{\f20\froman Times;}}
{\stylesheet{\s224 \b\v\f20\fs20 \sbasedon0\snext0 PostScript;}
{\s243\tqc\tx4320\tqr\tx8640 \f20 \sbasedon0\snext243 footer;}
{\s244\tqc\tx4320\tqr\tx8640 \f20 \sbasedon0\snext244 header;}
{\f20 \sbasedon222\snext0 Normal;}
{\s2\ri-3022\tx1700\tqc\tx3420\tx3980\tx4240\tx6060\tx6220\tqc\tx8780\tqc\tx9920\tqc\tx11160\tx11820\tx11980 \f20\fs18 \sbasedon0\snext2 Trade tabs;}
{\s3\ri2560\sa400\tx1200\tqc\tx2680\tx3220\tx5120\tx6860\tx8100\tqc\tx8780\tqc\tx9920\tx10620 \f20\fs40 \sbasedon0\snext3 chapter head;}
{\s4\fi-9060\li9060\ri-40\sl220\tx280\tqr\tx2080\tx2520\tx4440\tx6140\tx6860\tqr\tx8500\tx8920 \f20\fs18 \sbasedon2\snext4 AT tab format;}
{\s5\sb100\sl80\brdrt\brdrhair \tqr\tx12860 \f20\fs8 \sbasedon6\snext5 thin line;}
{\s6\sb100\sl220\brdrt\brdrs \tqr\tx12860 \f20\fs8 \sbasedon2\snext6 main line;}}
\paperw16820\paperh11880\margl1820\margr2260\margt2160
\margb2160\facingp\deftab709\widowctrl\ftnbj
\pgnstart1\fracwidth \sectd \linemod0\linex0\headery2160\footery960\cols1
\endnhere\titlepg
\pard\plain \s3\sa400\tx1200\tqdec\tx3000\tx3220
\tx5120\tx6860\tx8100\tqc\tx8780\tx9820

\f20\fs40 Transfers of major weapons: Deals with deliveries or orders made for 2020 to 2020\par
\pard\plain \s2\qj\sa100\sl240\tx1200\tqdec\tx3000\tx3220\tx5120\tx6940\tx7840\tqc\tx9120\tx9820 \f20\fs18
{\fs20\b Note: \b0 The \'d4No. delivered\'d5 and the \'d4Year(s) of deliveries\'d5 columns refer to all deliveries since the beginning of the contract. The \'d4Comments\'d5 column includes publicly reported information on the value of the deal. Information on the sources and methods used in the collection of the data, and explanations of the conventions, abbreviations and acronyms, can be found at URL <http://www.sipri.org/contents/armstrad/sources-and-methods>. \par \b Source: \b0 SIPRI Arms Transfers Database\par \b Information generated:\b0  05 May 2021\par \par }
\pard\plain \s6\sl40\brdrt\brdrs \tqr\tx12860 \f20\fs8 \tab \par
\pard\plain \s2\sl200\tx280\tx1540\tx2520\tx4440\tx6080\tx6860
\tx7780\tx8920 \f20\fs18{\b
\tab \tab \tab \tab  \tab Year(s)\tab \tab \line
Supplier/\tab \tab No.\tab Weapon\tab Weapon\tab Year\tab of\tab No.
\tab \line
\tab recipient (R)\tab ordered\tab designation\tab description
\tab of order\tab delivery\tab delivered\tab Comments\par }\pard\plain \s6\sb40\sl40\brdrt\brdrs
\tqr\tx12860 \f20\fs8 \tab \par
\pard\plain \s2\ri-40\sl220\tx280\tqr\tx2080\tx2520
\tx4440\tx6020\tx6860\tqr\tx8500\tx8920 \f20\fs18
\pard \s2\fi-9060\li9060\ri-40\sl220\tx280\tqr\tx2080
\tx2520\tx4440\tx6140\tx6860\tqr\tx8500\tx8920 \pard\plain \s6\sb40\sl40\brdrt\brdrs
\tqr\tx12860 \f20\fs8 \tab \par
\pard\plain \s2\ri-40\sl220\tx280\tqr\tx2080\tx2520
\tx4440\tx6020\tx6860\tqr\tx8500\tx8920 \f20\fs18
\pard \s2\fi-9060\li9060\ri-40\sl220\tx280\tqr\tx2080
\tx2520\tx4440\tx6140\tx6860\tqr\tx8500\tx8920
{\b France}\par{\b R:} Denmark\tab (9)\tab FLASH\tab ASW sonar\tab 2019\tab \tab \tab ASQ22 ALFS version; for 9 MH-60R ASW helicopters from USA; probably from US production line\par{\b     } Egypt\tab 2\tab UMS-4110 BlueMaster\tab ASW sonar\tab 2020\tab 2020\tab 1\tab For 2 FREMM frigates from Italy\par{\b     } Qatar\tab 16\tab NH-90 TTH\tab Transport helicopter\tab 2018\tab \tab \tab Part of EUR3 b deal; delivery planned 2021-2025\par{\b     } Australia\tab 12\tab Barracuda\tab Submarine\tab (2019)\tab \tab \tab AUD90 b ($70 b) 'SEA-1000' programme; produced under licence in Australia (incl. at least 60% of value from Australian production); Shortfin Barracuda Block-1A version; Australian designation Attack; delivery planned 2033/2034-2050\par{\b     } Belgium\tab 6\tab MCM-2720\tab MCM ship\tab 2019\tab \tab \tab Part of EUR2 b 'MCMV' programme (incl 6 for Netherlands; incl production of components in Belgium); delivery planned from 2023/2024\par{\b     } Brazil\tab 43\tab EC725 Super Cougar\tab Transport helicopter\tab 2008\tab 2010-2020\tab (38)\tab Part of EUR1.9 b 'H-XBR' programme; H225M version; incl 3 CSAR version; Brazilian designations H-36, HM-4, UH-15A and UH-15B; delivery planned 2010-2022\par{\b     } \tab\tab 2\tab P-400\tab Patrol craft\tab 2009\tab \tab \tab NAPA-500 version; produced under licence in Brazil; Brazilian designation Macae\par{\b     } \tab\tab 4\tab Scorpene\tab Submarine\tab 2009\tab \tab \tab Part of EUR6.8 b 'SDP' programme; S-BR version; produced under licence in Brazil; Brazilian designation Riachuelo; delivery planned 2021-2024\par{\b     } \tab\tab 1\tab SNBR\tab Nuclear submarine\tab 2009\tab \tab \tab Part of EUR6.8 b 'SDP' programme; produced under licence in Brazil with nuclear reactor designed and produced in Brazil; delivery planned 2033/2034\par{\b     } \tab\tab (20)\tab AM-39 Exocet\tab Anti-ship missile\tab (2011)\tab 2018-2020\tab (15)\tab AM-39 Block-2Mod-2 version; for EC-725 (AH-15B) helicopters; incl production of components in Brazil\par{\b     } \tab\tab 5\tab EC725 Super Cougar\tab Anti-ship helicopter\tab 2012\tab 2019-2020\tab (2)\tab Part of EUR1.9 b 'H-XBR' programme; H225M version; Brazilian designation AH-15B and Operacio MB; delivery planned 2019-2022\par{\b     } China\tab . .\tab AS565S Panther\tab ASW helicopter\tab (1980)\tab 1989-2020\tab (49)\tab AS365F version; Chinese designation Z-9C Haitun; produced in China\par{\b     } \tab\tab . .\tab AS365/AS565 Panther\tab Helicopter\tab 1988\tab 1992-2020\tab (442)\tab Produced under licence in China as Z-9A or Z-9A-100 Haitun and Z-9B/G; incl Z-9WZ anti-tank version\par{\b     } \tab\tab . .\tab Arriel\tab Turboshaft\tab (2005)\tab 2012-2020\tab (560)\tab For Z-19 combat helicopter produced in China; Arriel-2 version produced under licence in China as WZ-8C\par{\b     } \tab\tab (34)\tab PC2.5\tab Diesel engine\tab (2005)\tab 2007-2019\tab (26)\tab PC-2.6 version for 6 Type-071 (Yuzhao) AALS and 1 Danyao support ship produced in China\par{\b     } \tab\tab (144)\tab PA6\tab Diesel engine\tab (2010)\tab 2013-2020\tab (140)\tab Produced under licence in China; for 70 Type-056 (Jiangdao) frigates produced in China\par{\b     } Czechia\tab 62\tab TITUS\tab APC\tab 2019\tab \tab \tab CZK6b ($264 m) deal (produced in Czech Republic); incl. 40 command post and 20 fire control versions; delivery planned 2022-2023\par{\b     } Egypt\tab 4\tab Gowind-2500\tab Frigate\tab 2014\tab 2017\tab 1\tab EUR1 b deal incl option on 2 more; incl 3 produced under licence in Egypt; Egyptian designation El Fateh\par{\b     } India\tab 6\tab Scorpene\tab Submarine\tab 2005\tab 2017-2019\tab 2\tab INR207-237 b ($3.2-4.5 b) 'Project-75' programme; produced under licence in India as Kalvari; delivery planned 2017-2022/2023 (delayed from 2012-2017)\par{\b     } \tab\tab (49)\tab Mirage-2000-5\tab FGA aircraft\tab 2011\tab 2015-2020\tab (21)\tab INR109-175 b deal ($2.3-2.6 b; offsets $593 m); Indian Mirage-2000H rebuilt to Mirage-2000-5; incl 2 produced in France and rest in India; delivery planned 2015-2023\par{\b     } \tab\tab 36\tab Rafale\tab FGA aircraft\tab 2017\tab 2019-2020\tab (13)\tab EUR7.8 b deal (incl EUR5.2 b for aircraft EUR1.8 b for spare parts and EUR710 m for armament; 50% offsets incl 20% as production of components in India); Rafale-EH version (incl 8 Rafale-DH trainer/combat version); delivery planned 2019-2022\par{\b     } \tab\tab 8\tab SA-316B Alouette-3\tab Light helicopter\tab 2017\tab 2019-2020\tab (8)\tab INR3.2 b deal; produced under licence in India as Chetak\par{\b     } \tab\tab 10\tab SA-315B Lama\tab Light helicopter\tab (2018)\tab \tab \tab Cheetal version; produced under licence in India; delivery planned from 2021\par{\b     } Indonesia\tab (10)\tab AS-532 Cougar/AS-332\tab Transport helicopter\tab 1997\tab 2001-2017\tab (9)\tab Produced under licence in Indonesia; NAS-332 and NAS-332C1+ versions; incl some for CSAR\par{\b     } Kazakhstan\tab 20\tab Ground Master-400\tab Air search radar\tab 2014\tab 2014-2018\tab (2)\tab Incl production in Kazakhstan\par{\b     } Malaysia\tab 6\tab Gowind-2500\tab Frigate\tab 2014\tab \tab \tab 'SGVP-LCS' programme; produced under licence in Malaysia; Malaysian designation Maharaja Lela; delivery planned from 2023 (delayed from 2019)\par{\b     } Saudi Arabia\tab 39\tab HSI-32\tab Patrol craft\tab 2018\tab 2019-2020\tab (9)\tab Incl production of 18 in Saudi Arabia\par{\b     } \tab\tab 19\tab HSI-32\tab Patrol craft\tab 2020\tab \tab \tab Probably produced under licence in Saudi Arabia\par{\b     } South Korea\tab (210)\tab EC155\tab Helicopter\tab 2015\tab \tab \tab Produced under licence in South Korea; LCH-LAH version; delivery planned from 2023\par{\b     } Spain\tab 24\tab EC-665 Tiger\tab Combat helicopter\tab 2003\tab 2007-2020\tab (24)\tab EUR1.4 b deal; incl 6 HAP and 18 HAD versions; incl production under licence of 18 in Spain\par{\b     } \tab\tab 22\tab NH-90 TTH\tab Transport helicopter\tab 2005\tab 2014-2020\tab (17)\tab EUR1.3 b deal; most assembled/produced under licence in Spain; Spanish designation HT-29 and HD-29; delivery planned 2014-2021\par{\b     } Ukraine\tab 20\tab FPB-98\tab Patrol craft\tab 2020\tab \tab \tab For border guard; FPB-98 Mk-1 version; incl 5 produced under licence; delivery planned 2021-2024\par{\b     } United States\tab (60)\tab PC2.5\tab Diesel engine\tab (1996)\tab 2006-2017\tab 44\tab Produced in USA for 15 San Antonio AALS produced in USA\par{\b     } Algeria\tab 10\tab FPB-98\tab Patrol craft\tab 2018\tab 2019-2020\tab (10)\tab \par{\b     } Angola\tab \tab Vigilante-1400\tab OPV\tab 2016\tab \tab \tab Part of EUR495 m deal; designation uncertain (reported as 'long patrol vessel')\par{\b     } \tab\tab \tab Vigilante-400\tab Patrol craft\tab 2016\tab \tab \tab Part of EUR495 m deal; designation uncertain (reported as 'short patrol vessel')\par{\b     } Argentina\tab 3\tab Gowind\tab OPV\tab 2018\tab \tab \tab Part of EUR319 m deal; Argentinian designation Bouchard; delivery planned 2021-2022\par{\b     } Belgium\tab 382\tab Griffon VBMR\tab APC\tab 2019\tab \tab \tab Part of EUR1.1 b or EUR1.6 b deal; assembled in Belgium; delivery planned 2025-2030\par{\b     } \tab\tab 60\tab Jaguar EBRC\tab Armoured car\tab 2019\tab \tab \tab Part of EUR1.1 b or EUR1.6 b deal; partly assembled in Belgium; delivery planned 2025-2030\par{\b     } Bolivia\tab 4\tab Ground Master-400\tab Air search radar\tab 2016\tab 2019-2020\tab (4)\tab Part of EUR191 m ($215 m) deal; incl for civilian use\par{\b     } Botswana\tab (50)\tab MICA\tab BVRAAM\tab 2016\tab 2020\tab (50)\tab For VL-MICA SAM system\par{\b     } \tab\tab (140)\tab Mistral\tab Portable SAM\tab 2016\tab 2018-2020\tab (140)\tab \par{\b     } \tab\tab (1)\tab VL-MICA\tab SAM system\tab 2016\tab 2020\tab (1)\tab \par{\b     } Brazil\tab \tab F21 533mm\tab AS/ASW torpedo\tab (2009)\tab 2019\tab (2)\tab For Scorpene submarines\par{\b     } Burkina Faso\tab 6\tab Bastion\tab APC/APV\tab 2019\tab 2019-2020\tab (6)\tab Aid financed by EU\par{\b     } Chad\tab 7\tab Bastion\tab APC/APV\tab 2019\tab 2019-2020\tab (7)\tab Financed by EU\par{\b     } \tab\tab 9\tab ERC-90\tab Armoured car\tab 2020\tab \tab \tab Second-hand; aid; delivery planned 2021\par{\b     } Chile\tab 5\tab AS-350/AS-550 Fennec\tab Light helicopter\tab 2019\tab 2020\tab 1\tab 'Project Gaviota'; delivery planned 2020-2022\par{\b     } Cyprus\tab \tab Mistral\tab Portable SAM\tab 2019\tab \tab \tab EUR150 m deal\par{\b     } \tab\tab (20)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab 2019\tab 2020\tab (10)\tab For 1 Exocet coast defence system\par{\b     } Denmark\tab 15\tab CAESAR 155mm\tab Self-propelled gun\tab 2017\tab 2019\tab (2)\tab Option on 6 more; delivery planned 2019-2021\par{\b     } \tab\tab 4\tab CAESAR 155mm\tab Self-propelled gun\tab 2019\tab \tab \tab \par{\b     } Egypt\tab (50)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab (2014)\tab 2017\tab (10)\tab For Gowind frigates\par{\b     } \tab\tab (100)\tab MICA\tab BVRAAM\tab 2015\tab 2017\tab (25)\tab For Gowind frigates\par{\b     } \tab\tab (50)\tab Storm Shadow/SCALP\tab ASM\tab (2015)\tab \tab \tab SCALP version; for Rafale combat aircraft\par{\b     } Estonia\tab (100)\tab Mistral\tab Portable SAM\tab 2018\tab 2020\tab (30)\tab \par{\b     } Germany\tab (18)\tab Ocean Master\tab MP aircraft radar\tab 2013\tab 2019\tab (3)\tab For 18 NH-90 ASW helicopters produced in FRG\par{\b     } \tab\tab (62)\tab RTM-332\tab Turboshaft\tab (2020)\tab \tab \tab For 31 NH90 NFH (Sea Tiger) ASW helicopters produced in Germany\par{\b     } Greece\tab (60)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab (2008)\tab 2010-2020\tab (60)\tab For Super Vita (Roussen) FAC\par{\b     } \tab\tab \tab Meteor\tab BVRAAM\tab (2020)\tab \tab \tab For Rafale combat aircraft; selected but contract not yet signed end-2020\par{\b     } \tab\tab 12\tab Rafale\tab FGA aircraft\tab (2020)\tab \tab \tab Second-hand; part of EUR2.3 b deal; delivery planned 2021-2022\par{\b     } \tab\tab 6\tab Rafale\tab FGA aircraft\tab (2020)\tab \tab \tab Part of EUR2.3 b deal; delivery planned 2023\par{\b     } Hungary\tab 16\tab EC725 Super Cougar\tab Transport helicopter\tab 2018\tab \tab \tab Armed H225M Caracal version\par{\b     } India\tab 16\tab PA6\tab Diesel engine\tab (2003)\tab 2014-2020\tab 16\tab For 4 Kamorta (Project-28) frigates produced in India\par{\b     } \tab\tab 36\tab SM-39 Exocet\tab Anti-ship missile\tab 2005\tab 2017-2020\tab (9)\tab Possibly $150 m deal; SM-39 Block-2 version; for Scorpene submarines\par{\b     } \tab\tab 493\tab MICA\tab BVRAAM\tab 2012\tab 2014-2020\tab (493)\tab EUR950 m deal (offsets 30%); MICA-EM and MICA-IR versions; for Mirage-2000-5 combat aircraft\par{\b     } \tab\tab (358)\tab Ardiden-1\tab Turboshaft\tab (2016)\tab \tab \tab For LCH combat helicopter produced in India; produced under licence in India as Shakti\par{\b     } \tab\tab (200)\tab Meteor\tab BVRAAM\tab (2016)\tab 2020\tab (100)\tab Part of EUR710 m deal; for Rafale combat aircraft\par{\b     } \tab\tab (350)\tab MICA\tab BVRAAM\tab (2016)\tab 2020\tab (175)\tab Part of EUR710 m deal; MICA-RF and MICA-IR versions; for Rafale combat aircraft\par{\b     } \tab\tab (200)\tab Storm Shadow/SCALP\tab ASM\tab 2016\tab 2020\tab (100)\tab Part of EUR710 m deal; SCALP version; for Rafale combat aircraft\par{\b     } \tab\tab . .\tab AASM\tab ASM\tab (2020)\tab \tab \tab For Rafale combat aircraft\par{\b     } Indonesia\tab (2)\tab AS-565S Panther\tab ASW helicopter\tab 2014\tab 2019-2020\tab 2\tab AS565MBe version; assembled in Indonesia\par{\b     } \tab\tab (14)\tab MIDR\tab Diesel engine\tab (2016)\tab 2019-2020\tab (9)\tab For 14 Badak armoured fire support vehicles produced in Indonesia\par{\b     } \tab\tab (50)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab 2016\tab 2019-2020\tab (25)\tab For SIGMA frigates\par{\b     } \tab\tab 2\tab VL-MICA-M\tab Naval SAM system\tab 2016\tab 2019-2020\tab 2\tab For 2 SIGMA-10514 (Martadinata) frigates from Netherlands\par{\b     } \tab\tab 18\tab CAESAR 155mm\tab Self-propelled gun\tab 2017\tab 2019-2020\tab 18\tab EUR60 m deal\par{\b     } \tab\tab 8\tab EC725 Super Cougar\tab Transport helicopter\tab (2018)\tab \tab \tab H225M armed Combat SAR version\par{\b     } \tab\tab (40)\tab MICA\tab BVRAAM\tab (2018)\tab 2019-2020\tab (40)\tab VL-MICA SAM version for SIGMA-10514 (Martadinata) frigates\par{\b     } Iraq\tab 4\tab Ground Master-400\tab Air search radar\tab 2020\tab \tab \tab Delivery planned from 2021\par{\b     } Italy\tab 14\tab 2R2M 120mm\tab Mortar\tab (2019)\tab \tab \tab For 14 Freccia mortar carriers produced in Italy\par{\b     } Kuwait\tab 30\tab EC725 Super Cougar\tab Transport helicopter\tab 2016\tab 2020\tab 2\tab EUR1.1 b deal; H-225M Caracal version; incl 6 for National Guard; delivery planned 2020-2021\par{\b     } \tab\tab (300)\tab Sherpa\tab APC/APV\tab 2018\tab 2019-2020\tab (300)\tab EUR270 m deal\par{\b     } Malaysia\tab \tab MICA\tab BVRAAM\tab (2015)\tab \tab \tab For 6 Combat Gowind (SGVP-LCS) frigates\par{\b     } \tab\tab 18\tab LG1 105mm\tab Towed gun\tab 2018\tab 2020\tab (18)\tab LG-1 Mk-3 version; assembled from kits in Malaysia\par{\b     } Mali\tab 13\tab Bastion\tab APC/APV\tab 2019\tab 2020\tab 13\tab Aid financed by EU; incl 1 command post and 2 ambulance version\par{\b     } Mexico\tab 1\tab CAPTAS TAS\tab ASW sonar\tab (2017)\tab 2020\tab (1)\tab CAPTAS-2 version; for 1 SIGMA-105 (Reformador) frigate from Netherlands\par{\b     } Morocco\tab (36)\tab CAESAR 155mm\tab Self-propelled gun\tab 2020\tab \tab \tab EUR200 m deal\par{\b     } \tab\tab \tab MICA\tab BVRAAM\tab 2020\tab \tab \tab For VL-MICA SAM system\par{\b     } \tab\tab 36\tab Sherpa\tab APC/APV\tab 2020\tab \tab \tab Incl Scout and APC version\par{\b     } \tab\tab \tab VL-MICA\tab SAM system\tab 2020\tab \tab \tab EUR192-200 m deal\par{\b     } Netherlands\tab 6\tab MCM-2720\tab MCM ship\tab 2019\tab \tab \tab Part of EUR2 b 'MCMV' programme (incl 6 for Belgium); delivery planned from 2025\par{\b     } Nigeria\tab 2\tab FPB-110\tab Patrol craft\tab 2019\tab 2020\tab (2)\tab FPB-110 Mk-2 version\par{\b     } \tab\tab 1\tab FPB-72\tab Patrol craft\tab 2019\tab 2020\tab 1\tab \par{\b     } Norway\tab 6\tab FLASH\tab ASW sonar\tab 2002\tab 2019-2020\tab (2)\tab For 6 NH-90 ASW helicopters from Italy\par{\b     } Philippines\tab (40)\tab Mistral\tab Portable SAM\tab 2019\tab \tab \tab Mistral-3 version; for HHI-2600 (Rizal) frigates; delivery planned 2021\par{\b     } Qatar\tab 300\tab AASM\tab ASM\tab 2015\tab 2019-2020\tab (300)\tab For Rafale combat aircraft\par{\b     } \tab\tab 60\tab AM-39 Exocet\tab Anti-ship missile\tab 2015\tab 2019-2020\tab (60)\tab AM-39 Block-2 Mod-2 version; for Rafale combat aircraft\par{\b     } \tab\tab 52\tab M-88\tab Turbofan\tab 2015\tab 2019-2020\tab (52)\tab Spares for Rafale combat aircraft\par{\b     } \tab\tab (160)\tab Meteor\tab BVRAAM\tab 2015\tab 2019-2020\tab (160)\tab For Rafale combat aircraft\par{\b     } \tab\tab 300\tab MICA\tab BVRAAM\tab 2015\tab 2019-2020\tab (300)\tab Incl 150 MICA-ER and 150 MICA-EM version; for Rafale combat aircraft\par{\b     } \tab\tab 24\tab Rafale\tab FGA aircraft\tab 2015\tab 2019-2020\tab (24)\tab Part of EUR6.7 b deal; incl 18 Rafale-EQ (Q3-R) and 6 Rafale-DQ versions\par{\b     } \tab\tab 140\tab Storm Shadow/SCALP\tab ASM\tab 2015\tab 2019-2020\tab (140)\tab SCALP version; for Rafale combat aircraft\par{\b     } \tab\tab \tab Exocet CDS\tab Coastal defence system\tab 2016\tab \tab \tab Incl for use with Marte-ER anti-ship missiles; EUR640 m deal; delivery planned from 2022\par{\b     } \tab\tab (30)\tab MICA\tab BVRAAM\tab (2016)\tab \tab \tab For Fincantieri-700 corvettes from Italy\par{\b     } \tab\tab \tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab 2016\tab \tab \tab For coastal defence\par{\b     } \tab\tab (80)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab (2016)\tab \tab \tab For Fincantieri-3000 frigates and Fincantieri-700 corvettes from Italy\par{\b     } \tab\tab 2\tab VL-MICA-M\tab Naval SAM system\tab (2016)\tab \tab \tab For 2 Fincantieri-700 corvettes from Italy\par{\b     } \tab\tab 12\tab Rafale\tab FGA aircraft\tab 2017\tab \tab \tab Delivery planned 2021-2022\par{\b     } \tab\tab 16\tab AS-350/AS-550 Fennec\tab Light helicopter\tab 2018\tab 2018-2020\tab (16)\tab H125 version\par{\b     } Romania\tab 4\tab Gowind-2500\tab Frigate\tab (2019)\tab \tab \tab EUR1.2 b deal; incl production in Romania; delivery planned from 2022\par{\b     } Saudi Arabia\tab 3\tab Combattante FS-56\tab FAC\tab (2016)\tab \tab \tab EUR250 m deal; originally ordered by Saudi Arabia as aid for Lebanon but taken over by Saudi Arabia after aid cancelled; possibly to be delivered as patrol craft for coast guard\par{\b     } Senegal\tab 2\tab RPB-33\tab Patrol craft\tab 2018\tab 2019\tab 1\tab \par{\b     } \tab\tab (25)\tab Marte-2\tab Anti-ship missile\tab 2019\tab \tab \tab Marte-2/N version; for 3 OPV-58 FAC\par{\b     } \tab\tab \tab Mistral\tab Portable SAM\tab (2019)\tab \tab \tab For Simbad RC SAM on OPV-58 FAC\par{\b     } \tab\tab 3\tab OPV-58\tab FAC\tab 2019\tab \tab \tab \par{\b     } Serbia\tab 50\tab Mistral\tab Portable SAM\tab 2019\tab \tab \tab Mistral M3 version; incl for PASARS-16 SPAAG; delivery planned 2021\par{\b     } Singapore\tab (12)\tab EC725 Super Cougar\tab Transport helicopter\tab 2016\tab \tab \tab H225M version; delivery planned from 2021\par{\b     } South Korea\tab 4\tab PC2.5\tab Diesel engine\tab (2015)\tab \tab \tab For 1 Dokdo AALS produced in South Korea\par{\b     } Spain\tab 5\tab CAPTAS\tab ASW sonar\tab (2019)\tab \tab \tab Part of EUR166 m deal; CAPTAS-4 Compact version for 5 F-110 frigates produced in Spain\par{\b     } \tab\tab 5\tab UMS-4110 BlueMaster\tab ASW sonar\tab 2019\tab \tab \tab Part of EUR166 m deal; for 5 F-110 frigates produced in Spain\par{\b     } Tanzania\tab 8\tab AS-350/AS-550 Fennec\tab Light helicopter\tab 2017\tab 2018\tab 3\tab H125 version\par{\b     } Thailand\tab 4\tab EC725 Super Cougar\tab Transport helicopter\tab 2018\tab \tab \tab H225M version; delivery planned 2021\par{\b     } \tab\tab 12\tab LG1 105mm\tab Towed gun\tab (2020)\tab \tab \tab THB834 m ($27 m) deal; LG1 Mk-3 version; selected 2020 but possibly not yet ordered by end-2020\par{\b     } Togo\tab (5)\tab SA-342 Gazelle\tab Light helicopter\tab (2017)\tab 2019-2020\tab (5)\tab Second-hand; EUR20 m deal; SA-342M version\par{\b     } Turkey\tab 15\tab Ocean Master\tab MP aircraft radar\tab 2002\tab 2013-2020\tab (10)\tab Part of $400 m deal; part of 'Meltem' programme; for 9 CN-235MPA from Spain and 6 ATR-72 MP aircraft from Italy\par{\b     } UAE\tab 2\tab Helios-2\tab Recce satellite\tab 2015\tab 2020\tab 1\tab EUR700 m deal; Falcon Eye or Pleiades version\par{\b     } \tab\tab 2\tab Gowind-2500\tab Frigate\tab 2019\tab \tab \tab EUR750 m deal; option on 2 more\par{\b     } \tab\tab (30)\tab MM-40-3 Exocet\tab Anti-ship MI/SSM\tab (2019)\tab \tab \tab For Gowind-2500 frigates\par{\b     } \tab\tab \tab RDY\tab Combat ac radar\tab 2019\tab \tab \tab For modernization of Mirage-2000-9 combat aircraft; RDY-3 version\par{\b     } Ukraine\tab 12\tab EC725 Super Cougar\tab Transport helicopter\tab 2018\tab 2018-2019\tab 3\tab Second-hand; part of EUR555 m deal; H-225 version\par{\b     } United States\tab (45)\tab Mirage F-1C\tab FGA aircraft\tab 2017\tab 2019-2020\tab (15)\tab Second-hand (18 more delivered for spare parts); for US company for training of US armed forces\par{\b     } Uzbekistan\tab 8\tab EC725 Super Cougar\tab Transport helicopter\tab 2018\tab 2018\tab 3\tab Armed H-215M version\par\pard\plain \s6\sb100\sl220\brdrt\brdrs \tqr \tx12860 \f20\fs8 \par
\pard\plain \s2\fi-9060\li9060\ri-40\sl220\tx280\tqr
\tx2080\tx2520\tx4440\tx6140\tx6860\tqr\tx8500\tx8920 \f20\fs18
{\plain \f20 \par }
\pard\plain \s3\qj\fi220\sl280 \f20\fs22 {\plain \f20 \par }}
</code>
And I would like to get it in a pandas dataframe like the following:
<code>                                                    Year(s)
                     No.            Weapon      Weapon      Year        of          No.
    recipient        ordered        designation description of order    delivery    delivered   Comments

     Belgium         (8)            RTM-332     Turboshaft  (2001)  2013-2015   (8) For 4 NH90 NFH ASW helicopters from Germany
     Denmark         (9)            FLASH           ASW sonar   2019            ASQ22 ALFS version; for 9 MH-60R ASW helicopters from USA; probably from US production line
     Egypt            2             UMS-4110       BlueMaster   ASW sonar   2020    2020    1   For 2 FREMM frigates from Italy
     Kenya           12             Bastion     APC/APV (2018)  2018    12  Financed by USA
     Qatar           16             NH-90 TTH       Transport helicopter    2018            Part of EUR3 b deal; delivery planned 2021-2025
     Australia       22             EC-665 Tiger    Combat helicopter   2001    2004-2011   (22)    AUD1.3 b ($670-981 m) 'Project Air-87' (offsets incl production of components and assembly of 18 in Australia and production of EC-120 helicopter for Asian market); Aussie Tiger version
</code>
I've started doing some research to see if there is any automated tool, as the table is really ugly in rts format:
Answer: Unfortunately I cannot find any automated tools for this extraction process either, but looking into the rtf tags we can try to piece together a reasonable working solution.
I noticed that the tag <code>\\par{\\b     } </code> is used to separate rows, and that the tag <code>\\tab </code> separates cells within rows.
For the time being, I just hardcoded the column names, but perhaps someone with more working knowledge of the tags in <code>rtf</code> files can suggest how to automatically extract those names, and improve upon my answer.
There is also some additional cleanup to be done as there are still some other tags remaining within the text of each cell.
<code>import re
import pandas as pd

## read in the text as a string
with open('weapons.rtf', 'r') as file:
    rawtext = file.read()

## the tag with R: as text is the starting point of the table
tabletext = rawtext.split("{\\b R:}")[-1]
rows = tabletext.split("\\par{\\b     } ")
cells = [row.split("\\tab ") for row in rows]

df = pd.DataFrame(data=cells, columns=
    ['recipient','No. ordered','Weapon designation','Weapon description',
    'Year of order','Year of delivery','No. delivered','Comments']
)

## clean up cells by replacing \\tab with an empty string
df_cleaned = df.replace("\\tab", "")
</code>
Here is the beginning and end of the output from <code>print(df_cleaned.to_string())</code>:
<code>         recipient No. ordered    Weapon designation      Weapon description Year of order Year of delivery No. delivered                                                                                Comments
0          Denmark         (9)                 FLASH               ASW sonar          2019                                                                                ASQ22 ALFS version; for 9 MH-60R ASW helicopters from USA; probably from US production line
1            Egypt           2   UMS-4110 BlueMaster               ASW sonar          2020             2020             1                                                                                For 2 FREMM frigates from Italy
2            Qatar          16             NH-90 TTH    Transport helicopter          2018                                                                                Part of EUR3 b deal; delivery planned 2021-2025
3        Australia          12             Barracuda               Submarine        (2019)                                                                                AUD90 b ($70 b) 'SEA-1000' programme; produced under licence in Australia (incl. at least 60% of value from Australian production); Shortfin Barracuda Block-1A version; Australian designation Attack; delivery planned 2033/2034-2050
4          Belgium           6              MCM-2720                MCM ship          2019                                                                                Part of EUR2 b 'MCMV' programme (incl 6 for Netherlands; incl production of components in Belgium); delivery planned from 2023/2024
5           Brazil          43    EC725 Super Cougar    Transport helicopter          2008        2010-2020          (38)                                                                                Part of EUR1.9 b 'H-XBR' programme; H225M version; incl 3 CSAR version; Brazilian designations H-36, HM-4, UH-15A and UH-15B; delivery planned 2010-2022
6                            2                 P-400            Patrol craft          2009                                                                                NAPA-500 version; produced under licence in Brazil; Brazilian designation Macae
7                            4              Scorpene               Submarine          2009                                                                                Part of EUR6.8 b 'SDP' programme; S-BR version; produced under licence in Brazil; Brazilian designation Riachuelo; delivery planned 2021-2024
8                            1                  SNBR       Nuclear submarine          2009                                                                                Part of EUR6.8 b 'SDP' programme; produced under licence in Brazil with nuclear reactor designed and produced in Brazil; delivery planned 2033/2034
9                         (20)          AM-39 Exocet       Anti-ship missile        (2011)        2018-2020          (15)                                                                                AM-39 Block-2Mod-2 version; for EC-725 (AH-15B) helicopters; incl production of components in Brazil
10                           5    EC725 Super Cougar    Anti-ship helicopter          2012        2019-2020           (2)                                                                                Part of EUR1.9 b 'H-XBR' programme; H225M version; Brazilian designation AH-15B and Operacio MB; delivery planned 2019-2022

...

129        Ukraine          12    EC725 Super Cougar    Transport helicopter          2018        2018-2019             3                                                                                Second-hand; part of EUR555 m deal; H-225 version
130  United States        (45)           Mirage F-1C            FGA aircraft          2017        2019-2020          (15)                                                                                Second-hand (18 more delivered for spare parts); for US company for training of US armed forces
131     Uzbekistan           8    EC725 Super Cougar    Transport helicopter          2018             2018             3  Armed H-215M version\par\pard\plain \s6\sb100\sl220\brdrt\brdrs \tqr \tx12860 \f20\fs8 \par \n\pard\plain \s2\fi-9060\li9060\ri-40\sl220\tx280\tqr\n\tx2080\tx2520\tx4440\tx6140\tx6860\tqr\tx8500\tx8920 \f20\fs18 \n{\plain \f20 \par }\n\pard\plain \s3\qj\fi220\sl280 \f20\fs22 {\plain \f20 \par }}
</code>


Getting python to run an application when the application needs an input file

Question: import subprocess
subprocess.call(['C:\\Users\michael\\Desktop\\Test\\pdftotext'])

pdftotext is the application that will run if I use this ^ code. This works fine, however, I'm trying to find a way to run pdftotext that includes the pdf's file name which pdftotext uses to convert it into a text file.
Note this is NOT a question about pdftotext.
When I use cmd in windows to run this I simply type pdftotext fileName.pdf and it converts the pdf file into a text file, no problem. Now I want to do something equivalent with Python.
I changed it to this, but it doesn't work. I'm told "The system cannot find the file specified" and I've put pdftotext in the src file along with filename.pdf
import subprocess
subprocess.call(['C:\\Users\michael\\Desktop\\Test\\pdftotext', 'filename.pdf'])

Comment: Use a `r"raw\string"` to ensure you don't make mistakes in the string literal such as using `"\m"` instead of `"\\m"`. Fortunately `"\m"` isn't a special character.
Comment: Also you're depending on "filename.pdf" being in the working directory. That depends on how the script is run. You may instead need the absolute path to the file, or a path that's relative to the script's directory. Novice programmers often mistakenly assume that the script directory and the working directory are the same.
Answer: subprocess.call takes an iterable where the first item is the executable and the following are switches and parameters.
This means you need to change the above to this:
import subprocess
subprocess.call(['C:\\Users\michael\\Desktop\\Test\\pdftotext', 'filename.pdf'])


Counting the Number of Integral Solutions to $x^2+dy^2 = n$

Question: It is a well known result that the number of integer solutions $(x,y), x>0, y\ge 0$ to $x^2+y^2 = n$ is $\sum_{d|n}\chi(d)$, where $\chi$ is the nontrivial Dirichlet character modulo $4$ such that $\chi(d)=1$ if $d\equiv 1\pmod{4}$, $\chi(d)=-1$ if $d\equiv 3\pmod{4}$, and $\chi(2k)=0$.
My question: Can we extend this to the integers of other imaginary quadratic fields? How many integer solutions are there to $x^2+2y^2 = n$ and $x^2+3y^2 = n$? Can this be generalized?
To derive the result for $x^2+y^2=n$, one extends the notion of a Euler product to the Gaussian integers $\mathbf{Z}[i]$. Suppose $a_n$ is the number of solutions, so $a_n$ is the number of ideals $(\alpha)\in\mathbf{Z}[i]$ such that $N(\alpha)=n$. Using well known characterization of irreducibles in $\mathbf{Z}[i]$, we get $$\sum_{n=1}^{\infty}\frac{a_n}{n^s}=\prod_{(\pi)}\frac{1}{1-N(\pi)^{-s}}=\left(\frac{1}{1-2^{-s}}\right)\prod_{p\equiv 1\pmod{4}}\left(\frac{1}{1-p^{-s}}\right)^2\prod_{q\equiv 3\pmod{4}}\left(\frac{1}{1-q^{-2s}}\right). $$ After algebraic manipulation followed by introducing the zeta function, we can write the RHS as $$ \zeta(s)\left(\prod_{p\equiv 1\pmod{4}}\frac{1}{1-p^{-s}}\right)\left(\prod_{q\equiv 3\pmod{4}}\frac{1}{1+q^{-s}}\right)=\zeta(s)\prod_{p}\frac{1}{1-\chi(p)p^{-s}}=\zeta(s)\sum_{n=1}^{\infty}\frac{\chi(n)}{n^s}$$ due to standard results on multiplicativity. Finally, due to Dirichlet convolution, we can match up coefficients to what we originally started with to get the desired $a_n = \sum_{d|n}\chi(d)$.
In the case of $x^2+3y^2=n$, we would work over $\mathbf{Z}[\omega]$. The irreducibles here are precisely $1-\omega$, $q\equiv 2\pmod{3}$ where $q$ is a rational prime, and $\pi$ such that $p = \pi\bar\pi$ where $p\equiv 1\pmod{3}$ is a rational prime. Similarly in $\mathbf{Z}[\sqrt{-2}]$, the conditions for irreducibility depend on the residue class of the norm modulo $8$. Thus, using a Dirichlet character modulo $3$ or modulo $8$, could we also extend the Euler product to these rings - thus allowing to answer such questions?
Finally, can this be generalized to the integers of $\mathbf{Q}(\sqrt{-d})$ in general so as to give a way to count the number of solutions to $x^2+dy^2=n$ in terms of Dirichlet characters? Would this work differently in quadratic extensions with different class numbers? Moreover, there are $\varphi(m)$ characters modulo $m$, so which one would we use?
I hope the jumble of thoughts and questions above are not completely ignorant, naive, and/or trivial (or completely bogus). Any ideas/thoughts/answers are greatly appreciated.
EDIT: Lemma 3.25 in David Cox's Primes of the form $x^2+ny^2$ actually gives a formula for this sort of computation: Let $m$ be a positive odd number relatively prime to $n>1$. Then, the number of ways that $m$ is properly represented by a reduced form of discriminant $-4n$ is $2\displaystyle\prod_{p|n}\left(1+\left(\frac{-n}{p}\right)\right).$ While Cox states that he doesn't deal with number of representations by forms in his book, the proof of this is dealt with in the exercises.
Comment: It appears that an exact answer doesn't exist in all cases: http://media.wix.com/ugd/18f425_e232d911fd80a6f74278b5df2a36ab3b.pdf seems like a pretty solid introduction to the issue.
Comment: @Famke, I see the bounty got awarded. I tend to agree that the excerpt from Cox does not give a final answer to the problem. That would be Siegel's approach, giving a weighted average number of representations of a number by a genus. For positive forms, this is an actual average; for indefinite forms, we switch to counting orbits of solutions under the modular group; I have answered many problems on this site  that display orbits, seems to me I had a recent one with target 44  https://math.stackexchange.com/questions/2424587/when-is-5n214n1-a-perfect-square/2424599#2424599
Comment: I could be mistaken, but after some hasty scratch work it appears that the Dirichlet character modulo $8$ such that $\chi(d) = 1$ if $d\equiv 1,3\pmod{8}$, $\chi(d) = -1$ if $d\equiv 5,7\pmod{8}$, and $\chi(2k)=0$ works for the $\mathbf{Z}[\sqrt{-2}]$ case.
Comment: @Will Jagy ; thank you my dear Will Jagy.
Answer: It's been a while since I've looked at this, and at the time I didn't fully understand everything, so the details are going to be a little fuzzy, but here goes.  We can give an answer in the case where there is one quadratic form per genus, which includes the class number one case.
For some of the general theory needed see Section 4.3 Modular Forms and Algebraic Number Theory, in the lectures on Elliptic Modular Forms and Their Applications by D. Zagier, in the book The 1-2-3 of Modular Forms.
Take a discriminant $ D $ such that there is one quadratic form per genus.  One form per genus is equivalent to the class group being isomorphic to $ (\mathbb{Z}/2\mathbb{Z})^m $ for some $ m $.  The discriminants for which this is the case are given by $ -4n $, where $ n $ is one of Euler's convenient numbers.  In this case we can derive explicit formula for the rep numbers $ r_{Q}(n) $ for each quadratic form $ Q $ of discriminant $ D $ as follows.
Take the quadratic forms $ Q_i $ of discriminant $ D $, and look at their theta series
$$
  \Theta_{Q_i} = \sum r_{Q_i}(n) q^n \, .
$$
For each character $ \chi $ of the class group, we can consider the following sum of theta series
$$
  f_\chi = \frac{1}{w} \sum_{Q_i} \chi(Q_i) \Theta_{Q_i} \, ,
$$
($ w $ the number of roots of unity in the relevant quadratic field).  We also have the associated $L$-series $ L(f_\chi, s) $.
For the trivial character $ \chi_0 $, it's know that
$$
  L(f_{\chi_0}, s) = \zeta(s) L(\varepsilon_D, s) \, ,
$$
where $ \varepsilon_D(n) = (\tfrac{D}{n}) $ is the Kronecker symbol.  For a character of order 2 (as all other characters will be in this case), it's know that the $ L $-series factors as
$$
  L(f_{\chi}, s) = L(\varepsilon_{D_1}, s) L(\varepsilon_{D_2}, s)
$$
for some other discriminants $ D_1 D_2 = D $.
From this we can explicitly find the coefficients of each $ f_{\chi} $.  By solving the resulting system for $ \Theta_{Q_i} $, we get a formula for $ r_{Q_i}(n) $.

This might be more understandable in the context of an example.  For discriminant $ D = -20 $, the two quadratic forms are
$$
  Q_0(x,y) = x^2 + 5y^2 \\
  Q_1(x,y) = 2x^2 + 2xy + 3y^2 \, ,
$$
and there is one form per genus since the class group is exactly $ \mathbb{Z}/2\mathbb{Z} $.  Write $ \Theta_0 $ and $ \Theta_1 $ for the theta series of $ Q_0 $ and $ Q_1 $ respectively.
The trivial character $ \chi_0 $ sends $ Q_0, Q_1 \mapsto 1 $, while the non-trivial character $ \chi_1 $ sends $ Q_0 \mapsto 1 $ and $ Q_1 \mapsto -1 $.  This means we need to consider the following combinations of theta series
$$
  f_{\chi_0} = \tfrac{1}{2} ( \Theta_0 + \Theta_1 ) \\
  f_{\chi_1} = \tfrac{1}{2} ( \Theta_0 - \Theta_1 ) \, .
$$
Then it turns out that
$$
  L(f_{\chi_0},s) = \zeta(s) L(\varepsilon_{-20}, s) \\
  L(f_{\chi_1},s) = L(\varepsilon_{-4}, s) L(\varepsilon_{5}, s)
$$
(At the moment I don't recall the full details.  But one can get the last line by first saying
$$
  L(f_{\chi_1}, s) = \prod_p (1 - a_p p^{-s} + (\tfrac{-20}{p}) p^{-2s})^{-1} \, ,
$$
using the fact that $ f_{\chi_1} $ is a Hecke eigenform on $ S_1(\Gamma_0(20), (\tfrac{-20}{\cdot})) $.  Then work out that
$$
  a_p = \begin{cases}
    1 & \text{if $ p = 5 $} \\
    0 & \text{if $ (\tfrac{-20}{p}) = -1 $} \\
    2 & \text{if $ (\tfrac{-20}{p}) = -1 $ and $ Q_0 $ represents $ p $} \\
    -2 & \text{if $ (\tfrac{-20}{p}) = -1 $ and $ Q_1 $ represents $ p $}
    \end{cases}
$$
Finally check that $ a_p $ agrees with $ (\tfrac{5}{p}) + (\tfrac{-4}{p}) $.)
Multiplying two $ L $-series means taking the convolution of their coefficients.  Doing this and translating back to the $ f_{\chi_i} $ gives
$$
  f_{\chi_0} = \tfrac{1}{2} (\Theta_0 + \Theta_1) = 1 + \sum_{n=1}^\infty \left( \sum_{d \mid n} (\tfrac{-20}{d}) \right) q^n \\
  f_{\chi_0} = \tfrac{1}{2} (\Theta_0 - \Theta_1) = 0 + \sum_{n=1}^\infty \left( \sum_{d \mid n} (\tfrac{-4}{d}) (\tfrac{5}{n/d} ) \right) q^n
$$
Then, solving for $ \Theta_0 $ and $ \Theta_1 $ gives
$$
    \Theta_0 = 1 + \sum_{n=1}^\infty \left( \sum_{d \mid n} (\tfrac{-20}{d})  + (\tfrac{-4}{d}) (\tfrac{5}{n/d} ) \right) q^n \\
    \Theta_0 = 1 + \sum_{n=1}^\infty \left( \sum_{d \mid n} (\tfrac{-20}{d})  - (\tfrac{-4}{d}) (\tfrac{5}{n/d} ) \right) q^n \, .
$$
Finally we can read off the following formulae for the rep numbers of $ Q_0 $ and $ Q_1 $:
$$
  r_{Q_0}(n) = r_{x^2 + 5y^2}(n) = \sum_{d \mid n} (\tfrac{-20}{d})  + (\tfrac{-4}{d}) (\tfrac{5}{n/d} ) \\
  r_{Q_1}(n) = r_{2x^2 + 2xy + 3y^2}(n) = \sum_{d \mid n} (\tfrac{-20}{d})  - (\tfrac{-4}{d}) (\tfrac{5}{n/d} )
$$

This method should generalise to any discrimiant $ D = -4n $, where $ n $ is a convenient (or idoneal) numbers.  For example $ n = 21 $ leads to the following formulae
\begin{align*}
  r_{x^2+21y^2}(n) &= \frac{1}{2} \sum_{d \mid n } (\tfrac{-84}{d}) + (\tfrac{-3}{d})(\tfrac{28}{n/d}) + (\tfrac{-4}{d})(\tfrac{21}{n/d}) + (\tfrac{-7}{d})(\tfrac{12}{n/d}) \\
  r_{3x^2+7y^2}(n) &= \frac{1}{2} \sum_{d \mid n } (\tfrac{-84}{d}) + (\tfrac{-3}{d})(\tfrac{28}{n/d}) - (\tfrac{-4}{d})(\tfrac{21}{n/d}) - (\tfrac{-7}{d})(\tfrac{12}{n/d}) \\
  r_{2x^2+2xy+11y^2}(n) &= \frac{1}{2} \sum_{d \mid n } (\tfrac{-84}{d}) - (\tfrac{-3}{d})(\tfrac{28}{n/d}) - (\tfrac{-4}{d})(\tfrac{21}{n/d}) + (\tfrac{-7}{d})(\tfrac{12}{n/d}) \\
  r_{5x^2+4xy+5y^2}(n) &= \frac{1}{2} \sum_{d \mid n } (\tfrac{-84}{d}) - (\tfrac{-3}{d})(\tfrac{28}{n/d}) + (\tfrac{-4}{d})(\tfrac{21}{n/d}) - (\tfrac{-7}{d})(\tfrac{12}{n/d})
 \end{align*}
So there will be 65 (or possibly 66) different discriminants where this works, starting $ D = -4n $ for $ n = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 16, 18, 21, 22, \ldots, 1848 $.  Moreover we get one such formula for each of the equivalence classes of quadratic forms for the these discriminants; there are a total of 331 such quadratic forms (add up the class numbers for these discriminants), and so 331 such formulae (not counting those which would from the possible 66th value of $ n $, if it exists).
Comment: @accursed This method should work whenever the discriminant is $ -4n $, for $ n $ one of Euler's convenient (idoneal) numbers.   I've added an example for the case $ n = 21 $.
Comment: I'm studying Artin and Hecke L-functions, do you have an intuitive explanation of what is the genus of a binary quadratic form $Q$ in this framework ? (I start from $\sum_{n \in \mathbb{Z}^2} e^{2i \pi z Q(n,n)} = \sum_{a \in \Lambda} e^{2i \pi N(a)}$  where $\Lambda = u\mathbb{Z}+v \mathbb{Z}$ is a lattice in some $\mathbb{Q}(\sqrt{d})$)
Comment: @accursed For binary quadratic forms (2 variables) of a fixed discrimination $D$, the number of forms per genus is constant, so I cannot give your an example in this case.  For higher arity (say 3 variables), I think one can find such examples though I would need to consult the literature first.
Comment: @accursed Indeed, the reference is Corollary 3.14 in _Primes of the form $ x^2 + ny^2 $_, 2013, 2nd Ed, David A Cox.  It says: Let $ D < 0 $ be a discriminant.  Then i) All genera of forms of discriminant $ D $ consist of the same number of classes, and ii) The number of genera of forms of discriminant $ D $ is a power of 2.
Comment: Could you generalize this method to another quadratic form rather than $x^2+5y^2, 2x^2+2xy+3y^2$. If the answer is positive; **do you belive** the number of such quadratic forms are more than $50$?
Comment: @Steven Charlton ; Could you give me an example of a quadratic form $f$ of discriminant $-4n$ such that: it's genus consists of a single class; but there exists another form $g$ of discriminant $-4n$, such that it's genus consists more than one class. The only thing I can observe is that I should search out of Euler's convenient numbers!
Comment: @Steven Charlton ;

If I am not mistaken you claim that:

**Theorem**: If we restrict ourselves to the case of binary quadratic forms;
then for every fixed discriminant $D$; there is a constant $c$;
such that each genus consists exactly $c$ classes?

Could you give me a **reference** for this statement?
Comment: @Steven Charlton ; My dear Steven Charlton, thank you for your patience.
Answer: We can extend the argument to any imaginary quadratic field with class number one, and use the Jacobi triple product identity to provide Lambert series for the representation function:
$$r(n)=|\{(x,y)\in\mathbb{Z}\times\mathbb{Z}:x^2+dy^2=n\}|.$$
For such cases, it is also true that the representation function is an hypomultiplicative function, i.e.
$$ r(n) = K\cdot f(n) $$
where $f$ is a multiplicative function and $K$ is the number of units in the ring $\mathbb{Z}[\sqrt{-d}]$.
However, there are just a finite number of imaginary quadratic field with class number one.
For the whole topic, the book of Cox "Primes of the form $n^2+ny^2$" is an excellent reference.
Answer: Here are two pages from Leonard Eugene Dickson, Introduction to the Theory of Numbers. You may need to adjust to get your results with some inequalities on the variables. later he does a few forms such as $x^2 + 5 y^2$ and $2 x^2 + 2 x y + 3 y^2$ with one form per genus.


O que é uma migrate?

Question: Sou um iniciante no mundo django e uma das primeiras coisas que me deparo nos tutorias é o termo migrate eu gostaria de saber a que se refere isso, como usar e para que serve.
Answer: A "migrate" (migração) serve para vocẽ gerenciar a estrutura das tabelas do banco de dados da sua aplicação, ou seja, através dela é possível incluir, alterar e excluir tabelas ou campos de determinada tabela, de uma forma organizada, deixando todas essas alterações documentadas e evitando que você a faça manualmente.
Para fazer uma migração é preciso gerar um arquivo migrate, e dentro dele, colocamos uma ou mais alterações que precisam ser feitas no nosso banco de dados, e quando vocẽ rodar essa migração, essas alterações serão feitas automaticamente.
As migrações são enumeradas de forma crescente, e é possível voltar ao número desejado, ou seja, você pode desfazê-la a qualquer momento, e voltar o seu banco de dados ao estado anterior de qualquer migração.
Documentação Oficial sobre Migrações no Django

O que é uma migrate?


Linker error when function definition is in cpp file

Question: My solution has three projects: GoogleTest (for using Google Test), Vi (for the bulk of the logic) and ViTests (for the unit tests using Vi). The ViTests project references the Vi project and the Google Test project.
Vi has the following code in v1.h
#pragma once

namespace Vi
{
    class Vi1
    {
    public:
        int SomeInt();
    };
}

And the matching v1.cpp
#include "vi1.h"

namespace Vi
{
    int Vi1::SomeInt()
    {
        return 123;
    }
}

The test function in ViTests follows
TEST(Vi1Foo, SomeIntIsSame)
{
    Vi1 v = Vi1{};
    EXPECT_EQ(123, v.SomeInt());
}

The linker error says there's an unresolved symbol SomeInt. However, I can make the linker error go away by inlining the function like so:
namespace Vi
{
    class Vi1
    {
    public:
        int SomeInt() { return 123; }
    };
}

Why is the unit test project not finding the SomeInt function definition when it's placed in a separate cpp file?
Thanks.
Extra details incase useful: I'm using Visual Studio 2015.
The error message:
Error   LNK2019 unresolved external symbol "public: int __thiscall Vi::Vi1::SomeInt(void)" (?SomeInt@Vi1@Vi@@QAEHXZ) referenced in function "private: virtual void __thiscall ViTests::Vi1Foo_SomeIntIsSame_Test::TestBody(void)" (?TestBody@Vi1Foo_SomeIntIsSame_Test@ViTests@@EAEXXZ) Vi_Tests    C:\Users\MyName\Vi\Vi_Tests\Vi_Tests.obj    1

Project types:
Vi is Win32 Application, ViTests is Win32 Console Application, GoogleTest is a static library.
Comment: I'm not sure what it means for a C++ Win32 Console project (like `ViTests`) to reference a C++ Win32 Application project (like `Vi`).  `ViTests` needs to link in `V1.obj` - either directly as an object file, or indirectly via a static library that has been created with `V1.obj` being a member of.  I'm not sure if referencing the Win32 Application project will do either of those things.  I think you'll need to add `V1.obj` (and possibly other object files) as a input file to the linker in the `ViTests` project.
Comment: Are you linking towards the file with the function definition?
Comment: I don't know what you mean. I should include the cpp file name in the list of "additional dependencies"?
Comment: How can I link toward the file with the function definition?
Comment: Yes, you probably do, but I never used VS before
Comment: Can you copy/paste the actual error message?  Also, is the inline version of `Vi1::SomeInt()` that makes things work inside `namespace Vi`?
Comment: I pasted the error message. Yes, the inline version is inside the Vi namespace. I'll update the code in my post to reflect this.
Comment: You say that "Vi is a Win32 application" and "ViTests is a Win32 console application".  Since the problem occurs while linking ViTests, the problem is probably that `V1.obj` needs to be linked into the `ViTests` application.
Comment: I tried this and Visual Studio gives an error saying that I cannot add this reference as this would create a circular dependency (ViTests already references GoogleTest and Vi).
Answer: I was working under a silly false assumption. I was assuming that VS would just pickup the cpp files because I was referencing the project containing them and including the correct header files but this isn't the case.
nabijaczleweli said I should link "towards the file with the function definition". After a bit of exploring online I found out how to do this. I found this post outlining a solution. The cpp files themselves must be added to the test project. This was done by right-clicking on ViTests, selecting "Add Existing Files" and selecting vi1.cpp.
This worked but I was quite unhappy with this solution because I had to add these files as I needed them. I found I could get around this changing the type of project Vi was to a static library. This is described here. Michael Burr's comment describes a way of linking to the object files that would also work.
I wouldn't have figured this out so quickly without the help of the posters in this thread. Thank you very much people.
Answer: You didn't specify what is the type of the projects. I'm guessing they are DLLs, and as such non-inlined functions or classes you wish to use outside them need to exported:  either declared as __declspec(dllexport)  at the source or listed at a DEF file.
If you go with __declspec(dllexport), remember to __declspec(dllimport) the functions at the consuming project. This is typically achieved with a macro used as a qualifier at the .h file, which resolved differently on different projects.
Comment: But wouldn't it have to know which class the method belongs to? I tried removing it anyway but the error persisted. But thanks for the idea :)
Comment: My bad - i missed the '1' in Vi1.    Deleting answer soon
Comment: I hadn't considered project types. I'll update my answer to include this information because I think it might be promising.


How to approximate bowed sound on guitar

Question: Not sure this is the right SE site, so please point out if there's a better one.  It's also not quite the same as this question.
My son the violist has found a string quartet piece that he would like us to play as a family despite the fact that we have an unusual combination of instruments: my wife also plays viola, I'm a guitarist and our younger son is a keyboardist.
The current plan is for my wife to play the first violin part on her viola while elder son plays the viola part.  Younger son will play 2nd violin on the keyboard while I play the cello part on acoustic guitar.  (Another alternative would be for me to play the cello part on trombone, but it includes a few chords. Hard to do those..)
So, my question: the piece alternates between arco and pizzicato, and I'm wondering what the best way is to achieve a similar distinction on the acoustic or classical guitar.  I don't want to create a bowed-string sound effect; I'm just wondering what the best way is to smooth out the transitions for the arco parts and exaggerate them on the pizzicato parts.
Any advice appreciated.
Answer: The usual way to smooth out note changes on guitar is to play legato. This means using techniques such as sliding from one note to another (on the same string, obviously), hammering on and pulling off notes, or bending strings - not too effective on nylon strung guitars.
For the pizz. parts, you could try palm muting, which works, as all I've suggested, better on electric guitars, but can be effective on steel strung acoustics.
As the good Dr. ordered, a swell (volume) pedal could also be used, if an electric guitar was forthcoming.
Comment: I have an electric, but not sure how well it would fit in with a couple violas. :)  The palm-muting for pizzicato is a great idea.  Thanks!
Answer: I play banjo which has almost no sustain and it's hard to get a good legato sound, so I'll often just adjust the arrangement to play multiple shorter notes, like 8 eighth notes in place of a whole note (which sounds on banjo like an eighth note followed by a long rest). If you do it tastefully it will carry its part and support the pulse or rhythm of the whole piece.
Answer: One option is of course to actually use a bow - this can be used to great effect.
Alternatively, the difference between a pick (or fingernails) and using the soft pads of your fingers to pick with can be accentuated by moving your right hand from near the bridge using a pick (sharp attack, more high harmonics, staccato sounds) towards the 12th fret when using your fingertips (gentle attack, much mellower, round sound.)
If you can use an electric guitar, bowing can be accurately mimicked by using the volume knob with your little finger, and ramping up from zero volume immediately after picking each note.
Comment: Would an Ebow work with an acoustic? And how does one play one string at a time with a violin bow?
Comment: @Tim An Ebow will work on a steel-string acoustic but not a nylon. Unless you have an arched bridge and narrow waist, the main way to play a single string with a bow is to mute all the others. It doesn't work very well in my experience. I've upvoted this answer even though in the asker's case I think an Ebow and/or your suggestion of legato techniques is a better way to go.
Comment: Tim - you just work on damping the others. It works **reasonably** well.
Comment: @Tim: The other possibility is that you restrict bowing to only using the first and last strings.  It's admittedly limiting, but it can work.
Answer: Without seeing the piece involved...
As an alternative to the above answers, I would suggest a drop-tuning with a glass or metal slide. It'll require a bit more work in terms of knowing what notes to hit when playing pizzicato, but doable (depending on the chords involved, of course).
Another alternative is to restring the guitar with flat-wound strings, which would reduce finger noise when playing legato.
Comment: Ah, it's a terminology difference. What you call *drop tuning* I call *open tuning*. When I read *drop tuning* I specifically think of a tuning where one or more strings is tuned down. So *drop D* or *dropped D* both refer to the low E string being tuned down to D, which is not an open tuning. Note that when playing with slide, if you only strum the D, G, and B strings (and/or mute the others) you get a major chord in second inversion, so you can play chords with slide in standard tuning.
Comment: I like the idea of using a slide, but why drop-tuning? A slide can be used just fine in standard tuning or an open tuning if a lot of chord work is required.
Comment: A slide gets tricky (for me, at least - I'm a Bass player!), because there are no nice sounding open chords in standard tuning. Using a drop-tuning means that by putting the slide across all strings, you're playing a chord, and it's harder to hit a wrong note.
Comment: I'm already using a drop-C tuning in order to hit the low notes in the cello part (the piece is King's Court by Susan Day).  No trouble hitting all the right notes. Never played with a slide before; that's an interesting thought.
Comment: My mistake entirely! Told you I was a Bass player.... :)


are there any design patterns to deal with the two models and same database table?

Question: i'm blocked at this level, i have a model as shown in the picture, i want to use one single database table for both validated and notValidated documents, since the same document can have an association with both of the models.class diagram
neither STI nor polymorphic associations are solution to this issue.
so the question is how can i manage in rails, to create two models but one database table for it, is there a design pattern that goes this way ?.
For example :
<code>document { id: 1, added_by: user1}
document_not_validated { duration_estimated: 12}
document_validated { duration_after_validation: 10, added_by: super_user}.
</code>
So all these data could be in one line in the DB table, but i need different models (setting the table name is not the solution i look for neither)
thanks
Answer: Why not just create a column 'validated' with boolean true/false value?
Comment: The example i gave is quiet simple, to make it easier to understand what  need.
The problem is to get an object of each type ( validated and not validated document) without getting each time all the attributes, even if it is validated i will still need the data of the non_vlidated_document, adding a column is not what i look for.
thanks


jquery adding form elements with square brackets

Question: I'm trying to dynamically add hidden input fields to a form with square brackets in their id/name:
<input type="hidden" name="myField[]" id="myField[]" value="someValue" />

The adding works fine (at least firebug shows the correctly added fields). But when I try to access the post-array in the receiving PHP-script, the fieldnames end up being myField%5B%5D and the array is lost.
When such fields are added manually to the HTML-code, I end up having a nice array in my postvars.
How do I fix this?
[Edit]
This is how I add the fields:
$('#theForm').append(
                $('<input/>')
                    .attr('type', 'hidden')
                    .attr('name', 'myField[]')
                    .attr('id', 'myField[]')
                    .val(value)
            );

I also tried using escape characters like \[\] - and also \\[\\] - to no avail
Comment: Show us how you add them ?
Comment: Seems to work just fine for me, but for some reason the POST data is'nt urldecoded when you receive it ?
Comment: When I do a print_r($_POST) in the receiving script, the result is Array ( [myField%5B%5D] => someValue )
Expected would be Array ( [myField][] => someValue ) - As I said - the adding works fine - but the serialisation (serialize()) seems to fail
Answer: You might want to read this and try this:
$('#theForm').serialize().replace('%5B%5D', '[]')

or this
$.param(obj, true);
$.post(url,serializedObj,function(){});

The true in the $.param indicates the traditional method of serializing an object should be used. The traditional method does not use square brackets when it encounters the same parameter name.
Answer: Try this
$('#theForm').append('<input type="hidden" name="myField[]" id="myField[]" value="someValue" />');


Book recommendation on plane Euclidean geometry

Question: I consider myself relatively good at math, though I don't know it at a high level (yet). One of my problems is that I'm not very comfortable with geometry, unlike algebra, or to restate, I'm much more comfortable with algebra than geometry. I think that's mainly because my geometry education was sparse through the years, lacking in consistency etc. So I'd like to revise (and learn more) all at once, catching the basic axioms, understanding why such is such, etc. Essentially, a moderately rigorous textbook in plain Euclidean geometry (nothing fancy). Please don't say "The Elements" - I have browsed it at the bookstore, it is quite good, but not really what I'm looking for right now.
Comment: How about [baby Hartshorne](http://books.google.com/books?id=EJCSL9S6la0C&lpg=PP1&dq=hartshorne%20geometry%20euclid%20and%20beyond&pg=PP1#v=onepage&q&f=false)?
Comment: @Tim: If people say *Hartshorne*, they usually mean his [Algebraic Geometry](http://books.google.com/books?id=3rtX9t-nnvwC&lpg=PP1&dq=algebraic%20geometry%20hartshorne&pg=PP1#v=onepage&q&f=false) classic, so I use baby Hartshorne to make it clear that I refer to his other, much more elementary, geometry book.
Comment: @Pedro: Do you mean "plane" Euclidean geometry, or "plain" Euclidean geometry?
Comment: I asked a similar question, see http://math.stackexchange.com/questions/13735/books-on-classical-geometry
Comment: @Theo: Is there advanced Hartshorne?
Comment: Thanks sponsorewalk. I bought the book by Aboughantous and I read it. It is an excellent textbook. I am now trying to get it into my classroom. I will try to look at the other books you suggested later. I wonder do the respondent read the question of the starter of the thread? Geometry history, noneucledan geometry books are not responsive to the original question.
Answer: For the bare bones beginner who either doesn't know or has completely forgotten all of his or her high school geometry,I cannot recommend more highly:
Kiselev's Geometry, 2 volumes,translated by Alexander Givental
I'd also highly recommend Givental's wonderful introduction in the preface of the first volume on the history of this classic book and what motivated him to bring the Russian classic to an English-speaking audience.
After that,there are basically 3 books you can't go wrong with:
Elementary Geometry From An Advanced Viewpoint, 2nd edition, by Edwin Moise
Euclidean And Non-Euclidean Geometries, 3rd or 4th edition (either will do nicely) by Marvin Greenberg
A Survey of Geometry by Howard Eves, 2nd edition(2 volumes)
Moise is the classic text that develops Euclidean geometry using the metric postulates of G.D. Birkoff. There are several other books that try and do this,but none do as good a job with it as Moise. Greenberg is a remarkable historical tour through the various geometries of the plane as axiomatic systems,from geometry pre-Euclid through 19th century developments of non-Euclidean geometries through a careful analysis of the Hilbert axioms.
It also has many pictures and many exercises of varying difficulty incorporated into the body of the text,so you really need to read it with pen in hand. Eves is an older,2 volume work attempting to do for elementary geometry what Birkoff/MacLane did for abstract algebra. Some of it is awkward and dated,but it has a lot of cool stuff in it you can't find anywhere else.
Those 3 are how you get started to me. And if you want to go on from there, it's time to read the awesome classics of Coexter. They are THE detailed textbooks on plane geometry-but they are best read in my opinion after mastering the basics.
Good luck!
Comment: +1 for Moise!...
Comment: Greenberg's book has excellent tour of the historical background. But strangely it contains very few proofs or examples to guide the reader into the subject. So beginners must rely on other books to fill in the gap while learning the subject.
Comment: +1 for Kiselev excellent book
Answer: I'm currently working through Robin Hartshorne's Geometry: Euclid and Beyond. It starts out by touching on Euclid's Elements, and then explores Hilbert's axiomatization of Euclidean geometry to make it hold up to modern standards.
There are a good number of challenging exercises in it, and it delves into non-Euclidean geometry as well, so it may be worth checking out if you're interested in brushing up on modern Euclidean geometry and other classical geometry.
Comment: Ha! This time I beat you by some seconds :) The last sentence, while certainly correct sounds a bit funny (modern ... other classical ...) +1 of course.
Comment: @Theo, it's uncanny how in sync our posts are sometimes! Maybe I'll win by some seconds the next time around.
Comment: Right... Well, this happens sometimes: I had this same experience with Matt Emerton some time ago, when over half an hour we answered the same three questions and posted within a few seconds of each other.
Answer: You might want to look at Coxeter's Introduction to Geometry.
Comment: and geometry revisited
Answer: If you need something short and rigorous, you may use my lecture notes at GitHub or arXiv.
(Sorry for self-advertisement.)
Comment: Very Nice. You will need to give all proceeds to charity, of course. Have you seen fedja at  http://mathoverflow.net/questions/127889/is-rigour-just-a-ritual-that-most-mathematicians-wish-to-get-rid-of-if-they-could/129799#129799
Answer: If the thought of slogging through "The Elements" discourages you, I suggest you look at Benno Artmann's Euclid: The Creation of Mathematics.  His book is as much historical as mathematical, but it is very pleasant reading.
From the Preface:

The present book takes a clear position: The Elements are read, interpreted, and commented upon from the point of view of modern mathematics.

and that is exactly what he does.
Answer: The following three books are, in my meagre estimation, the most rigorous elementary introductions to elementary geometry:
1) A High School First Course in Euclidean Plane Geometry - Aboughantous;
2) Euclidean Geometry: A First Course - Solomonovich;
3) Lang/Murrow - Geometry.
Comment: I'd like to add the comment that the book "Euclidean & Non-Euclidean Geometries" by M.J. Greenberg could be used in conjunction with the video course "Math 421- Higher Geometry" on the [uccs website](http://www.uccs.edu/~math/vidarchive.html) & it's associated [course page](http://www.uccs.edu/~jdorring/Math421/Math421.html), though I don't know how well this book compares to the ones I mentioned above.
Comment: +1 for Solomonovich, probably the single most accessible, complete and rigorous text on Euclidean Geometry that currently exists. It's in many ways a more detailed and expanded version of the first volume of Kiselev's classic text. Students that work through both these texts will master classical Euclidean geometry and be more then ready to move on to more sophisticated treatments like Greenberg or Harsthorne.
Answer: "Continuous Symmetry" by William Barker and Roger Howe.
A realtively new book from professors at Yale. This work was partially inspired by the book of Moise.
Comment: You know, if you're an educator, the fact these professors teach at Yale really shouldn't matter that much-only the quality of the text and it's accessibility to the target audience. Just saying.
Answer: "A Beautiful Journey Through Olympiad Geometry" is a book that presents all the theorems/methods that you need to know in order to solve Olympiad geometry problems. It progresses step-by step, starting from scratch, so you will definitely be able to follow it without any additional materials. It contains solved problems using these theorems, but also related problems that are left unsolved as a practice for the reader. Check out the book preview and download the book (pay what you want) here.
Answer: Check out this one, called "Plain Plane Geometry" by Amol Sasane : http://www.worldscientific.com/worldscibooks/10.1142/9907


Perfect recall and spurious states in hopfield networks

Question: In Hopfield networks, one can apparently load perfect recall into the network (by having enough neurons compared to patterns). (Source)
However, at the same time, it appears that spurious states (i.e. local minima of the energy function) will always exist. For example the opposite of a stored pattern is also a stable state.
These two statements seem incompatible to me, how can we have perfect recall despite the existence of unintended local minima?
Answer: By coincidence, I have been wondering the same thing and after some reading, I believe to have found the answer.
In "The capacity of the Hopfield associative memory." by McEliece et al. they describe the perfect recall of the trained points without error to be the ability of the network to recall all of the trained points. This means that the trained points have to be attractors of the network. This does not mean that these should be the only equilibrium points of the Hopfield network. Spurious states can not be avoided, but they do not prevent the network to recall the trained points.
Comment: Thanks Tom, but, unless I misunderstand you, this doesn't completely demystify to me *why* spurious states don't prevent the network to recall the trained points. I have been thinking about it a bit more as well, and wonder whether there is an implicit assumption about the amount of noise that is expected, eg, the variance of the noise won't exceed X such that we will always evolve to the trained points (?)
Comment: Inputs to Hopfield networks are supposed to converge towards the equilibrium point closest to the input. According to the same paper I cited in my answer, to have perfect recall properties, the input has to converge to the nearest stored point. When the capacity of the network has been reached, this convergence becomes imperfect and the result may not be one of the memories. In other words, even if your input pattern is closer to a trained memory, the network may converge to a spurious pattern.
I believe this is what is meant by perfect recall.


Solving the differential equation $y' - \frac{1}{x} y = x^2\sqrt{y} $

Question: Which technique should I use for solving the follwoing DE?
$$
y' - \frac{1}{x} y = x^2\sqrt{y}
$$
 I have tried some algebraic manipulations but I could not recognize any pattern.
Comment: We tend to avoid titles consist of only latex code due to some browser rendering difficulties.
Answer: HINT

Divide by $\sqrt{y}$.
Think of the chain rule and make a substitution...
Answer: First, $z=y/x$ yields $z'=x\sqrt{y}=x^{3/2}\sqrt{z}$.
Then $u=\sqrt{z}$ yields $u'=\frac12x^{3/2}$ hence $u=\frac15x^{5/2}+c$. Finally, $y=xz=xu^2$ hence
$$
y=x\left(\frac15x^{5/2}+c\right)^2.
$$


A regression model for ratio of two Binomial success probabilities

Question: There are two series of observations of two Binomial trials. Observation $i$ of series 1 includes $n_{1i}$, the number of Bernoulli draws and $\overline{p}_{1i}$, the ratio between number of success and $n_{1i}$, i.e. the estimated success probability. Same applies to series 2. I believe that ${p}_{1i}$ can take on different values across $i$, but ${p}_{1i}$ and ${p}_{2i}$ are correlated, and have the following assumption:
$$p_{1i} = \alpha p_{2i},$$
where $\alpha$ applies across all $i$. I want to estimate $\alpha$. However, I do not know how to formulate a model to do that.
In particular, I cannot figure out:

Suppose I have enough Bernoulli draws for each observation, then my $\overline{p}_{1i}$ is asymptotically normally distributed around ${p}_{1i}$. But if I believe ${p}_{1i}$ can take on different values across $i$, is the model above indeed estimable?
I believe that $n_{1i}$ should have an impact on the weights of observations in estimating $\alpha$. Don't know exactly how though.
If I simplify the problem, and say there is only one observation in both series, what would be the estimator for $\alpha$, its distribution and standard error?
Comment: Use a binomial regression (a glm) with a log link function. An example is here: https://stats.stackexchange.com/questions/315703/confidence-interval-on-the-percentage-difference-of-two-binomial-distributions/401884#401884  or   https://stats.stackexchange.com/questions/289008/confidence-interval-on-binomial-effect-size/406746#406746   or   https://stats.stackexchange.com/questions/58594/manipulating-binomial-distribution/453747#453747
Comment: You have already formulated a model.  One way to fit it would be to use Maximum Likelihood.
Comment: @whuber Thanks! I am trying to but cannot seem to get the likelihood function. Does an MLE approach require that I assume at least one of $p_{1i}$ and $p_{2i}$ is known?
Comment: @kjetilbhalvorsen thanks! These have been very useful reference. Can I ask what is difference in the underlying assumption between that approach and the one here: https://stats.stackexchange.com/questions/3112/calculation-of-relative-risk-confidence-interval, i.e. the `riskratio()` in epitools?
Comment: Try all and see if it matters for your data---riskratio Wald method is most similar to my refs above, but seems to use Wald approximation, it is usually better to use profiling
Answer: You describe a dataset that could be represented as a sequence of tuples $(n_{1i}, n_{2i}, k_{1i}, k_{2i})$ where $k_{ji}$ is an observation of a random variable $K_{ji}$ that follows a Binomial$(n_{ji}, p_{ji})$ distribution.  Your model supposes that all the $K_{ji}$ are independent, the $n_{ji}$ are known, and for each $i,$ $p_{1i}=\alpha\,p_{2i}.$  Thus the unknown parameters are $\alpha,$ whose value you wish to estimate, along with the "nuisance parameters" $p_{2i}.$
Simplify the notation by writing $p_{2i} = p_i.$  In terms of these parameters, the independence assumption implies the likelihood of the data is
$$\mathcal{L} = \prod_i \binom{n_{1i}}{k_{1i}}\left(\alpha p_i\right)^{k_{1i}}\left(1-\alpha p_i\right)^{n_{1i}-k_{1i}}\ \prod_i \binom{n_{2i}}{k_{2i}}\left(p_i\right)^{k_{2i}}\left(1-p_i\right)^{n_{2i}-k_{2i}}.$$
Ignoring the factors that depend only on the data, the part of $\mathcal L$ that depends on the parameters is
$$\mathcal{L}\,\propto\, \prod_i \left(\alpha p_i\right)^{k_{1i}}\left(1-\alpha p_i\right)^{n_{1i}-k_{1i}}\left(p_i\right)^{k_{2i}}\left(1-p_i\right)^{n_{2i}-k_{2i}}.$$
Maximize the likelihood in two stages.  First, given some arbitrary value of $\alpha,$ find the $p_i$ that minimize $\mathcal L.$  To do so, let $p=p_i$ be any one of these parameters.  The factor of $\mathcal L$ that varies with $p$ is merely
$$\lambda_i(p;\alpha) = \left(\alpha p\right)^{k_{1i}}\left(1-\alpha p\right)^{n_{1i}-k_{1i}}\left(p\right)^{k_{2i}}\left(1-p\right)^{n_{2i}-k_{2i}}.$$
The usual differential Calculus procedure applies: the critical points of $\lambda_i$ (as a function of $p$) are the endpoints $\{0, \min(1,1/\alpha)\}$ of its domain together with the zeros of its derivative.  Drop the "$i$" subscripts for the moment.  A straightforward calculation shows those zeros satisfy the quadratic equation
$$\alpha n\, p^2 - (\alpha(n_1+k_2)\,+\,n_2+k_1)\,p + k = 0$$
where $n = n_1+n_2$ and $k=k_1+k_2.$  This gives up to four candidate solutions for $p,$ of which the best (the one that makes $\mathcal L$ largest) can be selected by evaluating $\mathcal L$ at each.  Doing this for all $i$ maximizes $\mathcal L$ as a function of $\alpha.$  The maximum likelihood is obtained by maximizing this function of $\alpha$ and the value of $\alpha$ that maximizes it is the maximum likelihood estimate $\hat\alpha$.  Other values of $\alpha$ for which the deviance
$$2\left(\mathcal{L}(\alpha) - \mathcal{L}(\hat\alpha)\right)$$
is less than the $1 - q^\text{th}$ percentile of the chi-squared distribution with one degree of freedom form a $1-q$ confidence interval for $\alpha.$

Here are graphs of $\mathcal{L}(\alpha)$ for 18 datasets created with $\alpha=1/2.$  The data are indicated in the titles with two lines of the form "$k_{ji}/n_{ji}$" (the top line is for $j=1$).  The true value of $\alpha$ is indicated with vertical red dashed lines while the value of $\hat \alpha$ is indicated with a vertical solid black line.  The $1-1/18 = 94\%$ confidence intervals are formed by all $\alpha$ for which the graph falls below the horizontal solid red lines.

There appears to be little systematic bias in the estimates.
We would expect $\alpha$ in one of these datasets to fall outside the confidence interval.  This occurs in row 2, column 4 and is close to occurring in row 1, column 1 and row 3, columns 5 and 6.  However, repetitions of this procedure (with different starting random number seeds) indicate it is working as planned: only about one in every 18 confidence intervals fails to cover the true value of $\alpha.$
This is a fairly difficult test: the sample sizes are small and in several cases there were no "successes" at all in one of the data groups.  Further simulations indicate this procedure works well even with tiny datasets (such as two groups of data averaging three observations per group).

This is the R code used to produce the figure.
#
# Quadratic solver.
# Returns real roots of Ax^2 + Bx + C as a 2 X n array.
#
qsolve <- function(A,B,C) {
  D <- B^2 - 4*A*C
  q <- suppressWarnings(-B + ifelse(B>0, -1, 1) * sqrt(D))
  i <- apply(rbind(A,B,C), 2, zapsmall)[1,]==0
  rbind(ifelse(i, -C/B, 2*C / q), ifelse(i, NaN, q / (2*A)))
}
#
# Log likelihood.
#
L <- function(p, alpha, n1, n2, k1, k2) {
  if (is.na(p) || p < 0 || p > 1 || alpha*p > 1) return(Inf)
  log0 <- function(n, x) suppressWarnings(ifelse(n==0, 0, n * log(x))) # log(x^n)
  sum(log0(k1, alpha * p) + log0(n1 - k1, 1 - alpha * p) +
      log0(k2, p) + log0(n2 - k2, 1 - p))
}
#
# Negative profile log likelihood.
#
lambda <- Vectorize(function(a, n1, n2, k1, k2) {
  alpha <- exp(a)                # Since alpha > 0, use log(alpha) = a as parameter
  p.hat <- qsolve(alpha * (n1 + n2), -(alpha * (n1 + k2) + n2 + k1), k1 + k2)
  p.hat <- t(rbind(p.hat, 0, 1)) # Include endpoints of the interval
  p.hat <- pmax(0, pmin(min(1, 1/alpha), p.hat)) # Restrict to valid values
  Q <- mapply(L, c(p.hat), alpha, n1, n2, k1, k2)# Compute log likelihoods
  Q <- apply(matrix(Q, length(n1)), 1, max)      # Find the maxima
  Q <- ifelse(k1+k2==0 | k1+k2==n1+n2, 0, Q)     # Take care of extreme cases
  -sum(Q)                                        # Negative log likelihood
}, "a")
#
# Simulation.
#
set.seed(17)
alpha.true <- 1/2
nrow <- 3
ncol <- 6
par(mfrow=c(nrow, ncol))
mai <- par("mai")
par(mai=c(0.5,0.3,0.3,0.1))
for (i in 1:(nrow*ncol)) {
  #
  # Data.
  #
  repeat {
    n1 <- 1 + rpois(3, 7)          # 3 = number of groups; 7+1 = mean size
    n2 <- 1 + rpois(length(n1), 7) # 7+1 = mean size of second groups

    p <- pmin(runif(length(n1)), 1/alpha.true)
    k1 <- rbinom(length(n1), n1, pmin(1, alpha.true * p))
    k2 <- rbinom(length(n2), n2, p)
    if (sum(k1)+sum(k2)==0 || sum(k1)+sum(k2)==sum(n1)+sum(n2)) {
      warning("Nothing can be done with MLE.")
    } else {
      break
    }
  }
  #
  # EDA.
  #
  title1 <- paste(k1,n1,sep="/",collapse=" ")
  title2 <- paste(k2,n2,sep="/",collapse=" ")
  #-- Starting estimate for alpha
  alpha.hat <- log(sum(k1)*sum(n2) / (sum(k2)*sum(n1)))
  if (is.infinite(alpha.hat)) alpha.hat <- log(1/(sum(n1) + sum(n2)))
  #
  # MLE.
  #
  fit <- optimize(lambda, lower=alpha.hat-1, upper=alpha.hat+1,
                          n1=n1, n2=n2, k1=k1, k2=k2)
  #
  # Plotting.
  #
  logalpha.hat <- fit$minimum
  a1 <- min(logalpha.hat, log(alpha.true)-1)
  a2 <- max(logalpha.hat, log(alpha.true)+1)
  curve(lambda(x, n1, n2, k1, k2), a1, a2,
        col="Gray", lwd=2,
        ylab="", xlab="")
  mtext(text=paste0(title1, "\n", title2), side=3, line=0.2,
        cex=min(1.2, 12/ncol/length(n1)))
  mtext(text=expression(log(alpha)), side=1, line=2.3, cex=0.75)

  abline(v = logalpha.hat, lwd=2)
  abline(v = log(alpha.true), lwd=2, lty=3, col="Red")

  Q <- lambda(logalpha.hat, n1, n2, k1, k2)
  Q.upper <- Q + qchisq(1 - 1/(nrow*ncol), 1)/2
  abline(h = Q.upper, lwd=2, col="Red")
}
par(mai=mai, mfrow=c(1,1))


Is there a way to not require a favicon?

Question: Is there a way, to take out the HTML link and provide a favicon or alternatively, not let it be requested - perhaps using .htaccess?
<code><link rel=icon href=icon>
</code>
For instance, when a user opens a [.pdf] or otherwise, there is no icon - displaying 'nothing' or at least it is transparent. The purpose, is to minimise the number of HTTP requests. You see, I do not want to have [the HTML link] at all - so a data URI is not necessarily an option. In other words, I wish to remove this HTML tag - displaying nothing like a [.pdf] file, in the browser.
Answer: If you don't have a tag specifying the url of a favicon, most browsers will just send a blind request to www.yourdomain.com/favicon.ico and hope for the best (thanks to w3d for pointing this out). This isn't something you can prevent them from doing.
Although, from what I know, favicons are cached in the clients browser, so they won't even be sending requests for it on every page-load.
Comment: This is not correct. If you don't have the HTML `link` tag, most browsers will blindly send a request for `example.com/favicon.ico` anyway - there is no way you can prevent this request.
Comment: This is not what I was asking; this option displays a 'broken' page icon in the space of the browser - I want it to be transparent: 'like a [.pdf] file'.
Comment: What do you mean by "like a [.pdf] file"? You said you wanted to minimize the amount of HTTP requests. Your question was how to "not require a favicon". The answer to that is to simply not supply a favicon and there won't be any. If your browser shows a "broken" icon, then that is because of the browser, that won't generate any HTTP request. If you're asking how to create a transparent favicon, that is a completely different question that doesn't really involve programming.