text:
Ada Programming

Welcome to the Ada Programming tutorial at Wikibooks. This is the first Ada tutorial covering the Ada 2005, 2012 and 2022 standards. If you are a beginner you will learn the latest standard — if you are a seasoned Ada user you can see what's new.

Current Development Stage for Ada Programming is "". At this date, there are more than 600 pages in this book, which makes Ada Programming one of the largest programming wikibooks.

But still there is always room for improvement — do help us to expand Ada Programming. Even beginners will find areas to participate.

About Ada
Ada is a programming language suitable for all development needs. It has built-in features that directly support structured, object-oriented, generic, distributed and concurrent programming.

Ada is a good choice for Rapid Application Development, Extreme Programming (XP), and Free Software development.

Ada is named after Augusta Ada King-Noel, Countess of Lovelace.

Programming in the large
Ada puts unique emphasis on and provides strong support for, good software engineering practices that scale well to very large software systems (millions of lines of code, and very large development teams). The following language features are particularly relevant in this respect:

 * An extremely strong, static and safe type system, which allows the programmer to construct powerful abstractions that reflect the real world, and allows the compiler to detect many logic faults before they become errors.
 * Modularity, whereby the compiler directly manages the construction of very large software systems from sources.
 * Information hiding; the language separates interfaces from implementation, and provides fine-grained control over visibility.
 * Readability, which helps programmers review and verify code. Ada favours the reader of the program over the writer because a program is written once but read many times.  For example, the syntax bans all ambiguous constructs, so there are no surprises, following the Tao of Programming's Law of Least Astonishment.  (Some Ada programmers are reluctant to talk about source code which is often cryptic; they prefer program text which is close to English prose.)
 * Portability: the language definition allows compilers to differ only in a few controlled ways, and otherwise defines the semantics of programs very precisely; as a result, Ada source text is very portable across compilers and target hardware platforms. Most often, the program can be recompiled without any changes.
 * Standardisation: standards have been a goal and a prominent feature ever since the design of the language in the late 1970s. The first standard was published in 1980, just 3 years after design commenced.  Ada compilers all support the same language; the only dialect, SPARK, is merely an annotated subset and can be compiled with an Ada compiler.

Consequences of these qualities are superior reliability, reusability and maintainability. For example, compared to programs written in C, programs written in Ada 83 contain "70% fewer internal fixes and 90% fewer bugs", and cost half as much to develop in the first place. Ada shines even more in software maintenance, which often accounts for about 80% of the total cost of development. With support for object-oriented programming, Ada 95 may bring even more cost-benefit, depending on how objects are used; although no serious study comparable to Zeigler's has been published.

Programming in the small
In addition to its support for good software engineering practices, which applies to general-purpose programming, Ada has powerful specialised features supporting low-level programming for real-time, safety-critical and embedded systems. Such features include, among others, machine code insertions, address arithmetic, low-level access to memory, control over bitwise representation of data, bit manipulations, and a well-defined, statically provable concurrent computing model called the Ravenscar Profile.

Other features include restrictions (it is possible to restrict which language features are accepted in a program) and features that help review and certify the object code generated by the compiler.

Several vendors provide Ada compilers accompanied by minimal run-time kernels suitable for use in certified, life-critical applications. It is also possible to write Ada programs which require no run-time kernel at all.

It should come as no surprise that Ada is heavily used in the aerospace, defence, medical, railroad, and nuclear industries.

The Language Reference Manual
The Ada Reference Manual (RM) is the official language definition. If you have a problem and no one else can help, you should read the RM (albeit often a bit cryptic for non-language lawyers). For this reason, all complete (not draft) pages in Ada Programming contain links to the appropriate pages in the RM.

This tutorial covers Ada Reference Manual — ISO/IEC 8652:2023 Language and Standard Libraries, colloquially known as Ada 2022 or just Ada.

You can browse the complete Reference Manual at http://www.ada-auth.org/standards/22rm/html/RM-TOC.html

There are two companion documents:
 * The Annotated Reference Manual, an extended version of the RM aimed at compiler writers or other persons who want to know the fine details of the language.
 * The Overview of Ada 2022, an explanation of the features of this language edition.

The Ada Information Clearinghouse also offers the older Ada 83, 95, 2005 and 2012 standards and companion documents.

The RM is a collective work under the control of Ada users. If you think you've found a problem in the RM, please report it to the Ada Conformity Assessment Authority (the Ada RM explains how to do this, see http://www.ada-auth.org/standards/22rm/html/RM-0-2.html Introduction (58/1) ff). On this site, you can also see the list of "Ada Issues" raised by other people.

Ada Conformity Assessment Test Suite
Unlike other programming languages, Ada compilers are officially tested, and only those which pass this test are accepted, for military and commercial work. This means that all Ada compilers behave (almost) the same, so you do not have to learn any dialects. The Ada standard does however allow compiler writers to include additional features and libraries that are not part of the standard.

