(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. The data for the notebook 
starts with the line containing stars above.

To get the notebook into a Mathematica-compatible application, do one of 
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the 
word CacheID, otherwise Mathematica-compatible applications may try to 
use invalid cache data.

For more information on notebooks and Mathematica-compatible 
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info@wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from 
Wolfram Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[     23486,        597]*)
(*NotebookOutlinePosition[     29697,        787]*)
(*  CellTagsIndexPosition[     29153,        761]*)
(*WindowFrame->Normal*)



Notebook[{
Cell[TextData[{
  "Miscellaneous",
  StyleBox["`", "MB"],
  "CityData",
  StyleBox["`", "MB"]
}], "Subsection",
  CellTags->{"S5.55.1", "1.1"}],

Cell[TextData[{
  StyleBox["Mathematica", "TI"],
  "'s programming capabilities allow you to create powerful customized tools. \
In this package, one approach to a sample database is used. This database, \
containing information about cities, is expandable and can be used with other \
functions. "
}], "Text",
  CellTags->{"S5.55.1", "1.2"}],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityData[\\\\\\\"\\\", \\\
\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\
\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\\(\\*StyleBox[\\\
\"\\\\\\\"datatype\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"]\
\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>", 
                  
                  RowBox[{"\<\"give data from the \
\[OpenCurlyDoubleQuote]field\[CloseCurlyDoubleQuote] \"\>", 
                    StyleBox[\(d  a  t  a  t  y  p  e\),
                      "InlineFormula"], "\<\" about the named city\"\>"}]},
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityData[\\\\\\\"\\\", \\\
\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\
\\(\\*StyleBox[\\\"\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>", 
                  
                  RowBox[{"\<\"give a list of \
\[OpenCurlyDoubleQuote]fieldnames\[CloseCurlyDoubleQuote] and their \
corresponding values for \"\>", 
                    StyleBox[\(c  i  t  y\),
                      "InlineFormula"]}]},
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityData[\\\\\\\"\\\", \\\
\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"datatype\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \
\"\>", \("give a list of the cities in the database with information in this \
\[OpenCurlyDoubleQuote]field\[CloseCurlyDoubleQuote]"\)}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.55.1", "1.3"}],

Cell[TextData[{
  "Accessing the ",
  StyleBox["CityData", "MR"],
  " database. "
}], "Caption",
  CellTags->"S5.55.1"],

Cell[TextData[{
  "The database currently contains only position location for a number of \
cities around the world. Positions are stored as latitudes and longitudes in \
a ",
  Cell[BoxData[
      \(TraditionalForm\`{\)], "InlineFormula"],
  StyleBox["degree", "TI"],
  StyleBox[",", "MR"],
  " ",
  StyleBox["minute", "TI"],
  StyleBox[",", "MR"],
  " ",
  StyleBox["second", "TI"],
  Cell[BoxData[
      \(TraditionalForm\`}\)], "InlineFormula"],
  " or ",
  Cell[BoxData[
      \(TraditionalForm\`{\)], "InlineFormula"],
  StyleBox["degree", "TI"],
  StyleBox[",", "MR"],
  " ",
  StyleBox["minute", "TI"],
  Cell[BoxData[
      \(TraditionalForm\`}\)], "InlineFormula"],
  " format. "
}], "Text",
  CellTags->{"S5.55.1", "1.4"}],

Cell["This loads the package. ", "MathCaption",
  CellTags->{"S5.55.1", "1.5"}],

Cell["<< Miscellaneous`CityData`", "Input",
  CellLabel->"In[1]:= ",
  CellTags->"S5.55.1"],

Cell["This gives the latitude and longitude of Montreal. ", "MathCaption",
  CellTags->{"S5.55.1", "1.6"}],

Cell[CellGroupData[{

Cell["CityData[\"Montreal\", CityPosition]", "Input",
  CellLabel->"In[2]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \({{45, 30}, {\(-73\), \(-36\)}}\)], "Output",
  CellLabel->"Out[2]= ",
  CellTags->"S5.55.1"]
}, Open  ]],

Cell["\<\
This returns the information in the database about Washington. \
\
\>", "MathCaption",
  CellTags->{"S5.55.1", "1.7"}],

Cell[CellGroupData[{

Cell["CityData[\"Washington\"]", "Input",
  CellLabel->"In[3]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \({{CityPosition, {{38, 53, 
            42}, {\(-77\), \(-2\), \(-12\)}}}}\)], "Output",
  CellLabel->"Out[3]= ",
  CellTags->"S5.55.1"]
}, Open  ]],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {"\<\"Abidjan, Ivory Coast\"\>", "\<\"Abu Dhabi, UAE\"\>"},
                {"\<\"Accra, Ghana\"\>", "\<\"Addis Ababa, Ethiopia\"\>"},
                {"\<\"Aden, Yemen\"\>", "\<\"Agana, USA, GU\"\>"},
                {"\<\"Algiers, Algeria\"\>", "\<\"Alma Alta, \
Kazakhstan\"\>"},
                {"\<\"Amman, Jordan\"\>", "\<\"Amsterdam, Netherlands\"\>"},
                {"\<\"Anchorage, USA, AK\"\>", "\<\"Andorre\[Hyphen]la\
\[Hyphen]Vella, Andorra\"\>"},
                {"\<\"Ankara, Turkey\"\>", "\<\"Antananarivo, \
Madagascar\"\>"},
                {"\<\"Apia, Western Samoa\"\>", "\<\"Ashkhabad, \
Turkmenistan\"\>"},
                {"\<\"Asmera, Eritrea\"\>", "\<\"Asuncion, Paraguay\"\>"},
                {"\<\"Athens, Greece\"\>", "\<\"Atlanta, USA, GA\"\>"},
                {"\<\"Baghdad, Iraq\"\>", "\<\"Baku, Azerbaijan\"\>"},
                {"\<\"Bamako, Mali\"\>", "\<\"Bandar Seri Begawan, \
Brunei\"\>"},
                {"\<\"Bangkok, Thailand\"\>", "\<\"Bangui, Central African \
Republic\"\>"},
                {"\<\"Banjul, The Gambia\"\>", "\<\"Basse\[Hyphen]Terre, \
Guadeloupe\"\>"},
                {\("Basseterre, St. Christopher\[Hyphen] Nevis"\), \
"\<\"Beijing, China\"\>"},
                {"\<\"Beirut, Lebanon\"\>", "\<\"Belgrade, Yugoslavia\"\>"},
                {"\<\"Belmopan, Belize\"\>", "\<\"Beograd, Serbia\"\>"},
                {"\<\"Berlin, Germany\"\>", "\<\"Bern, Switzerland\"\>"},
                {"\<\"Bishkek, Kirghizia\"\>", "\<\"Bissau, \
Guinea\[Hyphen]Bissau\"\>"},
                {"\<\"Bogota, Colombia\"\>", "\<\"Bombay, India\"\>"},
                {"\<\"Bonn, Germany\"\>", "\<\"Boston, USA, MA\"\>"},
                {"\<\"Brasilia, Brazil\"\>", "\<\"Bratislava, Slovak Republic\
\"\>"},
                {"\<\"Brazzaville, Congo\"\>", "\<\"Bridgetown, \
Barbados\"\>"},
                {"\<\"Brussels, Belgium\"\>", "\<\"Bucharest, Romania\"\>"},
                {"\<\"Budapest, Hungary\"\>", "\<\"Buenos Aires, \
Argentina\"\>"},
                {"\<\"Bujumbura, Burundi\"\>", "\<\"Cairo, Egypt\"\>"},
                {"\<\"Calcutta, India\"\>", "\<\"Canberra, Australia\"\>"},
                {"\<\"Cape Town, South Africa\"\>", "\<\"Caracas, Venezuela\"\
\>"},
                {"\<\"Cardiff, United Kingdom\"\>", "\<\"Castries, St. \
Lucia\"\>"},
                {"\<\"Cayenne, French Guiana\"\>", "\<\"Charlotte Amalie, \
USA, VI\"\>"},
                {"\<\"Chicago, USA, IL\"\>", "\<\"Colombo, Sri Lanka\"\>"},
                {"\<\"Conakry, Guinea\"\>", "\<\"Copenhagen, Denmark\"\>"},
                {"\<\"Cupertino, USA, CA\"\>", "\<\"Dacca, Bangladesh\"\>"},
                {"\<\"Dakar, Sengal\"\>", "\<\"Dallas, USA, TX\"\>"},
                {"\<\"Damascus, Syria\"\>", "\<\"Dar es Salaam, \
Tanzania\"\>"},
                {"\<\"Denver, USA, CO\"\>", "\<\"Djakarta, Indonesia\"\>"},
                {"\<\"Djibouti, Djibouti\"\>", "\<\"Doha, Qatar\"\>"},
                {"\<\"Domaneab, Nauru\"\>", "\<\"Dublin, Ireland\"\>"},
                {"\<\"Dushanbe, Tajikistan\"\>", "\<\"Edinburgh, United \
Kingdom\"\>"},
                {"\<\"El Aaiun, Western Sahara\"\>", "\<\"Fort\[Hyphen]de\
\[Hyphen]France, Martinique\"\>"},
                {"\<\"Freetown, Sierra Leone\"\>", "\<\"Funafuti, \
Tuvalu\"\>"},
                {"\<\"Gaborone, Botswana\"\>", "\<\"Geneva, \
Switzerland\"\>"},
                {\("Georgetown, Cayman Islands"\), "\<\"Georgetown, \
Guyana\"\>"},
                {"\<\"Gibraltar\"\>", "\<\"Godthab, Greenland\"\>"},
                {"\<\"Guatemala City, Guatemala\"\>", "\<\"Hamilton, \
Bermuda\"\>"},
                {"\<\"Hanoi, Vietnam\"\>", "\<\"Harare, Zimbabwe\"\>"},
                {"\<\"Havana, Cuba\"\>", "\<\"Helsinki, Finland\"\>"},
                {"\<\"Hong Kong\"\>", "\<\"Honiara, Solomon Islands\"\>"},
                {"\<\"Honolulu, USA, HI\"\>", "\<\"Islamabad, Pakistan\"\>"},
                {"\<\"Istanbul, Turkey\"\>", "\<\"Jerusalem, Israel\"\>"},
                {"\<\"Kabul, Afghanistan\"\>", "\<\"Kampala, Uganda\"\>"},
                {"\<\"Karachi, Pakistan\"\>", "\<\"Katmandu, Nepal\"\>"},
                {"\<\"Khartoum, Sudan\"\>", "\<\"Kiev, Ukraine\"\>"},
                {"\<\"Kigali, Rwanda\"\>", "\<\"Kingston, Jamaica\"\>"},
                {\("Kingstown, St. Vincent\[Hyphen]Grenadines"\), \
"\<\"Kinshasa, Zaire\"\>"},
                {"\<\"Kishinev, Moldavia\"\>", "\<\"Kolonia, USA, FM\"\>"},
                {"\<\"Koror, Belau\"\>", "\<\"Kuala Lumpur, Malaysia\"\>"},
                {"\<\"Kuwait City, Kuwait\"\>", "\<\"Lagos, Nigeria\"\>"},
                {"\<\"La Paz, Bolivia\"\>", "\<\"Las Palmas, Canary Islands\"\
\>"},
                {"\<\"Libreville, Gabon\"\>", "\<\"Lilongwe, Malawi\"\>"},
                {"\<\"Lima, Peru\"\>", "\<\"Lisbon, Portugal\"\>"},
                {"\<\"Ljubljana, Slovenia\"\>", "\<\"Lome, Togo\"\>"},
                {"\<\"London, United Kingdom\"\>", "\<\"Los Angeles, USA, \
CA\"\>"},
                {"\<\"Luanda, Angola\"\>", "\<\"Lusaka, Zambia\"\>"},
                {"\<\"Luxembourg, Luxembourg\"\>", "\<\"Madrid, Spain\"\>"},
                {"\<\"Malabo, Equatorial Guinea\"\>", "\<\"Male, \
Maldives\"\>"},
                {"\<\"Managua, Nicaragua\"\>", "\<\"Manama, Bahrain\"\>"},
                {"\<\"Manila, Philippines\"\>", "\<\"Maputo, \
Mozambique\"\>"},
                {"\<\"Maseru, Lesotho\"\>", "\<\"Mbabane, Swaziland\"\>"},
                {"\<\"Mecca, Saudi Arabia\"\>", "\<\"Mexico City, \
Mexico\"\>"},
                {"\<\"Miami, USA, FL\"\>", "\<\"Minneapolis, USA, MN\"\>"},
                {"\<\"Minsk, Belorussia\"\>", "\<\"Mogadisho, Somalia\"\>"},
                {"\<\"Monaco\"\>", "\<\"Monrovia, Liberia\"\>"},
                {"\<\"Montevideo, Uruguay\"\>", "\<\"Montreal, Canada\"\>"},
                {"\<\"Moroni, Comoros\"\>", "\<\"Moscow, Russia\"\>"},
                {"\<\"Muscat, Oman\"\>", "\<\"Nairobi, Kenya\"\>"},
                {"\<\"Nassau, Bahamas\"\>", "\<\"Ndjamena, Chad\"\>"},
                {"\<\"New Delhi, India\"\>", "\<\"New York, USA, NY\"\>"},
                {"\<\"Niamey, Niger\"\>", "\<\"Nicosia, Cyprus\"\>"},
                {"\<\"Nouakchott, Mauritania\"\>", "\<\"Noumea, New Caledonia\
\"\>"},
                {"\<\"Nuku'alofa, Tonga\"\>", "\<\"Nukunonu, Tokelau\"\>"},
                {"\<\"Oranjestad, Aruba\"\>", "\<\"Osaka, Japan\"\>"},
                {"\<\"Oslo, Norway\"\>", "\<\"Ottawa, Canada\"\>"},
                {"\<\"Ouagadougou, Burkina Faso\"\>", "\<\"Pago Pago, \
American Samoa\"\>"},
                {"\<\"Panama City, Panama\"\>", "\<\"Paramaribo, \
Surinam\"\>"},
                {"\<\"Paris, France\"\>", "\<\"Peking, China\"\>"},
                {"\<\"Perth, Australia\"\>", "\<\"Philadelphia, USA, \
PA\"\>"},
                {"\<\"Phnom Penh, Cambodia\"\>", "\<\"Plymouth, \
Montserrat\"\>"},
                {"\<\"Ponta Delgada, Azores\"\>", "\<\"Port\[Hyphen]au\
\[Hyphen]Prince, Haiti\"\>"},
                {"\<\"Portland, USA, OR\"\>", "\<\"Port Louis, \
Mauritius\"\>"},
                {\("Port Moresby, Papua New Guinea"\), "\<\"Port of Spain, \
Trinidad and Tobago\"\>"},
                {"\<\"Porto\[Hyphen]Novo, Benin\"\>", "\<\"Port Vila, Vanuatu\
\"\>"},
                {"\<\"Prague, Czech Republic\"\>", "\<\"Praia, Cape Verde \
Islands\"\>"},
                {"\<\"Pretoria, South Africa\"\>", "\<\"Pyongyang, North \
Korea\"\>"},
                {"\<\"Quito, Ecuador\"\>", "\<\"Rabat, Morocco\"\>"},
                {"\<\"Rangoon, Burma\"\>", "\<\"Reykjavik, Iceland\"\>"},
                {"\<\"Riga, Latvia\"\>", "\<\"Rio de Janeiro, Brazil\"\>"},
                {"\<\"Riyadh, Saudi Arabia\"\>", "\<\"Road Town, United \
Kingdom, Virgin Islands\"\>"},
                {"\<\"Rome, Italy\"\>", "\<\"Roseau, Dominica\"\>"},
                {"\<\"Saint Louis, USA, MO\"\>", "\<\"Salt Lake City, USA, UT\
\"\>"},
                {"\<\"Sana, Yemen\"\>", "\<\"San Diego, USA, CA\"\>"},
                {"\<\"San Francisco, USA, CA\"\>", "\<\"San Jose, Costa \
Rica\"\>"},
                {"\<\"San Juan, USA, PR\"\>", "\<\"San Marino, San \
Marino\"\>"},
                {"\<\"San Salvador, El Salvador\"\>", "\<\"Santiago, \
Chile\"\>"},
                {\("Santo Domingo, Dominican Republic"\), "\<\"Sao Paulo, \
Brazil\"\>"},
                {\("Sao Tome, Sao Tome and Principe"\), "\<\"Sarajevo, Bosnia\
\[Hyphen]Herzogovina\"\>"},
                {"\<\"Seoul, South Korea\"\>", "\<\"Shanghai, China\"\>"},
                {"\<\"Singapore, Singapore\"\>", "\<\"Skopje, \
Macedonia\"\>"},
                {"\<\"Sofia, Bulgaria\"\>", "\<\"Stanley, Falkland \
Islands\"\>"},
                {"\<\"St. Denis, Reunion\"\>", "\<\"St. George's, \
Grenada\"\>"},
                {\("St. John's, Antigua and Barbuda"\), "\<\"Stockholm, \
Sweden\"\>"},
                {"\<\"St. Peterburg, Russia\"\>", "\<\"Sucre, Bolivia\"\>"},
                {"\<\"Suva, Fiji\"\>", "\<\"Sydney, Australia\"\>"},
                {"\<\"Taipei, Taiwan\"\>", "\<\"Tallinn, Estonia\"\>"},
                {"\<\"Tarawa, Kiribati\"\>", "\<\"Tashkent, Uzbekistan\"\>"},
                {"\<\"Tblisi, Georgia\"\>", "\<\"Tegucigalpa, Honduras\"\>"},
                {"\<\"Tehran, Iran\"\>", "\<\"The Valley, Anguilla\"\>"},
                {"\<\"Thimphu, Bhutan\"\>", "\<\"Tianjin, China\"\>"},
                {"\<\"Tirana, Albania\"\>", "\<\"Tokyo, Japan\"\>"},
                {"\<\"Torshavn, Faroe Islands\"\>", "\<\"Tripoli, Libya\"\>"},
                
                {"\<\"Tunis, Tunisia\"\>", "\<\"Ulan Bator, Mongolia\"\>"},
                {"\<\"Vaduz, Liechtenstein\"\>", "\<\"Valletta, Malta\"\>"},
                {"\<\"Vancouver, Canada\"\>", "\<\"Vatican City\"\>"},
                {"\<\"Victoria, Seychelles\"\>", "\<\"Vienna, Austria\"\>"},
                {"\<\"Vientiane, Laos\"\>", "\<\"Vilnius, Lithuania\"\>"},
                {"\<\"Warsaw, Poland\"\>", "\<\"Washington, USA, DC\"\>"},
                {"\<\"Wellington, New Zealand\"\>", "\<\"Willemstad, \
Netherlands Antilles\"\>"},
                {"\<\"Windhoek, Namibia\"\>", "\<\"Yaounde, Cameroon\"\>"},
                {"\<\"Yerevan, Armenia\"\>", "\<\"Zagreb, Croatia\"\>"},
                {"\<\"Zurich, Switzerland\"\>", "\[Null]"}
                },
              ColumnAlignments->{Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.55.1", "1.8"}],

Cell[TextData[{
  "Cities defined in ",
  StyleBox["Miscellaneous`CityData`", "MR"],
  "."
}], "Caption",
  CellTags->"S5.55.1"],

Cell[TextData[{
  "You can give a more precise name for a city using the form ",
  Cell[BoxData[
      \(TraditionalForm\`{\)], "InlineFormula"],
  StyleBox["cityname", "TI"],
  StyleBox[",", "MR"],
  " ",
  StyleBox["countryname", "TI"],
  Cell[BoxData[
      \(TraditionalForm\`}\)], "InlineFormula"],
  ", with more precise indicators such as state names following, if \
necessary. The database also checks the spelling of your request. If there is \
no matching name, but a name that is close, that name will be suggested to \
you. "
}], "Text",
  CellTags->{"S5.55.1", "1.9"}],

Cell["This city is in the database under the name Rome. ", "MathCaption",
  CellTags->{"S5.55.1", "1.10"}],

Cell[CellGroupData[{

Cell["CityData[\"Roma\", CityPosition]", "Input",
  CellLabel->"In[4]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \(CityData::"alternates" \(\(:\)\(\ \)\) 
      "Requested city not in database.  Possible alternatives: \
\!\({{\"Rome\", \"Italy\"}}\)"\)], "Message",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \(CityData["Roma", CityPosition]\)], "Output",
  CellLabel->"Out[4]= ",
  CellTags->"S5.55.1"]
}, Open  ]],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {
                  
                  RowBox[{"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityDistance[\\\\\
\\\\\\\\\\\"\\\\\\\"\\\", \\\"MR\\\"]\\)\"\>", 
                    StyleBox[
                      
                      SubscriptBox["\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\
\\\"\\\", \\\"TI\\\"]\\)\"\>", "1"],
                      
                      "InlineFormula"], "\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\
\\\\\\\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\", \
\\\"MR\\\"]\\)\"\>", 
                    StyleBox[
                      
                      SubscriptBox["\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\
\\\"\\\", \\\"TI\\\"]\\)\"\>", "2"],
                      
                      "InlineFormula"], "\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\
\\\\\\\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>"}], "\<\"give the distance \
between the cities in kilometers \"\>"},
                {
                  
                  RowBox[{"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityDistance[\\\\\
\\\\\\\\\\\"\\\\\\\"\\\", \\\"MR\\\"]\\)\"\>", 
                    StyleBox[
                      
                      SubscriptBox["\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\
\\\"\\\", \\\"TI\\\"]\\)\"\>", "1"],
                      
                      "InlineFormula"], "\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\
\\\\\\\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\", \
\\\"MR\\\"]\\)\"\>", 
                    StyleBox[
                      
                      SubscriptBox["\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"city\\\\\
\\\"\\\", \\\"TI\\\"]\\)\"\>", "2"],
                      
                      "InlineFormula"], "\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\\\
\\\\\\\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"CityDistanceMethod\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"->\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"method\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \
\"\>"}], \("give the distance using the specified method, a pure function of \
two arguments representing the positions of the cities "\)}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.55.1", "1.11"}],

Cell[TextData[{
  "The ",
  StyleBox["CityDistance", "MR"],
  " function. "
}], "Caption",
  CellTags->"S5.55.1"],

Cell[TextData[{
  "The function ",
  StyleBox["CityDistance", "MR"],
  " uses the positions in the database to determine the distance between two \
cities. The default method of computing distance is ",
  StyleBox["SphericalDistance", "MR"],
  " from the package ",
  StyleBox["Miscellaneous`Geodesy`", "MR"],
  ". "
}], "Text",
  CellTags->{"S5.55.1", "1.12"}],

Cell["This gives the distance between Washington and Montreal. ", \
"MathCaption",
  CellTags->{"S5.55.1", "1.13"}],

Cell[CellGroupData[{

Cell["CityDistance[\"Washington\", \"Montreal\"]//N", "Input",
  CellLabel->"In[5]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \(786.9150125626869`\)], "Output",
  CellLabel->"Out[5]= ",
  CellTags->"S5.55.1"]
}, Open  ]],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"$CityFields\\\\\\\"\\\", \
\\\"MR\\\"]\\) \"\>", \("the symbol that holds the names of the data fields \
in the database"\)},
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CityPosition\\\\\\\"\\\", \
\\\"MR\\\"]\\) \"\>", "\<\"the field in the database that holds position \
information\"\>"}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.55.1", "1.14"}],