Programming in Ada
Reading a document online is often quite cumbersome. So if you just started you can also download All Chapters ([//upload.wikimedia.org/wikipedia/commons/8/8d/Ada_Programming.pdf PDF version]) and print them out.

Getting Started
Where to get a compiler, how to compile the source, all answered here:

 * Basic Ada — Read Me First!
 * Finding and Installing Ada
 * Building an Ada program
 * Ada Development Environment

Language Features
These chapters look at the broader picture, introducing you to the main Ada features in a tutorial style.

 * Expressions
 * Control Structures
 * Type System
 * Constants
 * Representation Clauses
 * Strings
 * Subprograms
 * Packages
 * Input Output
 * Exceptions
 * Generics
 * Tasking
 * Object Orientation
 * Contract Based Programming
 * Memory Management (Access Types)
 * New in Ada 2005
 * New in Ada 2012
 * New in Ada 2022
 * Containers
 * Interfacing to other Languages
 * Coding Standards
 * Ada Programming Tips
 * Common Programming Errors

Computer Programming
The following articles are Ada adaptations from articles of the Computer programming book. The texts of these articles are language neutral but the examples are all Ada.

 * /Algorithms/
 * Chapter 1
 * Chapter 6
 * Knuth-Morris-Pratt pattern matcher
 * Binary search
 * /Error handling/
 * /Function overloading/
 * /Mathematical calculations/
 * /Statements/
 * /Control/
 * /Variables/

Language Reference
Within the following chapters we look at foundations of Ada. These chapters may be used for reference of a particular keyword, delimiter, operator and so forth.
 * Lexical elements
 * Keywords
 * Delimiters
 * Operators
 * Attributes
 * Aspects
 * Pragmas
 * Restrictions

Predefined Language Libraries
This section is a reference of the Ada Standard Library, which is extensive and well structured. It has these four root packages:

 * Standard
 * Ada
 * Interfaces
 * System

Besides the Standard Library, compilers usually come with a built-in library. This chapter describes the GNAT library in particular.

 * GNAT

External Libraries
This section is a reference of third-party Ada libraries which are not part of the compiler predefined environment but are freely available.

 * Libraries
 * Multi Purpose
 * Container Libraries
 * GUI Libraries
 * Distributed Objects
 * Database
 * Web Programming
 * Input/Output
 * Platform specific
 * Programming Ada in Linux
 * Programming Ada in Windows
 * Programming Ada in Virtual Machines (Java, .NET)

External resources

 * Open-source portals
 * Web Tutorials
 * Web 2.0

Printable Versions
The following are collection pages. All collection pages are comprised of groups of the already available pages. You can use them for printing or to gain a quick overview. Please note that those pages are partly very long.

 * Tutorial : Show HTML (1,839 kb) — [//upload.wikimedia.org/wikipedia/commons/8/8d/Ada_Programming.pdf Download PDF] (2,663 kb, 243 pages)
 * Keywords : Show HTML (470 kb) — [//upload.wikimedia.org/wikipedia/commons/6/67/Ada_Programming_Keywords.pdf Download PDF] (290 kb, 59 pages)
 * Operators : Show HTML (232 kb) — [//upload.wikimedia.org/wikipedia/commons/6/65/Ada_Programming_Operators.pdf Download PDF] (189 kb, 27 pages)

Source Code
The Source from the Book is available for download and online browsing. The latter allows "drill down", meaning that you can follow the links right down to the package bodies in the Ada runtime library.

Ada 2012 textbooks

Ada 2022 textbooks

 * John Barnes (2022). Programming in Ada 2012 with a Preview of Ada 2022. Cambridge University Press. ISBN 9781009181341
 * John Barnes (2024) [PLANNED]. Programming in Ada 2022. Cambridge University Press. ISBN 9781009564779

Manuals and guides

 * Ada Quality & Style Guide: Guidelines for Professional Programmers (wikibook)
 * Rationale for Ada 2005, by John Barnes (2007)
 * Ada 2005 Reference Manual (2007)
 * Ada Reference Card (in PDF format)

High-Integrity Software

 * ISO/IEC TR 15942:2000, Guide for the use of the Ada programming language in high integrity systems. ISO Freely Available Standards
 * ISO/IEC TR 24718:2005, Guide for the use of the Ada Ravenscar Profile in high integrity systems. ISO Freely Available Standards

Resources

 * Ada Information Clearinghouse — News and resources
 * comp.lang.ada (Web archive, Google groups) — International Usenet newsgroup
 * ada-lang.io — Community site and forum

Research and user groups

 * Journals:
 * Ada-Letters
 * Ada User Journal (archive)
 * International Conferences/Workshops:
 * International Real-Time Ada Workshop (IRTAW) [ IRTAW 15 ]
 * ACM SIGAda international conference on Ada [ HILT 2012 ]
 * 18th International Conference on Reliable Software Technologies — Ada-Europe 2013
 * 17th International Conference on Reliable Software Technologies — Ada-Europe 2012
 * Ada Connection 2011 (videos)
 * Ada "Developers Room" at FOSDEM (2020)
 * Local conferences:
 * Ada-Belgium Conference

Associations

 * ACM SIGAda — ACM Special Interest Group on Ada
 * Ada-Europe
 * Ada Germany
 * Ada Spain
 * Ada-Belgium
 * Ada-France
 * Ada Switzerland

Free online books/courses

 * learn.adacore.com
 * The Big Online Book of Linux Ada Programming
 * Ada Distilled
 * Ada in Action
 * Introducing Ada 95
 * Learn Ada on the Web
 * Quick Ada
 * Ada 95: The Craft of Object-Oriented Programming — Free textbook originally published by Prentice Hall
 * Online Ada books

Authors and contributors
This Wikibook has been written by:

 * Martin Krischik (Contributions)
 * Manuel Gómez (Contributions)
 * Santiago Urueña (Contributions)
 * C.K.W. Grein (Contributions, more and more contributions)
 * Bill Findlay (Contributions)
 * B. Seidel (Contributions)
 * Simon Wright (Contributions)
 * Allen Lew (Contributions)
 * John Oleszkiewicz (Contributions)
 * Nicolas Kaiser (Contributions)
 * Larry Luther (Contributions)
 * Georg Bauhaus (Contributions)
 * Samuel Tardieu (Contributions)
 * Ludovic Brenta (Contributions)
 * Mateus de Lima Oliveira (Contributions)
 * Ed Falis
 * Pascal Obry
 * Bent Bracke (Contributions)

If you wish to contribute as well you should read Contributing and join us at the Contributors lounge.

Programación en Ada Programmation Ada Ada

title: Ada Programming


text:
World History/Age of Discovery & Imperialism

Beginning in the late 14th century, European explorers embarked on a series of expeditions of discovery and conquest. Some motivated by fabulous tales from the Orient, tales of riches, gold, and silver or stories about the oriental silk road available to Italian traders. Most intended in controlling the trade of those valuable exotic products, such as spices, silk.

Portugal and the beginnings of naval exploration
Portugal's nautical exploration was not much about expansionism (conquest, control and new lands) but simple application of technology, curiosity and trade improvement. Nautical experience was already abundant in that region of the Iberian peninsula. Fishing, production of sea salt and its use in fish conservation had already linked the region to the Sea, even before the Roman occupation of the territory. Being a peninsula also meant that most commerce was done by Sea.

Territory control only started to become an issue after the involvement of the other powers, especially the competition from Spain. This becomes an active policy after the rise of the Aviz dynasty, John I of Portugal was a key figure in restoring the Portuguese independence from "Spain" (Castile). Due to the relation between Crowns and successions Portugal had become virtually annexed to Castile. It is with this bellicose separation from the control of Spain, that leads also to the Anglo-Portuguese Alliance that endures to the present day that trade expansion and secure navigational routes starts to gain importance to the Portuguese Crown, starting with the siege and conquest of the city of Ceuta in 1415, a failed attempt to secure a profitable trade route.

Portugal's Prince Henry the Navigator, who also studied sailing techniques pioneered by the Arabs when he helped Portugal conquer Northern Morocco. Later, Prince Henry founded a navigation school, where these techniques were quickly integrated into Portuguese vessels.

Prince Henry's dream was find a sea route to India around Africa, so Portuguese traders could bypass the Italian middlemen who had monopolized the Oriental luxury trade. Under his direction, Portuguese explorers explored much of the African coast, and established profitable trading posts in the Niger delta and further south in Angola. However, it was only after his death that the Portuguese explorer Vasco da Gama sailed around the Cape of Good Hope and reached the Southern India's trading cities.

Within fifty years of da Gama's success, Portugal essentially controlled the Indian Ocean, with strategically located trading posts at Aden, Hormuz, and Malacca. After Portuguese ships defeated Egypt's navy, even the Mughal Empire of India was forced to acknowledge Portuguese domination. In return, the Muslim Mughals were allowed to send one pilgrim ship to Mecca each year without paying any fees to the Portuguese.

Spain follows
As summed up by the Spanish explorers of the Americas as "Gold, Glory, and God", were to amass great wealth by conquering indigenous peoples, to bring fame to their monarchs and themselves for their daring exploits, and to bring Christianity to the regions that they explored and exploited.

Spain disputes the New World
While Portugal set its sights on dominating the Indian Ocean, its neighboring country, Spain, also began to explore and seek colonies. While the new Spanish monarchs hoped to add the southern Kingdom of Granada to their rule, an enterprising Italian merchant named Columbus found his way to the Spanish court. He had previous experience sailing on Portuguese trade vessels in the Indian Ocean, and wanted to lead a voyage across the Atlantic to India and break the Portuguese trade monopoly. Contrary to popular belief, Columbus's proposal was not dismissed because most people thought the world was flat, but because most thought India was too far to reach without running out of food or getting stuck in windless regions. However, Isabella wisely decided to fund an expedition - after Spanish forces conquered Granada.

So, after a lengthy delay, Columbus set sail across the Atlantic with three vessels, the Niña, Pinta, and Santa Maria, all manned by convicts from Spanish jails. Columbus landed somewhere in the Bahamas, though he named the dark skinned inhabitants of the islands "Indians" because he thought that he had reached India. Columbus would embark on other expeditions throughout the Caribbean, though he never reached China as he had hoped. The Americas would later be named after Amerigo Vespucci, a fellow Italian explorer who argued, correctly, that Columbus had discovered a new land.

By the early 15th century, Spain controlled the largest Caribbean islands, including Cuba, Puerto Rico, and Hispaniola. However, the native Carib and Arawak tribes did not posses the riches the Spanish explorers desired, although they did speak of a great kingdom on the mainland with immense treasures. Hernando Cortés, an adventurer who had gotten in trouble with the Spanish governor, believed the tales and mounted a modest expedition to find this kingdom. Cortés landed in Mexico, and quickly allied himself with local tribes who directed him inland to the Aztec capital, Tenochtitlan. Moctezuma, the Aztec Emperor, received news of Cortés, but chose not to attack, believing Cortés to be the Aztec god Quetzalcoatl, who had been driven away many years ago by the war god Huitzilopoctli. Moctezuma's hesitation allowed Cortés to enter the Aztec capital and to receive additional support from tribes opposed to the Aztecs. By the time the Aztecs realized that Cortés was preparing to attack, Moctezuma had already been taken hostage. Moctezuma, and many of the Spanish recruits in the expedition, was killed in the fighting, which only ended when Cortés razed Tenochtitlan.

News of Cortés's success and wealth soon spread, with many more expeditions trying to emulate his success. Among the most successful were John Cabot, Giovanni da Verrazano, Francis Drake, Francisco Vasquez de Coronado, Francisco Pizarro, and David Wang/David Wang

The Treaty of Tordesillas
By the end of the 16th century, Spain and Portugal dominated trade and territories in Asia and the Americas. Portugal controlled most of the Indian Ocean trade, as well as the spice plantations in Indonesia, while Spain controlled extensive parts of Central and South America. Fearing a war between the two rivals, the Pope helped negotiate the Treaty of Tordesillas, which essentially divided the world in half, with both countries receiving exclusive rights in their respective hemispheres.

Other European Explorations
England, France, and the Netherlands, refused to comply with the Treaty of Tordesillas and also began to explore and establish colonies in the Americas.

New France
France founded colonies in much of eastern North America, on a number of Caribbean islands, Asia, and in South America. Most colonies were developed to export products such as fish, sugar, and furs.

The French first came to the New World as explorers, seeking a route to the Pacific ocean and wealth. Major French exploration of North America began under the reign of King Francis I. In 1524, Francis sent Italian-born Giovanni da Verrazano to explore the region between Florida and Newfoundland for a route to the Pacific Ocean. Although he failed to find such a route, Verranzano became the first European to explore much of the Atlantic coast of the United States and Canada. Later, in 1534, Francis sent Jacques Cartier on the first of three voyages to explore the coast of Newfoundland and the St. Lawrence River.

In 1541 Cartier set of on another expedition, and established a colony named Charlesbourg-Royal, on the site of present-day Cap-Rouge, Quebec. Cartier continued to explore the region. He returned to Charlesbourg-Royal and found the colony struggling to survive, and after a tough winter, left for France in June of 1542. Charlesbourg-Royal was abandoned the following year.

A second French attempt at establishing a North American colony came in 1562, when King Charles IX sent Jean Ribault and a group of Huguenot settlers to found a colony in North America. They explored the St. Johns River in what is now Jacksonville, Florida and attempted a failed colony at Parris Island, South Carolina, but eventually returned to the St. Johns, where Ribault's second in command René Goulaine de Laudonnière established Fort Caroline on June 22, 1564. In 1565 the Spanish attacked, and destroyed, the fort.

In 1603, Samuel de Champlain made his first trip to North America on a fur trading expedition. Champlain would prove instrumental in creating New France. In 1608, he created a fur trading post that would grow into the city of Quebec. The French ran into many bloody conflicts with the Iroquois Confederacy. Although the French claimed a large territory in Canada and the Great Lakes region, actual settlement of the area was limited.

New France began to grow south and west of the Great Lakes after 1673, when Father Jacques Marquette and Louis Jolliet canoed across present day Wisconsin via the Fox-Wisconsin Waterway to discover the Mississippi River. From here, they followed the river south to the mouth of the Arkansas River. Afraid that they were drawing too near to areas of Spanish influence, the explorers turned north in Arkansas and returned to the Great Lakes, this time via the Illinois and Chicago rivers through present day Chicago.

Following the journey of Marquette and Jolliet, René-Robert Cavelier, Sieur de La Salle traveled the Mississippi to its delta, claiming the river's entire watershed for France in 1682 and naming the territory Louisiane in honor of Louis XIV. This gave France control of the Mississippi Valley and the Great Plains in addition to their holdings in the Great Lakes and Canada. In 1699 the first permanent settlement was founded, and New Orleans was founded in 1718.

Following the French defeat in the French and Indian War, the Treaty of Paris of February 10, 1763, divided French territory on the North American continent between the British and the Spanish. The sole exception was the islands of Saint Pierre and Miquelon off the Canadian coast, retained as a fishing outpost. The islands of Saint-Pierre and Miquelon were France's only remaining possessions north of the Caribbean.

West Indies
French efforts at colonization began in 1538, when a group of French Jesuit refugees founded the town of Dieppe on St. Kitts. However, their colony was found and destroyed by the Spanish within a year. France did not attempt to colonize the Caribbean again in the 16th century, but established a number of colonies the following century.

The most important French colony was on the island of Hispaniola, present-day Haiti.

South America
From 1555 to 1567, French Huguenots, under the leadership of vice-admiral Nicolas Durand de Villegaignon, made an attempt to establish the colony of France Antarctique in what is now Brazil, but were expelled. From 1612 to 1615, a second failed attempt was made in present-day São Luís, Brazil.

French Guiana was first settled by the French in 1604, although its earliest settlements were abandoned in the face of American Indian hostility and tropical diseases. The settlement of Cayenne was established in 1643, but was abandoned. It was re-established in the 1660s. Except for brief occupations by the English and Dutch in the 17th century, Guiana has remained under French rule ever since.

North America
In 1602, the government of the Republic of the Seven United Netherlands chartered the Dutch East India Company (Vereenigde Oostindische Compagnie, or VOC) with the mission of exploring it for a passage to the Indies and claiming any uncharted territories for the United Provinces.

The VOC's explorers soon led several significant expeditions. In 1609, English explorer Henry Hudson, working for the VOC, attempted to find a north west passage to the Indies. Instead he discovered and claimed for the VOC parts of the present-day United States and Canada and lent his name to the Hudson River and Hudson Bay. In 1614, Adriaen Block led an expedition to the lower Hudson in the Tyger, and then explored the East River aboard the Onrust, becoming the first known European to navigate the Hellegat.

After some early trading expeditions, the first Dutch settlement in the Americas was founded in 1615: Fort Nassau, on Castle Island in the Hudson, near present-day Albany. The settlement served mostly as a trade post for fur trade with the natives and was later replaced by Fort Oranje (English: Fort Orange) at present-day Albany. Both forts were named in honor of the Dutch House of Orange-Nassau.

The Dutch West India Company (WIC)was established in 1621. In 1626, Director-General of the WIC Peter Minuit purchased the island of Manhattan from Indians and started the construction of fort New Amsterdam. This was the begging of New Netherland. In the same year, another Fort Nassau (not the one near Albany) was built in the New Jersey area. A number of other settlements were founded in the area. In 1647 Peter Stuyvesant became Director-General of New Netherland. In 1655 New Sweden was captured by the Dutch, and a border dispute with England was resolved.

In 1664, English troops under the command of the Duke of York and Albany attacked the New Netherland colony. Being greatly outnumbered and with little gunpowder or ammunition, Director-General Peter Stuyvesant surrendered New Amsterdam, with Fort Orange following soon. New Amsterdam was renamed New York, Fort Orange was renamed Fort Albany. The loss of the New Netherland led to the Second Anglo-Dutch War during 1665-1667.

From 1673 to 1674, the territories were once again briefly captured by the Dutch in the Third Anglo-Dutch War, only to be returned to England at the Treaty of Westminster. In 1674, Dutch navy captain Jurriaen Aernoutsz also briefly captured two forts in the French colony of Acadia, which he claimed as the Dutch territory of New Holland. However, Aernoutsz's appointed administrator, John Rhoades, quickly lost control of the territory after Aernoutsz himself left for Curaçao to seek out new settlers, and with effective control of Acadia remaining in the hands of France.

West Indies
The Dutch established a base on St. Croix in 1625, the same year that the British did. French Protestants joined the Dutch but conflict with the British colony led to its abandonment before 1650. The Dutch established a settlement on Tortola in 1648 and later on Anegada and Virgin Gorda. The British took Tortola in 1672 and Anegada and Virgin Gorda in 1680.

Dutch colonization of Sint Maarten began in 1620 although the ownership of the island changed hands several times before 1648, when it was permanently split between France and the Netherlands. The border between the two portions of the island continued to be modified periodically, before being set for good in 1816.

Several other islands were captured and fortified to prevent Spanish attacks in the ongoing Dutch war for independence from Spain and to exploit timber and salt resources, among them being:Curaco, Saba, Sint Eustatius, Aruba and Bonaire.

The Netherlands made numerous attempts to colonize the island of Tobago in the 17th century. Each time, the settlements were destroyed by rival European powers. The longest occupation period was from 1628-1637 when it was destroyed by the Spanish.

South America
The European colony in Suriname was founded by the English in the 1650s by Lord Willoughby, the governor of Barbados. This colony was captured by the Dutch under Abraham Crijnsen during the Second Anglo-Dutch War. On July 31, 1667, by the Treaty of Breda the Dutch were offered New Netherland in exchange for their sugar factories on the coast of Suriname, but they declined. In 1683 Suriname was sold to the Dutch West India Company and came to be known as Dutch Guiana. The colony developed an agricultural economy based on African slavery.

The Dutch West Indian Company built a fort in Guyana in 1616 on the Essequibo River. The Dutch traded with the Indian peoples and, as in Suriname, established sugar plantations worked by African slaves. While the coast remained under Dutch control, the English established plantations west of the Suriname River. Conflict between the two countries meant parts of the region changed hands a number of times, but by 1796 Britain had control of the region. The Netherlands ceded the colonies of Essequibo, Demerara, and Berbice to Britain in 1814.

From 1630 onward, the Dutch Republic came to control a small portion of Brazil, with their capital in Recife. The Dutch West India Company set up their headquarters in Recife. The governor, Johan Maurits invited artists and scientists to the colony to help promote Brazil and increase immigration. The Portuguese won a significant victory at the Second Battle of Guararapes in 1649. By 1654, the Dutch Republic had surrendered and returned control of all Brazilian land to the Portuguese. After the end of the First Anglo-Dutch War in may 1654, the Dutch Republic demanded that New Holland (Dutch Brazil) was given back to them. Under threat of an occupation of Lisbon and a reoccupation of North East Brazil, the Portuguese submitted to the demand of the Dutch. However, Johan de Witt didn't agreed and therefore New Holland was formally ceded to Portugal on August 6, 1661 through the Treaty of the Hague.

In 1600, the Chilean city of Valdivia was conquered by Dutch pirate Sebastian de Cordes. He left the city after some months. Then in 1642 the VOC and the WIC sent a fleet of some ships to Chile to conquer the city of Valdivia and the goldmines of the Spanish. The expedition was conducted by Hendrik Brouwer, a Dutch general. In 1643 Brouwer conquered the island Chiloé and the city of Valdivia. After mutinying the crew returned to Brazil.

Asia
Starting in 1602, the VOC began to take over Portuguese possessions in the East Indies. The Portuguese settlements were isolated, difficult to reinforce if attacked, and prone to being picked off one by one. Amboina was captured from the Portuguese in 1605, but an attack on Malacca the following year narrowly failed in its objective to provide a more strategically located base in the East Indies with favorable monsoon winds. The Dutch found what they were looking for in Jakarta, conquered by Jan Coen in 1619, later renamed Batavia after the Latin name for Holland, and which would become the capital of the Dutch East Indies. Meanwhile, the Dutch continued to drive out the Portuguese from their bases in Asia. Malacca finally succumbed in 1641 and after this event, the Dutch had full control of the spice and silk trade in the East Indies.

In India and Ceylon, the Dutch had taken over the Portuguese settlements of Colombo in 1656, Ceylon in 1658, Nagappattinam in 1662 and Cranganore and Cochin in 1662. Goa, the capital of the Portuguese Empire in the East, was attacked by the Dutch twice in 1603 and 1610, on both occasions unsuccessfully. While the Dutch were unable in four attempts to capture Macau from where Portugal monopolized the lucrative China-Japan trade, the Japanese shogunate's increasing suspicion of the intentions of the Catholic Portuguese led to their expulsion in 1639. Under the subsequent Sakoku policy, for two hundred years the Dutch were the only European power allowed to operate in Japan, confined in 1639 to Hirado and then from 1641 at Deshima.

Africa
The first Cape settlement was built in 1652 by the Dutch East India Company as a re-supply point and way station for Dutch vessels on their way back and forth between the Netherlands and the East Indies. The support station gradually became a settler community, the forebears of the Afrikaners, a white ethnic group in South Africa.

After the first settlers spread out around the Company station, nomadic white livestock farmers, or Trekboers, moved more widely afield, leaving the richer, but limited, farming lands of the coast for the drier interior tableland. There they contested still wider groups of Khoikhoi cattle herders for the best grazing lands. By 1700, the traditional Khoikhoi lifestyle of pastoralism had disappeared.

Over the next few decades, the colony continued to expand, taking over the primitive African population. In 1795, France conquered the Netherlands. The British, fearing French control, moved to occupy the colony. In 1803 the colony was returned the French puppet state, the Batavian Republic, until war broke out again and Britain occupied the colony in 1806. It would not revert the Dutch control.

Starting in 1598, the Dutch began to establish forts on the gold coast in Africa. For the next 270 years, the Dutch fought for control of the colony against the British, Swedish and Portuguese. They succeeded in driving out the Portuguese and Swedish. However, in 1872 the Dutch and British governments came to an agreement, in which the British were to purchase the Dutch gold coast settlements.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
User:Zenogantner~enwikibooks

Have a look at my Wikipedia user page.

de:Benutzer:Zeno Gantner

title: User:Zenogantner~enwikibooks


text:
Talk:Electronics/Formulas

If these Ohm's Law calculations are all there is to this section, this section could be incorporated into the exceptionally brief Ohm's Law section. H Padleckas 22:52, 11 May 2004 (UTC)

Why are power and work both given the symbol W? Anonymous User 20:31, Dec 27 2005

Presentation
By adding pictures of curcuits it would be easier to understand what is calculated and how. Adville (discuss • contribs) 21:32, 8 March 2012 (UTC)

Keep this page. It is very useful for contributors.
Writers and editors like to find lists of formulas without complicated formats (tables, etc.) See for example https://en.wikiversity.org/w/index.php?title=User:Guy_vandegrift/2410equationsheet&oldid=1121564. --guyvan52 (discuss • contribs) 16:03, 6 December 2013 (UTC)

title: Talk:Electronics/Formulas


text:
Music Theory/Rhythm

Rhythm is, aside from melody, one of the most basic aspects of music, and definitely the fundamental. Many early forms of music consisted only of rhythm; examples being drumming, clapping and shouting to a rhythm.

Basic durations
There are two systems for naming notes in the English language. Here, the American names are listed first and the European names are listed in parentheses. This book, for consistency's sake, will use the American names throughout.

The whole note is the longest unit we will consider in this book. Earlier music featured the breve, which is twice as long. (This is why the whole note is called the "semibreve" in Europe.) Each unit after that is half the length of the previous.

 * Whole note (semibreve)
 * Half note (minim)
 * Quarter note (crotchet)
 * Eighth note (quaver)
 * Sixteenth note (semiquaver)
 * Thirty-second note (demisemiquaver)
 * Sixty-fourth note (hemidemisemiquaver)

There are even shorter notes, such as the 128th note (semihemidemisemiquaver), but they are absurdly short for most music; even 32nd notes are uncommon. However, there are rare situations where they are appropriate. One piece with such notes is the Pathétique Sonata by Ludwig van Beethoven.

Music may also contain rests, in which no note is played or sung.

This image shows notes and rests, in order from longest to shortest.

More on durations
A staccatoed note is 'separated' from the other notes around it. Space is inserted between the notes by shortening the end of the note being played. Some musicians consider it to be "short and detached", whereas others suggest that a staccatoed note is half its value. This is more a feature of articulation and style, rather than rhythm, but it has rhythmic bearing as playing staccato can often cause musicians to play out of tempo. Staccato is shown by a dot below or above the note.

A very short note is known as appoggiatura or acciaccatura. They are both almost insignificantly short notes also known as "grace notes" for the purpose of expression. The shorter of the two is the acciaccatura. They are shown as shrunken eighth notes, with a score through the shorter and the longer having no such flourish. Common uses include on bagpipes as grace notes or on guitar for slides, string-bends and hammer-on/pull-offs.

A dotted note is 50% longer than the undotted version, i.e. a dotted half note would take 3 beats, lasting as long as three quarter notes tied together. A double-dotted note is 75% longer than the normal note, i.e. a double-dotted half note would take 3½ beats.

Do not confuse dotted notes with staccato notes. Dotted notes have a dot on the right side, while staccato notes have dots on the top or bottom.

Time signatures
Time signatures are the basic description for the feel of the rhythm; they define how to count the rhythm. They are also known as the meter. This is why one can listen to a piece and know what time signature it is in. It is like hearing Shakespeare and knowing how many syllables are in the lines and what meter it is in. By far the most common time signature is 4/4, the next most possibly being 3/4 (commonly associated with the waltz). A time signature is found at the first measure right after the clef and key signature.

It is made up of two parts. For all meters the top number gives the number of notes per measure and the bottom number gives the note type. The bottom number can be:
 * 1 - whole note (very rare)
 * 2 - half note (uncommon)
 * 4 - quarter note (extremely common)
 * 8 - eighth note (common in modern avant-garde music and much other non-western music)

The top number may also be any other power of 2, but they are rare. The bottom number is in most cases a power of two but non-dyadic (irrational) time signatures may be used in special cases, e.g. if a measure contains an incomplete set of triplets.

The time signature 4/4 means there are four quarter notes in a measure; the time signature 3/4 means there are three quarter notes in a measure. The time signature 2/2 is, in a way, the same as 4/4. However, 2/2 has two beats per measure (each a half-note in length), while 4/4 has four beats per measure. Beats are usually accented in some way in a song, especially with percussion in popular music. Usually the thesis is accented, while the arsis is unaccented. Traditionally the thesis is the down-beat and the arsis is the up-beat. The terms down-beat and up-beat come from the movements the director makes while conducting.

NB the Time Signature is not written as a fraction but instead as two numbers one on top of the other, with no line between.

We divide time signatures into three main types:
 * simple (each beat is divided into its sub-beats)
 * compound (notes are grouped together into beats by the type of sub-beat)
 * asymmetric (both duple and triple groupings for its notes)

Time signatures are classified by type (simple or compound) and sub-beat (duple or triple).

In simple meter, the beat is divided into sub-beats or subdivisions: However, for compound meters, the sub-beats are grouped into the beats by duples or triples:
 * 1 - In simple duple meter the beat (this is the type of note specified by the bottom number in the signature) is divided into two sub-beats.
 * 2 - In simple triple meter the beat is divided into three sub-beats.
 * 1 - In compound duple meter the notes are grouped into twos, these groups make up a whole beat. Example: 6/8, three beats each with two sub-beats.
 * 2 - In compound triple meter the notes are grouped into threes, these group make up a whole beat. Example: 6/8, two beats each with three sub-beats.

Asymmetric meters are a type of compound meter where beats are divided into duples and triples. In these the beat actually changes its length because the sub-beat is constant. Examples: 5/8, two beats; either the first with two sub-beats and the second with three, or the first with three sub-beats and the second with two. 7/8, three beats -- either 2, 2, 3; 2, 3, 2; or 3, 2, 2 (in sub-beats).

Tempo
Beats-per-minute (or BPM) indicate how fast a song is played. Each beat corresponds to one note of the type indicated by the bottom number in the key signature. For example, a song with 60 BPM will have 60 beats in a minute, or one beat per second. A song in 4/4 time at 60 BPM will have 15 bars in a minute, with 4 beats per bar; one each quarter note. A song at 120 BPM will have 30 bars in a minute and 2 beats per second. The number of beats per minute is usually specified at the beginning of a piece using one of two conventions. The first is something like, "M.M.=115". M.M. stands for Mälzel's metronome. (Johann Nepomuk Mälzel) The other common notation is a picture of the note value receiving the beat, an equals sign (=), and the BPM. Most musicians, even professionals, own and regularly use a metronome or drum machine for practicing or recording in order to ensure they play at the desired tempo.

title: Music Theory/Rhythm


text:
Music Theory/Consonance and Dissonance

Consonance and dissonance are subjective qualities of relationship that we assign to music intervals. A quick review of intervals might be helpful if you're approaching the subject for the first time. A dissonant interval can be described as being "unstable" or demanding treatment by resolving to a consonant interval. A consonant interval is one that is stable and does not demand treatment. However, dissonance in itself is not an undesirable thing; we use dissonance to provide the "spice" to music. Thus, there is a hierarchy of consonant and dissonant intervals. (Chords having dissonant intervals are themselves considered dissonant).

Note that this distinction depends entirely on musical context. As such, a sonority which is consonant in one context where it does not seem to demand resolution (say, major 2nds in a Debussy prelude) may sound harsh or out-of-place in a different context where it must be resolved (the same major 2nds in a Bach fugue). In this article, we will be using the terms "consonant" and "dissonant" as they are understood in common-practice tonal music, as is the tacit convention when speaking of consonance and dissonance in general.

Consonant intervals in tonal music

 * The perfect fifth and the perfect octave are considered perfect consonances. The unison is a consonance insofar as it can be considered an interval at all (many say it cannot).
 * The major third and sixth, as well as the minor third, sixth, are considered to be imperfect consonances.
 * The perfect fourth is dissonant in some contexts but consonant in others (see below). Specifically, the perfect fourth is dissonant when it is formed with the bass note of any sonority.

Dissonant intervals

 * The perfect fourth is considered dissonant in common practice music when not supported by a lower third or fifth (but see below).
 * Major and minor seconds, sevenths, and ninths are dissonant. Composer/theorist Vincent Persichetti, in his book Twentieth-Century Harmony, classifies major 2nds, minor 7ths, and major 9ths as "soft dissonances," whereas minor 2nds, major 7ths, and minor 9ths are "sharp dissonances."
 * The tritone (an augmented fourth or diminished fifth) is dissonant. In the Middle Ages and Renaissance, it was known as diabolus in musica because the perfect fifth was considered to be a reflection of the divine, and the tritone falls just short of a perfect fifth. [Note for the advanced: Technically, it is not proper to refer to the diminished fifth as a "tritone." The word "tritone" refers to "three whole-tones," the distance represented by the tritone. This means that the augmented fourth, which comprises three whole-tones, is a true tritone, while the diminished fifth, because of its accidental-spelling, is not made up of three whole-tones and is therefore not a tritone. However, it is acceptable as an informal convention to refer to the diminished fifth as a "tritone."]
 * In Jazz, the minor 9th is often considered too dissonant for practical use. This is the basis for some notes being called "avoid notes", typically the 4th of a major scale - it sounds dissonant because it forms a minor 9th with the 3rd. Other "avoid notes" are the minor 6th in aeolian mode, or the minor 2nd in phrygian mode. Some chords are typically voiced to avoid a minor 9th (musicians invert the interval and play a major 7th instead). For example, in a Cadd11 chord (see ../Complete List of Chord Patterns/), there is a minor ninth between the third, E and the eleventh F. If the F is played below the E, the interval becomes a major seventh, which is less dissonant.

The perfect fourth
The perfect fourth is the inversion of the perfect fifth. In common practice music, it can be both consonant and dissonant: in this case, it has a need for resolution when unsupported by lower notes, in which case it is dissonant even though it sounds as "good" as the fifth. The fourth is always consonant when supported by a lower third or perfect fifth, for example, E-G-C-E is consonant, but G-C-E is dissonant. In more contemporary music, many consider the fourth to always be as consonant as the fifth.

The perfect fourth is often considered a perfect consonance, as the perfect fifth and the octave.

title: Music Theory/Consonance and Dissonance


text:
Music Theory/Atonal

Definition
Atonal music is a generalizing term used to define music that seems to lack a clear tonal center. Nearly all music in the western classical tradition is considered 'tonal': that is, its harmonic structure is primarily triadic and hierarchically organized around a prominent tonal center. Atonal music works tend to deny or expand this notion by using alternative structural strategies (frequently - but not exlusivelly - mathematical, the most famous being serialism). As a result, many listeners used to traditional tonality may find atonal music very challenging at first, in particular because the lack of a tonal hierarchy means that highly dissonant chords are far more common (and, indeed, early practitioners of the style often deliberately used these chords as to avoid any implied reference to a tonic). That said, others argue that atonality is simply another musical language which, like all other languages (including traditional tonality), cannot be learned or appreciated until one has been immersed in it.

A brief history of atonality
Composer Arnold Schoenberg is generally seen as the first composer to fully embrace 'atonality', although a number of other composers (such as Bartok and Scriabin) had been moving in that direction for some time. In 1925, after experimenting with free atonality, he composed his Suite für Klavier, the first piece of music ever written using the twelve-tone method of composing. His students, Alban Berg and Anton Webern, followed in his footsteps by composing numerous twelve-tone pieces; the method was generalised during the 1950s to include other parameters such as rhythm and volume, the resultant system being known as total serialism.

Contemporary situation
All these influences over the last century have meant that it is now very difficult to draw a clear line between atonal and tonal music: for example, the music of Philip Glass has a clearly defined tonal center (and is generally seen as tonal), but it does not use harmony in the traditional way (as a means of giving the music direction), instead using repetition to create something more static; similarly, the music of composers such as Alfred Schnittke or John Adams combines elements of tonal and atonal music freely and undogmatically; this approach can be seen as far back as Berg's Violin Concerto of 1936, which sounds almost tonal in many places despite its use of the twelve-tone method]].

title: Music Theory/Atonal


text:
Music Theory/Music Notation Systems

There are many ways to describe musical notes, including solfege, letters, numbers, tablature, and of course the standard music staffs. It is important to have a working knowledge of all of these (except tablature, as it is instrument-specific and many instruments do not use it at all).

Letters
Letter names give a label to each letter of the C major scale: C D E F G A B. Notes can be sharpened or flattened; between D and E comes a note called either D♯ ("D sharp") or E♭ ("E flat"). Even more confusingly, E can be called D ("D double-sharp"), and D can be called E ("E double-flat")! For now, you need only know that a D♯ and an E♭ are enharmonically equivalent (that is, they have the same pitch, but serve a different diatonic function) in the simplified tuning most commonly used today. You will learn about diatonic function later.

These are the letter names used in English, Dutch, and possibly a few other languages. However, Germany, Scandinavia (such as Iceland, Denmark, Sweden) and Slavic countries have another system: their C major scale is C D E F G A H. Their H corresponds to our B. They also use the letter B, to mean the note we call B flat. They do not use special letters for any other notes, however, for instance, what we call a C sharp they would call "Cis", "Ciss" or "Cís" (depending on the language), which literally means "C sharp". We will not concern ourselves with these differences as this alternate system is almost never encountered in English language texts. Some other countries don't use letters for notes at all, but instead the fixed-doh solfege system, where "Do" or "Ut" always means the note C. This is an inflexible system unlike the moveable-doh one used in English, where "Do" (or "Doh") can be any pitch.

Solfege
Solfege is one of the most common ways of expressing musical notes for vocalists. In fact, in some countries such as Spain, Portugal, Italy and France, solfege is always used instead of note names.

The major scale in solfege runs: do re mi fa sol la ti. (Note: in some regions, such as Portugal, "ti" is called "si"). After "ti" comes "do" again, one octave higher than the previous "do." Notes outside the scale (sharps and flats) are expressed in different ways according to regions. In some the equivalent to sharp or flat is added after the name of the note (C sharp would thus be Do dièse in France and Belgium). In other regions, another syllable with the same initial letter is used, although this is mostly reserved for instructional uses. For example, the pitch between "re" and "mi" can be called either "ri" or "mé". The proper syllable to use is based on whether you are travelling up or down the scale. The first letter of the syllable should come from the previous note, while the second letter is inherited from the next note in the sequence. Most commonly, the chromatic ascending scale is "do di re ri mi fa fi sol si la li ti/si do" and the descending scale is "do ti/si te la le sol se fa mi me re ra do."

In India, Solfege is called "Sargam" and the scale runs: sa re ga ma pa dha ni

The "movable do" system is the one most commonly used, where do becomes the tonic of the key (C in the key of C, etc.) "Fixed do" is also used at some major colleges and universities, where do is always C, no matter what the key is. This involves a lot more use of chromatic solfege though.

This book will not use solfege. More information can be obtained in Wikipedia's treatment of the subject. The material should be learned and practiced, but it is useful mostly in communicating with other musicians who use the system.

Numbers
Numbers are used in lieu of solfege to describe relative tones. Either Roman numerals (I II III) or Arabic numerals (1 2 3) can be used. A major scale would be: I II III IV V VI VII. Each number can be pronounced either like a cardinal number ("one, two, three...") or an ordinal number ("first, second, third..."). These can be sharpened and flattened, but the sharp is usually written before the numeral: ♯II ("augmented second"), ♭III ("minor third").

Latin names
Latin names follow the same principle as the solfege scale and numerals. The notes are called the tonic, supertonic, mediant, subdominant, dominant, submediant, and leading tone. Of these, it is most important to remember the "tonic" (I), "subdominant" (IV), and "dominant" (V), because these tones and chords built on these tones are used the most often.

Tablature
Tablature is notation specific to an instrument or class of instruments, usually plucked-string instruments such as the guitar or aerophones like the harmonica. It is mostly used in popular music for guitar and bass, because many players of these instruments do not read standard notation and the notation does not help illustrate fingerings, for instance, a "middle C" can be played on several different strings on the guitar, but they all look the same in standard notation. However, tablature usually lacks information on rhythm. Instead, tablature notation assumes that the reader is familiar with the tune or can hear its demonstration on a recording or other source. For these reasons, much professional guitar music includes standard notation along with tablature, with the tab staff running below the standard staff. Tablature is also common on the Internet, often in ASCII form but also in files that can be read by programs such as Guitar Pro or the Power Tab Editor (the latter is freeware).

Tablatures are not useful for the purposes of explaining music theory because they describe how to play an instrument, that is, the mechanics of producing musical sounds but not the underlying ideas, that is, the expression of certain pitches in a logical rhythmic structure.

Standard notation

 * This is a preliminary version. Standard music notation will probably have its own chapter, in which case only a cursory introduction will remain here.

Standard notation is used to demonstrate how a piece is played. Unlike tablature, it applies to any instrument. It indicates key signatures, time signatures, rhythms, tempo, dynamics (how loud each instrument should be), and so on. A highly trained musician can sometimes take a piece of sheet music written in standard notation, look it over once or twice, and then play the song as though he or she had been playing it his or her whole life.

For instance, below is the C major scale, including a C at the end, in standard notation.

The standard notation staff has five lines and four spaces. From bottom to top the five lines are E G B D F, which is commonly memorized as an acrostic such as:

Every Good Boy Does Fine The four spaces between the five lines are F, A, C, and E, which should surely be easy for an English speaker to remember, because together they spell "face".

But what about the first two notes, which are below the staff? Well, the second note is just below the E, so it must be D. The first is below that, so it must be C. It also has a line through it to indicate it is placed on an "invisible" line. This line is called a ledger line. A note could be placed below this ledger line, which would be B. Or a note could be placed below that, on another ledger line, and it would be A. Notes can continue to be placed on ledger lines above and below the staff infinitely, but extending too far from the staff is impractical, because the pitches will become very hard to read.

Lead Sheet notation
Lead Sheet notation is an abbreviated variant of Standard notation used in jazz and popular music. It consists of a single note melody line on a treble staff, and letter chord symbols. For vocal pieces, lyrics are optional. Standard notation specifies every note exactly as it is to be played. Notation programs such as MuseScore, Sibelius, and Finale, can play standard notation. Lead sheet notation allows -- in fact, requires -- the player to interpret and embellish. A "Fake Book" is a collection of Lead Sheets.

title: Music Theory/Music Notation Systems


text:
Talk:Python Programming/Getting Python

How to expand this book ?
I think we have a nice idea here: Python is a very good teaching medium. In my humble opinion, it can be for object-oriented programming (OOP) what Pascal was for structured programming.

It is very simple and yet has implemented all OOP concepts i ever heard about.

So, i'd like to ask your opinion, dear wikipedians: how to complement this WikiBook so it becomes a full fledged WikiBook and a nice introduction to programming with Python ? -- Hgfernan 12 May 2004

 * I think it needs a lot of work in just about every respect. -- Gherald 15 Aug 2004

Could somebody elaborate on how to get a saved python program? I entered the program in a notepad file. But when I try to get it on the python command line. it says that the : in C:\ is wrong syntax. How do I get the programs? --elpenmaster

You will need to have Python Interpreter on you PATH. It has been a long time since I did this but it should work. Right Click on My Computer and choose Properties. Now look for a button or tab name Enviroment. There should be a Button name Variables that opens up a Dialog Box and on the upper half of the windows the PATH Variable should be present with its value just append at the end ;C:\Python2.5\ --Dragonecc

Unix section
Might it be appropriate to maybe break the unix section down into parts, for example, having a "Debian" section, "Gentoo", "Fedora/Centos/Redhat/RPM", and so on. What do you guys think? - 66.93.220.3 04:20, 30 September 2006 (UTC)

Agree I started with Ubuntu and added the Mac OS X --Dragonecc (talk) 21:21, 7 December 2007 (UTC)

title: Talk:Python Programming/Getting Python


text:
General Mechanics/Motion Under Constraint

So far we've tacitly assumed we can just calculate force as a function of position, set up the ODE

 * $$m\ddot{\mathbf{r}}=\mathbf{F}(\mathbf{r})$$

and start solving.

It is not always so simple.

Often, we have to deal with motion under constraint; a bead sliding on a wire, a ball rolling without slipping, a weight dangling from a string.

There has to be some force keeping the bead on the wire, but we don't know what it is in advance, only what it does. This isn't enough information for us to write down the ODE.

We need a way of solving the problem without knowing the forces in advance.

How easy this is depends on the type of constraint.

 * If the constraint is an inequality, as with the weight on the string, there is no straightforward analytical method.

 * If the constraint can be written as a set of differential equations, and those equations can't be integrated in advance, there is an analytical method, but it is beyond the scope of this book. A ball rolling without slipping falls into this category.

 * If the constraint can be written as a set of algebraic equations, and frictional forces are negligible, there is a straightforward method that solves the problem.

Generalised coordinates
Suppose we have a system of n particles satisfying k constraints of the form

 * $$f_k(\mathbf{r}_1, \cdots, \mathbf{r}_n, t)=0$$

then we can use the constraints to eliminate k of the 3n coordinates of the particles, giving us a new set of 3n-k independent generalised coordinates; q1, q2, … q3n-k.

Unlike the components of the position vectors, these new coordinates will not all be lengths, and will not typically form vectors. They may often be angles.

We now need to work out what Newton's laws will look like in the generalised coordinates.

Derivation
The first step is to eliminate the forces of constraint.

We will need to consider a virtual displacement. This is an infinitesimal displacement made, while holding the forces and constraints constant. It is not the same as the infinitesimal displacement made during an infinitesimal time, since the forces and constraints may change during that time.

 * We write the total force on particle i as
 * $$\mathbf{F}_i=\mathbf{F}^a_i+\mathbf{F}^c_i$$
 * the sum of the externally applied forces and the forces of constraint.

 * Newton's second law states
 * $$\mathbf{F}^a_i+\mathbf{F}^c_i = \mathbf{F}_i=\dot{\mathbf{p}}_i$$

 * We take the dot product of this with the virtual displacement of particle i and sum over all particles.

\sum_i \left(\mathbf{F}^a_i+\mathbf{F}^c_i-\dot{\mathbf{p}}_i \right)\cdot \delta\mathbf{r}_i = 0$$

 * We now assume that the forces of constraint are perpendicular to the virtual displacement. This assumption is generally true in the absence of friction; e.g, the force of constraint that keeps a ball on a surface is normal to the surface.

 * This assumption is called D'Alembert's principle. Using it we can eliminate the forces of constraint from the problem, giving

\sum_i \left(\mathbf{F}^a_i-\dot{\mathbf{p}}_i \right)\cdot \delta\mathbf{r}_i = 0$$
 * or

\sum_i \mathbf{F}^a_i \cdot \delta\mathbf{r}_i = \sum_i \dot{\mathbf{p}}_i \cdot \delta\mathbf{r}_i \quad (1)$$

 * The left hand side of this equation is called the virtual work.

Now we must change to the generalised co-ordinate system.

 * We write
 * $$\mathbf{r}_i=\mathbf{r}_i(q_1, q_2, \cdots ,q_{3n-k}, t)$$

 * Using the chain rule gives
 * $$\mathbf{v}_i=\sum_j \frac{\partial\mathbf{r}_i}{\partial q_j} \dot{q}_j

+ \frac{\partial\mathbf{r}_i}{\partial t}$$
 * and
 * $$\delta\mathbf{r}_i=\sum_j \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j

$$

 * Note that this implies
 * $$\frac{\partial\mathbf{r}_i}{\partial q_j}= \frac{\partial\mathbf{v}_i}{\partial \dot{q}_j} \quad (2)$$

 * The virtual work is, dropping the superscript,
 * $$\begin{matrix}

\sum_i \mathbf{F}_i \cdot \delta\mathbf{r}_i & = & \sum_{i, j} \mathbf{F}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j\\ & = & \sum_j Q_j \delta q_j \end{matrix}$$
 * where the Qj are the components of the generalised force.

We now manipulate the right hand side of (1) into a form comparable with this last equation

 * The right hand side term is
 * $$\begin{matrix}

\sum_i \dot{\mathbf{p}}_i \cdot \delta\mathbf{r}_i & = & \sum_i m_i\ddot{\mathbf{r}}_i \cdot \delta\mathbf{r}_i \\ & = & \sum_{i, j} m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j \end{matrix} $$

 * The terms in the coefficient of qj can be rearranged

 * $$\begin{matrix}

\sum_i m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} & = & \sum_i \left[ \frac{d}{dt} \left( m_i\dot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \right) - m_i\dot{\mathbf{r}}_i \cdot \frac{d}{dt} \left( \frac{\partial\mathbf{r}_i}{\partial q_j} \right) \right] \\ & = & \sum_i \left[ \frac{d}{dt} \left( m_i\mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial \dot{q}_j} \right) - m_i \mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial q_j}\right] \end{matrix}$$

 * on substituting in equation (2) from above

On taking a close look at this last equation, we see a resemblance to the total kinetic energy,
 * $$T=\frac{1}{2}\sum_i m_i v^2_i$$

 * We now further rearrange to get an expression explicitly involving T.

 * $$\begin{matrix}

\sum_i m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} & = & \sum_i \left[ \frac{d}{dt} \left( m_i\mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial \dot{q}_j} \right) - m_i \mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial q_j}\right] \\ & = & \frac{d}{dt} \left( \frac{\partial}{\partial \dot{q}_j} \frac{1}{2} \sum_i m_i v^2_i \right) - \frac{\partial}{\partial q_j}\frac{1}{2} \sum_i m_i v^2_i  \\ & = & \frac{d}{dt} \left( \frac{\partial}{\partial \dot{q}_j} T \right) - \frac{\partial}{\partial q_j} T \end{matrix}$$