Cell["Controlling information in the database. ", "Caption",
  CellTags->"S5.55.1"],

Cell["\<\
The database is quite expandable; you can add additional cities and \
additional information for each city. \
\>", "Text",
  CellTags->{"S5.55.1", "1.15"}],

Cell["\<\
This places position information for Champaign, Illinois, into the \
database. \
\>", "MathCaption",
  CellTags->{"S5.55.1", "1.16"}],

Cell["\<\
CityPosition[{\"Champaign\", \"USA\", \"IL\"}] =
 {{40, 7, 5}, {-88, -14, -48}};\
\>", "Input",
  CellLabel->"In[6]:= ",
  CellTags->"S5.55.1"],

Cell["Here is the position of Champaign. ", "MathCaption",
  CellTags->{"S5.55.1", "1.17"}],

Cell[CellGroupData[{

Cell["CityData[\"Champaign\", CityPosition]", "Input",
  CellLabel->"In[7]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \({{40, 7, 5}, {\(-88\), \(-14\), \(-48\)}}\)], "Output",
  CellLabel->"Out[7]= ",
  CellTags->"S5.55.1"]
}, Open  ]],

Cell["\<\
This adds a new field to the database to hold population \
information. \
\>", "MathCaption",
  CellTags->{"S5.55.1", "1.18"}],