Putting this last expression into (1) along with the generalised force give

\sum_j \left[ \frac{d}{dt} \left( \frac{\partial T}{\partial \dot{q}_j} \right) - \frac{\partial T}{\partial q_j} -Q_j \right] \delta q_j = 0 $$

Since the δqj, unlike the δri, are independent, this last equation can only be true if all the coefficients vanish.

That is we must have

 * $$ \frac{d}{dt} \frac{\partial T}{\partial \dot{q}_j}

- \frac{\partial T}{\partial q_j} = Q_j \quad (3)$$

These are the equations of motion for the system, in a general set of coordinates for which all constraints are automatically satisfied.

For example, suppose we have a cylinder, mass m, radius a, rolling without slipping on a flat plane.

The kinetic energy of the cylinder is

 * $$T=\frac{1}{2}m \dot{x}^2 + \frac{1}{8}ma^2 \dot{\theta}^2 $$

using the results from Rigid Bodies, where x is the axis in the plane perpendicular to the axis of the cylinder, and θ is the angle of rotation.

Rolling without slipping implies
 * $$\dot{x}=a\dot{\theta}$$

so we get

 * $$T=\frac{5}{8}m\dot{x}^2 \quad \frac{5}{4}m\ddot{x}=Q_x$$

The cylinder has the same kinetic energy as if its mass were 20% greater. If there is no torque on the cylinder then Qx=Fx, and the cylinder behaves in every respect as though it were a 20% larger point mass.

To use (3) more generally, we need an expression for the Qj

Suppose, as is often the case, that
 * $$\mathbf{F}_i=-\frac{\partial}{\partial \mathbf{r}_i} V$$

then, by definition

 * $$\begin{matrix}

\sum_j Q_j \delta q_j & = & \sum_i \mathbf{F}_i \cdot \delta\mathbf{r}_i \\ & = & \sum_{i, j} \mathbf{F}_i \cdot \frac{\partial \mathbf{r}_i}{\partial q_j} \delta q_j \\ & = & -\sum_{i, j} \frac{\partial V}{\partial \mathbf{r}_i} \frac{\partial \mathbf{r}_i}{\partial q_j} \delta q_j \\ & = & -\sum_j \frac{\partial V}{\partial q_j} \delta q_j \end{matrix}$$

so, equating coefficients, the generalised force is

 * $$Q_j=-\frac{\partial V}{\partial q_j}$$

Putting this generalised force into (3) gives

 * $$ \frac{d}{dt} \frac{\partial (T-V)}{\partial \dot{q}_j}

- \frac{\partial (T-V)}{\partial q_j} = 0$$

since V has been assumed independent of the velocities.

In fact, this last equation will still be true for some velocity dependent forces, most notably magnetism, for a suitable definition of V, but we won't prove this here.