Cell["AppendTo[$CityFields, CityPopulation];", "Input",
  CellLabel->"In[8]:= ",
  CellTags->"S5.55.1"],

Cell["Here is the population for Washington. ", "MathCaption",
  CellTags->{"S5.55.1", "1.19"}],

Cell["CityPopulation[{\"Washington\", \"USA\", \"DC\"}] = 638000;", "Input",
  CellLabel->"In[9]:= ",
  CellTags->"S5.55.1"],

Cell["This accesses all data about Washington in the database. ", \
"MathCaption",
  CellTags->{"S5.55.1", "1.20"}],

Cell[CellGroupData[{

Cell["CityData[\"Washington\"]", "Input",
  CellLabel->"In[10]:= ",
  CellTags->"S5.55.1"],

Cell[BoxData[
    \({{CityPosition, {{38, 53, 
            42}, {\(-77\), \(-2\), \(-12\)}}}, {CityPopulation, 
        638000}}\)], "Output",
  CellLabel->"Out[10]= ",
  CellTags->"S5.55.1"]
}, Open  ]]
},
FrontEndVersion->"4.0 for X",
ScreenRectangle->{{0, 800}, {0, 600}},
WindowSize->{520, 455},
WindowMargins->{{140, Automatic}, {Automatic, 72}},
StyleDefinitions -> "HelpBrowser.nb"
]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of 
the file.  The cache data will then be recreated when you save this file 
from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{
  "S5.55.1"->{
    Cell[1717, 49, 143, 6, 70, "Subsection",
      CellTags->{"S5.55.1", "1.1"}],
    Cell[1863, 57, 342, 7, 70, "Text",
      CellTags->{"S5.55.1", "1.2"}],
    Cell[2208, 66, 1743, 33, 70, "Text",
      CellTags->{"S5.55.1", "1.3"}],
    Cell[3954, 101, 119, 5, 70, "Caption",
      CellTags->"S5.55.1"],
    Cell[4076, 108, 733, 26, 70, "Text",
      CellTags->{"S5.55.1", "1.4"}],
    Cell[4812, 136, 79, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.5"}],
    Cell[4894, 139, 91, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[4988, 143, 106, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.6"}],
    Cell[5119, 148, 101, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[5223, 152, 112, 3, 70, "Output",
      CellTags->"S5.55.1"],
    Cell[5350, 158, 128, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.7"}],
    Cell[5503, 166, 89, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[5595, 170, 155, 4, 70, "Output",
      CellTags->"S5.55.1"],
    Cell[5765, 177, 10591, 191, 70, "Text",
      CellTags->{"S5.55.1", "1.8"}],
    Cell[16359, 370, 128, 5, 70, "Caption",
      CellTags->"S5.55.1"],
    Cell[16490, 377, 581, 15, 70, "Text",
      CellTags->{"S5.55.1", "1.9"}],
    Cell[17074, 394, 106, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.10"}],
    Cell[17205, 399, 97, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[17305, 403, 193, 4, 70, "Message",
      CellTags->"S5.55.1"],
    Cell[17501, 409, 112, 3, 70, "Output",
      CellTags->"S5.55.1"],
    Cell[17628, 415, 2540, 56, 70, "Text",
      CellTags->{"S5.55.1", "1.11"}],
    Cell[20171, 473, 113, 5, 70, "Caption",
      CellTags->"S5.55.1"],
    Cell[20287, 480, 361, 10, 70, "Text",
      CellTags->{"S5.55.1", "1.12"}],
    Cell[20651, 492, 115, 2, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.13"}],
    Cell[20791, 498, 110, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[20904, 502, 100, 3, 70, "Output",
      CellTags->"S5.55.1"],
    Cell[21019, 508, 639, 15, 70, "Text",
      CellTags->{"S5.55.1", "1.14"}],
    Cell[21661, 525, 83, 1, 70, "Caption",
      CellTags->"S5.55.1"],
    Cell[21747, 528, 165, 4, 70, "Text",
      CellTags->{"S5.55.1", "1.15"}],
    Cell[21915, 534, 143, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.16"}],
    Cell[22061, 540, 153, 5, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[22217, 547, 91, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.17"}],
    Cell[22333, 552, 102, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[22438, 556, 123, 3, 70, "Output",
      CellTags->"S5.55.1"],
    Cell[22576, 562, 136, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.18"}],
    Cell[22715, 568, 103, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[22821, 572, 95, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.19"}],
    Cell[22919, 575, 124, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[23046, 579, 115, 2, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.20"}],
    Cell[23186, 585, 90, 2, 70, "Input",
      CellTags->"S5.55.1"],
    Cell[23279, 589, 191, 5, 70, "Output",
      CellTags->"S5.55.1"]},
  "1.1"->{
    Cell[1717, 49, 143, 6, 70, "Subsection",
      CellTags->{"S5.55.1", "1.1"}]},
  "1.2"->{
    Cell[1863, 57, 342, 7, 70, "Text",
      CellTags->{"S5.55.1", "1.2"}]},
  "1.3"->{
    Cell[2208, 66, 1743, 33, 70, "Text",
      CellTags->{"S5.55.1", "1.3"}]},
  "1.4"->{
    Cell[4076, 108, 733, 26, 70, "Text",
      CellTags->{"S5.55.1", "1.4"}]},
  "1.5"->{
    Cell[4812, 136, 79, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.5"}]},
  "1.6"->{
    Cell[4988, 143, 106, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.6"}]},
  "1.7"->{
    Cell[5350, 158, 128, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.7"}]},
  "1.8"->{
    Cell[5765, 177, 10591, 191, 70, "Text",
      CellTags->{"S5.55.1", "1.8"}]},
  "1.9"->{
    Cell[16490, 377, 581, 15, 70, "Text",
      CellTags->{"S5.55.1", "1.9"}]},
  "1.10"->{
    Cell[17074, 394, 106, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.10"}]},
  "1.11"->{
    Cell[17628, 415, 2540, 56, 70, "Text",
      CellTags->{"S5.55.1", "1.11"}]},
  "1.12"->{
    Cell[20287, 480, 361, 10, 70, "Text",
      CellTags->{"S5.55.1", "1.12"}]},
  "1.13"->{
    Cell[20651, 492, 115, 2, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.13"}]},
  "1.14"->{
    Cell[21019, 508, 639, 15, 70, "Text",
      CellTags->{"S5.55.1", "1.14"}]},
  "1.15"->{
    Cell[21747, 528, 165, 4, 70, "Text",
      CellTags->{"S5.55.1", "1.15"}]},
  "1.16"->{
    Cell[21915, 534, 143, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.16"}]},
  "1.17"->{
    Cell[22217, 547, 91, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.17"}]},
  "1.18"->{
    Cell[22576, 562, 136, 4, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.18"}]},
  "1.19"->{
    Cell[22821, 572, 95, 1, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.19"}]},
  "1.20"->{
    Cell[23046, 579, 115, 2, 70, "MathCaption",
      CellTags->{"S5.55.1", "1.20"}]}
  }
*)

(*CellTagsIndex
CellTagsIndex->{
  {"S5.55.1", 24111, 614},
  {"1.1", 27243, 697},
  {"1.2", 27337, 700},
  {"1.3", 27425, 703},
  {"1.4", 27515, 706},
  {"1.5", 27605, 709},
  {"1.6", 27700, 712},
  {"1.7", 27796, 715},
  {"1.8", 27892, 718},
  {"1.9", 27985, 721},
  {"1.10", 28077, 724},
  {"1.11", 28176, 727},
  {"1.12", 28270, 730},
  {"1.13", 28363, 733},
  {"1.14", 28462, 736},
  {"1.15", 28555, 739},
  {"1.16", 28647, 742},
  {"1.17", 28746, 745},
  {"1.18", 28844, 748},
  {"1.19", 28943, 751},
  {"1.20", 29041, 754}
  }
*)

(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 143, 6, 70, "Subsection",
  CellTags->{"S5.55.1", "1.1"}],
Cell[1863, 57, 342, 7, 70, "Text",
  CellTags->{"S5.55.1", "1.2"}],
Cell[2208, 66, 1743, 33, 70, "Text",
  CellTags->{"S5.55.1", "1.3"}],
Cell[3954, 101, 119, 5, 70, "Caption",
  CellTags->"S5.55.1"],
Cell[4076, 108, 733, 26, 70, "Text",
  CellTags->{"S5.55.1", "1.4"}],
Cell[4812, 136, 79, 1, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.5"}],
Cell[4894, 139, 91, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[4988, 143, 106, 1, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.6"}],

Cell[CellGroupData[{
Cell[5119, 148, 101, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[5223, 152, 112, 3, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]],
Cell[5350, 158, 128, 4, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.7"}],

Cell[CellGroupData[{
Cell[5503, 166, 89, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[5595, 170, 155, 4, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]],
Cell[5765, 177, 10591, 191, 70, "Text",
  CellTags->{"S5.55.1", "1.8"}],
Cell[16359, 370, 128, 5, 70, "Caption",
  CellTags->"S5.55.1"],
Cell[16490, 377, 581, 15, 70, "Text",
  CellTags->{"S5.55.1", "1.9"}],
Cell[17074, 394, 106, 1, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.10"}],

Cell[CellGroupData[{
Cell[17205, 399, 97, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[17305, 403, 193, 4, 70, "Message",
  CellTags->"S5.55.1"],
Cell[17501, 409, 112, 3, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]],
Cell[17628, 415, 2540, 56, 70, "Text",
  CellTags->{"S5.55.1", "1.11"}],
Cell[20171, 473, 113, 5, 70, "Caption",
  CellTags->"S5.55.1"],
Cell[20287, 480, 361, 10, 70, "Text",
  CellTags->{"S5.55.1", "1.12"}],
Cell[20651, 492, 115, 2, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.13"}],

Cell[CellGroupData[{
Cell[20791, 498, 110, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[20904, 502, 100, 3, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]],
Cell[21019, 508, 639, 15, 70, "Text",
  CellTags->{"S5.55.1", "1.14"}],
Cell[21661, 525, 83, 1, 70, "Caption",
  CellTags->"S5.55.1"],
Cell[21747, 528, 165, 4, 70, "Text",
  CellTags->{"S5.55.1", "1.15"}],
Cell[21915, 534, 143, 4, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.16"}],
Cell[22061, 540, 153, 5, 70, "Input",
  CellTags->"S5.55.1"],
Cell[22217, 547, 91, 1, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.17"}],

Cell[CellGroupData[{
Cell[22333, 552, 102, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[22438, 556, 123, 3, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]],
Cell[22576, 562, 136, 4, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.18"}],
Cell[22715, 568, 103, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[22821, 572, 95, 1, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.19"}],
Cell[22919, 575, 124, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[23046, 579, 115, 2, 70, "MathCaption",
  CellTags->{"S5.55.1", "1.20"}],

Cell[CellGroupData[{
Cell[23186, 585, 90, 2, 70, "Input",
  CellTags->"S5.55.1"],
Cell[23279, 589, 191, 5, 70, "Output",
  CellTags->"S5.55.1"]
}, Open  ]]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)