We call the T-V the Lagrangian, L, and write
 * $$ \frac{d}{dt} \frac{\partial L}{\partial \dot{q}_j}

- \frac{\partial L}{\partial q_j} = 0$$

We call these equations Lagrange's equations. They are useful whenever Cartesian co-ordinates are inconvenient, including motion under constraint.

Example
Suppose we have two identical point masses, m, connected by a string, length a. The string is threaded through an hole in a flat table so that the upper mass is moving in a horizontal plane without friction, and the lower mass is always vertically below the hole. The distance of the upper mass from the hole is r.

The position of the mass on the table is best described using polar coordinates, (r,θ). Its kinetic energy is then

 * $$\frac{1}{2}m \left( \dot{r}^2+r^2 \dot{\theta}^2 \right) $$

The velocity of the lower mass is d(a-r)/dt=-dr/dt, so the total kinetic energy is

 * $$T= \frac{1}{2}m \left( 2\dot{r}^2+r^2 \dot{\theta}^2 \right) $$

The potential energy is

 * $$V = mg(a-r)$$

where g is the gravitational acceleration.

This means

 * $$L = \frac{1}{2}m \left( 2\dot{r}^2+r^2 \dot{\theta}^2 \right) +mg(r-a)$$

and the equations of motion are

 * $$\begin{matrix}

\frac{d}{dt} \frac{\partial L}{\partial \dot{\theta}} - \frac{\partial L}{\partial \theta} & = & m\frac{d}{dt}\left( r^2 \dot{\theta}\right) & = & 0 \\ \frac{d}{dt} \frac{\partial L}{\partial \dot{r}} - \frac{\partial L}{\partial r} & = & 2m\ddot{r}-mr\dot{\theta}^2+mg & = & 0\end{matrix}$$

The first of these equations says that the angular momentum is constant, as expected since there is no torque on the particles. If we call this constant angular momentum l then we can write

 * $$\dot{\theta}=\frac{l}{mr^2}$$

and the second equation of motion becomes

 * $$\ddot{r}=\frac{l^2}{2m^2r^3}-\frac{g}{2}$$

Clearly, if initially
 * $$l^2>g m^2 r^3, \,$$

then the lower ball will be pulled out of the hole, at which point these equations of motions cease to apply. They only hold when 0≤r≤a, a constraint which is not easily tamable.

Notice, we have not needed to calculate the tension in the string, which is the force of constraint in this problem.


text:
Phoenix

Phoenix is a shoot-em-up game for many systems including Texas Instruments calculators. This guide deals with the TI-83+ version.

To win the game, you must beat a certain number of levels. Most players accomplish this by killing everything as fast as they can, and upgrading shields at every opportunity...a strategy was devised by Kevin Yang, for players of intermediate skill to beat it. It consists of the following order.

Beating levels 1-4 with at least 1/5 of your shields remaining for level 5. You do not buy any weapons, upgrades, or shields. There is an option where you can buy weapon 2 to help you out, however, that could result in failure of the strategy. If all goes well, you should have accumulated enough money by the end of level 4 to buy the 5th weapon. Without dying, you must beat level 5 and upgrade your shields afterwards.

Game Concepts

 * /High Scores/
 * /Weapon 1/ (you start with this weapon)

/Shop/

 * /Shield+/
 * /Weapon 2/
 * Wingman (Helper)
 * /Upgrade/
 * /Weapon 3/
 * /Weapon 4/
 * /Weapon 5/

Enemies

 * /Enemy 1/
 * /Enemy 2/
 * /Enemy 3/
 * /Enemy 4/
 * /Enemy 5/
 * /Enemy 6/
 * /Enemy 7/
 * /Enemy 8/
 * /Enemy 9/
 * /Enemy 10/
 * /Enemy 11/

 * /Boss 1/
 * /Boss 2/
 * /Boss 3/

 * /Special Enemy/

Levels
Level 1- 2 series of enemies followed by a boss. First two series have 6 columns and 3 rows of enemies. The enemies fire straight down. Each enemy can be killed with two shots. The boss only one row of enemies. Behind them is a boss that scrolls from side to side and shoots in your ships direction.

title: Phoenix


text:
Music Theory/Complete List of Chord Patterns

A Major scale has 7 different notes and then ends back on 1, making a total of 8 notes. Each note in the scale is called a scale degree. Each scale degree represents a potential chord. The scale degrees are numbered with Roman numerals so that you can use upper and lower case letters. Upper case represents a Major chord, lower case are minor chords, and lower case with a little circle in the upper righthand corner of the Roman numeral is diminished. In western music chords are traditionally built by using every other note beginning on each scale degree - giving you a choice of 7 diatonic chords in a Major scale.

The formula to make a Major scale is the same for every single Major key. The I, IV, and V are the only major chords in a traditional major scale. The remaining chords are minor with the exception of the 7th which is diminished. The scale numbers would look like this I ii iii IV V (the 5th should have lines above to show its Major) vi vii(o) I. For example in the key of C the scale would be CDEFGABC. Since triad chords are built by using every other note from the one you begin on - a C Major chord would be CEG. The 1st note (in this case C) is called the root, after that you count steps away, starting with C - making the 3rd E. G is then 5 steps away from the root (C) making it the 5th. You can keep extending chords making 6th, 7th, 9th, 11th, 13th chords, and sus4 chords. Since every Major scale has the same formula this can make transposition fairly easy because if you recognize a piece of music is playing a I chord or any other degree of chord from your original key to transpose all you would need to play is the same chord degree in the new key you desire. You also need to know that you can raise and lower notes if desired in the chords you’re writing. If you see a C7#9 it means you raise the 9th a half step.

This is one of the chord trees that will aid in the writing and analysis of music. You can move down the tree but you may not retrograde (go backwards) until reaching the bottom. There are, of course exceptions including cadencing using the IV to I which is called the Amen cadence because of its use in older church hymns. At the end of a hymn people would sing Amen from the IV to I. A good example of a song that uses an amen cadence is ”Let it be” by the Beatles (Amen means let it be!). Moving from a V to vi chord is called a deceptive cadence because traditional western music is usually a battle between the Major V and Major I. You may think of the I of a scale (also called the tonic) as home and the V (also known as the dominant chord) as the car that drives you back home. All chords that have a number immediately after the letter are actually dominant chords with added notes. Dominant chords contain a major triad with a minor 7th. If they are not dominant they will say something like G Maj7 which has a dreamy feel but in the key of C - G is dominant so its notated G7. A G9, G11,or G13 all can be used as a dominant chord. All dominant chords must contain a seventh, though it is possible to leave out the 5th from extended chords such as 13th chords. The I chord is your musical home but you may go other places during your journey but you usually drive back home using the V (the car of the key) to get there. If you end your phrase or piece using V to a vi chord this is also (see above) called a deceptive cadence (or ending. This is because the Major 5th makes you feel like you are going home to your happy home the I chord but instead you land on a minor chord which will sound sad but still complete.

You may move across the degrees and interchange the chords or can skip degrees entirely if so desired but here is a nice chord progression: Example- I, IV, ii, V, I, vi, ii, V, I) A good key to practice it in would be C because there are no sharps or flats to remember but you can do it in ANY major key. In C this Progression would be C Maj, F Maj, D minor, G major, C Maj, A minor, D minor, G Major, and back home to C Maj.

I IV  ii  V  I  vi  ii  V  I

In the key of C
 * I: C Maj
 * vi - iii: A minor to E minor
 * IV - ii: F Major to D minor
 * V - vii°: (vii° the little circle at the end means diminished) these chords can also be notated as G Major to Bmin♭5 (Minor flat 5 chords are the jazz notation for diminished)

Note numbers in parentheses are optional:

Dominant/Seventh
Normal

The dominant seventh is sometimes just called the "seventh", even though it contains a minor seventh and not a major seventh.

Altered

Suspended

Any chord with a major third can have the third replaced by a major second or perfect fourth to form a suspended chord. Given a chord C, this would be written Csus2 ("C suspended second") and Csus4 ("C suspended fourth") for a major chord. As these only apply to the major second and perfect fourth, there is no such thing as, say, a Csus6, which would probably be properly written as Gsus4/C or C5add6 if it has a fifth, or else Am/C. However, in certain circles it is thought that replacing the fifth in a triad with a sixth is a type of suspension, eg Csus6 would contain C, E and A, rather like an Am. This is however more accurately notated as C6.

Minor
Normal

Diminished

Notice the diminished seventh chord has a double-flatted seventh, which is enharmonically the same as a sixth, so you may find the diminished chord alternately written as "1 ♭3 ♭5 6". The double-flat notation is more correct because it shows how the seventh is further diminished from the half-diminished state.

Sometimes a diminished seventh chord is notated the same way as a diminished triad. Even more confusingly, sometimes both forms are called the "diminished chord"! You can make the distinction between the two to avoid ambiguity. However, keep in mind that they're ultimately very similar chords anyways, and you can usually interchange them.

Other
It's worth mentioning that you might hear some individuals (usually rock guitarists) call fifth chords 'power chords'.

9th, 11th, and 13th chords
7th chords can be extended to 9th, 11th and 13th chords. If you have a C7 (C dominant seventh), then the corresponding chords would be C9, C11 and C13. The C9 is a C7 with a major ninth (or second) added. The C11 is a C7 with an eleventh (or perfect fourth) added as well as the major ninth. The C13 is a C7 with a major thirteenth (or sixth) added as well as the major eleventh and major ninth added.

The same principles that can be applied to seventh chords apply to minor and major 7th chords. For instance, you can have a minor 13th: 1 ♭3 (5) ♭7 9 11 13. The notes added are always the same: ninth, eleventh, and/or thirteenth, not augmented or diminished. Only the seventh chord base changes.

It is very uncommon to extend a major 7th chord with an 11th. This is because there would be an interval of a minor ninth between the third and the eleventh. If an eleventh is played, it is usually altered (this is dealt with below).

Additions
When a note is added to these chords in a manner that does not fit the tables above, it is often written "addX", where X is the number of the added note, e.g., add6 for an added sixth. For instance, C major with an added sixth would usually be written Cadd6. If the number is above 7, then it will be an octave higher than the root note.

Do not confuse Csus2 and Cadd2, or Csus4 and Cadd4. Suspended chords must not have a major third, but major chords with additions must. (Note that in jazz, suspended chords sometimes have a major third added, but only when the player wants dissonance).

Do not confuse Cadd9 with C9; the latter has a minor seventh, but the former does not.

An "added second" and "added ninth" are often considered synonymous, because a ninth is a second. Some musicians argue they imply different voicings of the chords, for instance, add9 should have the second raised an octave, but add2 should not. The "added ninth" is more common, especially since it is rare that one wants to add a major second that is literally one whole tone away from the first (and possibly a third as well).

The 9th here is what is often referred to as a compound interval, that being an interval greater than an octave, such as a 9th being an octave up from a 2nd, a minor 10th being an octave up from a minor 3rd... Greater intervals, e.g. a minor 17th, theoretically exist (this being a minor 3rd raised 2 octaves) but such things above a modification of a 13th are never spoken of. To create a compound interval one would add 7 (once for every octave) raised to the number in the name to raise the interval. The same applies subtracting seven to lower the pitch by octaves.

Alterations
Sometimes something such as "♭5" or "♯5" (also written "-5" and "+5", respectively) will be appended to the end of the chord; this means play the chord as normal but flatten or sharpen the fifth respectively. (This is why Cø is sometimes written Cm7♭5, because a minor 7th with a flatted fifth has the same notes as a half-diminished chord. Similarly, it may also be pronounced "C minor seventh flat five".)

Any of the extension notes (9th, 11th and 13th) can also be altered, something fairly common in jazz. The possible alterations are ♭9, ♯9, ♯11 and ♭13. You may be wondering why there is no ♭11 or ♯13. Stop and think for a second about which notes they would be in the key of C major. The ♭11 would be E, which is the major third in C, and the ♯13 would be B♭, the minor 7th, so a chord symbol like C ♭11 ♯13 would imply C7. Which would you rather read?

The table below shows common altered chords:

The names in brackets after the full name refer to the mode from which the chord is derived (there should be a section on this eventually).

Bass notes
The bass note of a chord is the lowest note of the chord. The most common case is that the bass note is the root note, for instance, in a C major chord C-E-G ascending in pitch from left to right, the bass note is C, which is the root note. But if the chord were instead G-C-E, it is still a C major chord (specifically, an inverted C major), but G is the bass note, while C is still the root note. Sometimes the bass note is omitted for brevity when it is still a part of the chord, which may be needed, for instance, when many rapid chord changes would otherwise make the names illegible on a printed score.

Occasionally, bass notes are not a part of the original chord. For instance, a D minor does not have a C note, but sometimes Dm/C is seen, meaning the D minor chord is played normally but with a C note below it. These are often called slash chords.

This notation can also indicate a polychord.

Polychords
Polychords are superimposed chords. They are more common in some kinds of music (jazz) than others (classical).

This may occur, for instance, when a piano player plays a D minor with the left hand (possibly omitting its fifth) and a G major with the right hand. The most common notation for a polychord is $upper chord⁄lower chord$, for example: $G⁄Dm$ (D–F–A—G–B–D). In case a very specific voicing is needed, the individual chords can be written in their desired inversions, for example: $E♭m/G♭⁄Cdrop2$ (C–G–E—G♭–B♭–E♭).

A common use of polychords is arpeggiating one chord against a different chord. For instance, on a piano, the left hand may be holding down a G5 chord while the right hand arpeggiates D minor chords. This would be notated Dm/G.

Polychords might be used as exotic voicings for many chords. The following examples use a pipe (|) to separate the upper chord from the lower one. (the examples are given here for a C chord)

Quartal chords
Some arrangements use chords based on fourths, often two fourths in the upper notes with an independent bass, which gives the following possibilities:

Of course, the fourths part of the chord can be present in two other inversions - sus4 or sus2, making B♭7sus4/C, Ebsus4/C and Absus2/C equivalent for instance.

Chord implication
Sometimes chords are not specifically indicated by notes, but are indicated by the chord structure, or even notes that don't form chords by themselves but sound like they belong to a certain chord. The most usual way to handle this is to put the chord name in parentheses. Implied chords are also often used when there are constant chord changes throughout a section (several per measure), and marking each one would make little sense, so the "underlying" chord is chosen (usually a chord the others are temporarily centered around). Sometimes sheet music will use only implied chords, in which case often chord names will appear normally, and perhaps a footnote will state something such as "chords reflect implied harmony".


text:
Talk:Physics with Calculus/Mechanics/Energy and Conservation of Energy

What is the source of 1st law of thermodynamics ? When was the conservation of energy principle first espoused ? What is the motivation for this ?

Physics symbols
Could someone change this page an possibly others to make: - kinetic energy represented by K, and not KE - potential energy represented by U, and not PE

Potential energy can have a subscript to indicate the type, for example gravitational potential energy $$U_g$$

Update: Ok, I just changed it myself. Looks much better now, IMO.

Jeff.


text:
Talk:Electronics/Component Identification

What are your thoughts on diagrams being in the book, like the ones I drew? Are they good depictions or not as really?


text:
Music Theory/Scales and Intervals

A musical scale is a set of notes, usually not arbitrary, of which most notes in a piece of music might be chosen. There exist many scales with highly distinctive sounds, though some are much more common than others. the term "scale" comes from the latin word 'scala' meaning 'ladder'. Thus a scale is a ladder of notes.

Simple intervals
Before we progress, we must discuss music intervals. An interval in music is usually defined as the distance between two notes, pitches or tones that is, how many semitones lie between them. When the two pitches are the same, they are said to be in unison, and two notes played in unison can be impossible to distinguish from a single note when they are played by the same instrument and the instrument is properly tuned. When they are twelve semitones apart, they are an octave apart (we will learn why it is called an octave shortly). Simple intervals are defined as those intervals that are one octave or less apart.

Intervals are usually named according to the relationship of the higher note to the lower note in the major scale, though they also have alternative names depending upon the spelling of the particular notes on the page of music.

This table gives the most common nomenclature for each interval according to its relation to the major scale. For example, the interval of four semitones occurs as the third note of the major scale, and thus it is called a major third. The interval of seven semitones occurs as the fifth note of the major scale, and so it is called a perfect fifth. Whether an interval is "perfect" or "major" depends on mathematical ratios of frequencies as determined by the Greeks. Other possible names are given under "alternate names," and the most common of these are emboldened. One may draw several inferences from this table:

 * 1) If any perfect interval is raised by one semitone, the interval becomes augmented
 * 2) If any perfect interval is lowered by one semitone, the interval becomes diminished
 * 3) If any major interval is raised by one semitone, the interval becomes augmented
 * 4) If any major interval is lowered by one semitone, the interval becomes minor
 * 5) If any major interval is lowered by two semitones, the interval becomes diminished

Compound intervals
Compound intervals are defined as those intervals greater than one octave apart. These intervals may be considered by exactly the same rules as their simple counterparts.

The compound intervals work by following the same five rules as the simple intervals above (so the augmented eleventh might also be called a diminished twelfth!). Why even bother giving them separate names? The answer lies in their normal function within music. Complex jazz chords are built around stacks of thirds, and so the terms "ninth," "eleventh," and "thirteenth" are needed to designate intervals larger than a seventh.

Mnemonic memorization examples
The following chart intends to give some mnemonic support in recognising musical interval. For each interval, ascending or descending, a popular song is given that contains it prominently. Capitalized syllables or a ">" mark the stated interval: Trainear is an online ear trainer that's specifically for associating intervals to songs. Here are some examples for each interval:

Here is a graphic interpretation of intervals. Major count down from the top. Minor count up from the bottom. Naming starts top to bottom.

The major scale
The major scale is a diatonic scale. Originally a Church mode named by Heinrich Glarean in 1547 as the Ionian scale/mode. There is some confusion with beginners as to why the Church modes are named after Greek tribes. A common belief is that the Ionian scale was invented by the Greeks. The Ancient Greeks did not have an Ionian scale but they did lay the foundation for its existence. The Ancient Greeks did have a system of music and we know quite a lot about their music theories from the Ancient Greeks themselves. The real origin of the Ionian mode is the period known as the Renaissance which started in Italy with the 13th century writer Petrach. Renaissance is the French word for "rebirth". The "rebirth" in this case was the rediscovery of lost Ancient Greek texts that had been brought back from the East (including Jerusalem) by Crusaders and other parties. A lot of these books had been unavailable in Western Europe for centuries. These books sparked a desire to rediscover the roots of European civilization. The Renaissance scholars took the music practices of their time which already had been in use for hundreds of years and codified them in reference to the Greeks. You can read about the Ancient Greek system of tetrachords and scales if you're interested. It must be pointed out that we have no idea about the sounds of the instruments of the Ancient Greeks and only a few fragments of music exists. It is now believed that the Church modes are derived from early Christian mass chants which themselves were adapted from Jewish chants. It may be that modern Western Music has for its origins Eastern Jewish liturgical chants and Ancient Greek theories codified from the view of a Renaissance mindset a thousand years later.

The major scale (Ionian mode) is most simply described as the eight note progression consisting of the perfect and major semitiones, i.e., perfect unison, major 2nd, major 3rd, perfect 4th, perfect 5th, major 6th, major 7th, and perfect octave in that order. You have already seen the major scale: C D E F G A B; do re mi fa sol la ti; 1 2 3 4 5 6 7. Scales may be constructed according to their intervals. You can see that the C major scale consists of two whole tones, then a semitone (moving from E to F), then three more whole tones, then again a semitone (moving from B back to C). If we add the implied C at the end of the scale, we would have eight notes: C D E F G A B C.

The minor scale
The minor scale, the Aeolian mode, is also a diatonic scale. The C minor scale is C D E♭ F G A♭ B♭; 1 2 ♭3 4 5 ♭6 ♭7. You can see that it consists of one whole tone, then a semitone (moving from D to E♭), then two more whole tones, then again a semitone (moving from G to A♭), and a final whole tone. If we add the implied C at the end of the scale, we would have eight notes: C D E♭ F G A♭ B♭ C.

The intervals of the natural minor scale follow the following pattern: tone, semitone, tone, tone, semitone, tone, tone. The following chart demonstrates this natural minor scale construction.

The minor scale is the sixth mode of the major scale; that is, the minor scale starts on the 6th note of the relative major scale. In the case of the C minor scale, the relative major scale is E♭ major. We can illustrate this with two octaves of the Eb major scale, highlighting the C minor scale. E♭ F G A♭ B♭ C D E♭ F G A♭ B♭ C D E♭. You will learn more about modes later.

The pentatonic scales
A pentatonic scale has five notes. Each note in the major pentatonic scale is a fifth (seven semitones) relative to another note. For example, the C major pentatonic scale starts with C, then from there we can get G, then D, then A, then E. Rearranging the scale to ascending order from C, we get: C D E G A. This is the C major scale with F and B removed! So, why use it? Sometimes less is more, and pentatonic scales are certainly easier to use when improvising.

The major pentatonic is the same as the major scale with the 4 and 7 notes removed, while the minor pentatonic has the 2 and ♭6 notes removed, that is, the minor pentatonic is relative to the major pentatonic.

So, to use our earlier example contrasting the E♭ major pentatonic with the C minor pentatonic: E♭ F G B♭ C E♭ F G B♭ C E♭.

Pentatonic scales are abundant in rock and blues music, though these are certainly not their only uses. Traditional Chinese and Japanese music has defined and named many more pentatonic scales, some of which do not use the western twelve-note basis.

The blues scale
The most common blues scale has six notes, and may be considered a minor Pentatonic scale with the diminished fifth added as a blue note. In a major blues tune, the minor third is also considered a blue note.

Therefore, the C blues scale is: C E♭ F G♭ G B♭. Sometimes the raised seventh degree (B) is added to this scale but most often used as a passing note, much like the diminished fifth. The blues scale is most commonly used in jazz improvisation to create a "bluesy" flavor.

The Symmetric Scales
Symmetric scales include scales such as the whole-tone scale, octatonic scale (also called the diminished scale), and chromatic scale, and their defining characteristic is that they are composed of repeating subunits within an octave. This property allows these scales to be transposed to another pitch (or "key"), yet retain exactly the same notes as the original scale.

The chromatic scale
The simplest of the symmetric scales, the chromatic scale, is composed of repeating semitones (half-steps). Thus, the chromatic scale built on C contains the notes C,D♭,D,E♭,E,F,G♭,G,A♭,A,B♭, and B. The chromatic scale built on D♭ contains the notes D♭,D,E♭,E,F,G♭,G,A♭,A,B♭,B, and C.  Notice that these are exactly the same notes as the chromatic scale built on C.  In fact, a chromatic scale built on any note of the twelve-tone western music scale will share these notes, a property which warrants the inclusion of this scale among the symmetrics. Usually chromatic scales are spelled with sharps when ascending and flats when descending.

As noted above, composers will often choose certain notes from this scale to use more frequently than others, thereby providing the listener with a sense of a "home" note, referred to as the tonic. However, many composers in the twentieth century have demonstrated that using all twelve chromatic notes equally can defeat any sense of tonal center. This technique is called atonality or, less commonly, pantonality, and can have a very unsettling effect upon those unaccustomed to this music. An everyday occurrence of atonal music would be in the soundtracks to many horror films, documentaries, or other movies where there is a need for extreme dissonance and tension to match the onscreen action.

The whole-tone scale
The whole-tone scale is made of repeating whole tones (whole-steps). Therefore, a whole-tone scale built upon D♭ would contain D♭,E♭,F,G,A, and B. Like the chromatic scale, these pitches are the same pitches that one would find in a whole-tone scale built upon E♭, or any of the pitches in this particular scale. For instance, a whole-tone scale built upon F would be F,G,A,B,D♭,E♭, and a whole-tone scale built on B would be B,C♯,D♯,F,G,A. These two are really the same scale, since C♯=D♭ and D♯=E♭. For this reason, there exist only two possible whole-tone scales:
 * 1) the scale including the pitches C,D,E,F♯,G♯, and A♯
 * 2) the scale including the pitches D♭,E♭,F,G,A, and B.

Any whole-tone scale within the western musical system will fall enharmonically into one of these two categories.

The whole-tone scale was used widely by impressionists to create a floating, ethereal sound. The scale also finds a place in jazz improvisation, as it is among the most colorful scales to use where a raised-fifth scale degree is indicated. Incidentally, the scale contains all of the notes of two augmented chords placed side-by-side, a whole step apart.

The octatonic (diminished) scale
The octatonic, or diminished, scale is among the simplest scales possible, yet has been used to tremendous effect in nearly every genre. This eight-note scale may be conceived in two manners, but both of the approaches use a repeating subunit of alternating whole-steps and half-steps. The first manner, most often used by classical composers and termed diminished, encourages beginning with a whole-step, while the second, used frequently by jazz players and composers who call it octatonic, encourages starting with the half-step. Beginning from C (using the second method), the octatonic scale would include the notes C,D♭,E♭,E,F♯,G,A, and B♭. As with the other symmetric scales, this scale may be moved to a different starting note yet retain the same pitches as the original. Thus, E♭,E,F♯,G,A,B♭,C,D♭ is an octatonic scale (second method) that shares all eight pitches with the octatonic scale starting on C. There are, then, three different octatonic scales possible:

 * C,D♭,E♭,E,F♯,G,A, and B♭
 * C♯,D,E,F,G,A♭,B♭, and B
 * D,E♭,F,G♭,A♭,A,B, and C

Any other octatonic scales within the western system will fall enharmonically into one of these three groups.

The use of the octatonic scale in western music can be seen as early as Bach, who used pieces of the scale within his counterpoint to imply diminished harmony. Modern composers of the classical canon use this scale as a colorful alternative to redundant diatonicism or austere chromaticism. Jazz improvisers often turn to the diminished scale to improvise over a dominant seventh harmony to imply the flat-ninth degree of a chord. The octatonic/diminished scale is extremely versatile: a single octatonic scale (C,D♭,E♭,E,F♯,G,A, and B♭ contains the notes of four dominant-seventh chords (C,E,G,B♭; E♭,G,B♭,D♭; F♯,A♯,C♯,E; and A,C♯,E,G), two fully-diminished-seventh chords (C,E♭,G♭,B♭♭ and C♯,E,G,B♭), and a plethora of major, minor, and diminished chords.

Other "theoretical" symmetric scales
Other collections of pitches may be considered "symmetric scales," even though they are not often used as such. The fully-diminished-seventh chord is made up of repeating subunits of minor thirds (three semitones), and there are three distinct pitch collections:

 * C,E♭,G♭,B♭♭ (=A)
 * C♯,E,G,B♭
 * D,F,A♭,C♭

Any other fully-diminished seventh chords are enharmonically equivalent to one of these three collections.

The augmented chord is made of repeating subunits of major thirds (four semitones), and there are four distinct collections:

 * C,E,G♯
 * D♭,F,A
 * D,F♯,A♯
 * E♭,G,B

Any other augmented chords are enharmonically equivalent to one of these four collections.

Finally, the interval of a tritone (diminished fifth, augmented fourth, or six semitones) may be considered with the symmetric scales because there are only six distinct varieties using the subunit of a tritone. A tritone beginning on C (C,F♯) has the same pitches as a tritone beginning on F♯ (F♯,C)

title: Music Theory/Scales and Intervals