Solar Eclipse visit planning with Mathematica

A total solar eclipse will cross much of the United States, plus parts of Canada and Mexico on April 8, 2024. If you’ve never seen a solar eclipse, you should, and if you’re in North America, this is a great chance. Mathematica can help.

Mathematica includes significant data about the eclipse, including when it happens and where it will be.

nextSolarEclipseDate = DateObject[{2024, 4, 8}];

SolarEclipse[nextSolarEclipseDate]


And to visualize that…

a = GeoGraphics[{GeoStyling[None], Opacity[.2], Red,
SolarEclipse[nextSolarEclipseDate, "PartialPhasePolygon",
EclipseType -> "Total"]}];
b = GeoGraphics[{GeoStyling[None],
SolarEclipse[nextSolarEclipseDate, "TotalPhaseCenterLine",
EclipseType -> "Total"]}];
c = GeoGraphics[{GeoStyling[None], Opacity[.4], Red,
SolarEclipse[nextSolarEclipseDate, "TotalPhasePolygon",
EclipseType -> "Total"]}];;
Show[a, b, c,
GeoCenter -> Entity["City", {"Chicago", "Illinois", "UnitedStates"}],
GeoRange -> Quantity[2500, "Miles"]]

Virtually everybody in North America will get at least a partial eclipse, and everybody along that darker band in the middle will get to see a total eclipse. Sorry, Alaska!

Where best to view the thing? In theory one ought to be able to get a list of every city near the center line with this Mathematica code:

eclipseCenter =
SolarEclipse[nextSolarEclipseDate, "TotalPhaseCenterLine",
EclipseType -> "Total"]
;

GeoNearest["City", eclipseCenter, {All, 0}, TimeConstraint -> Infinity]

But this timed out or gave a server error, so I broke the problem into small pieces. First we identify all the states and provinces through which the center line passes. Ideally, we would do this with GeoEntities[SolarEclipse[nextSolarEclipseDate, "TotalPhaseCenterLine", EclipseType -> "Total"], "AdministrativeDivision"], but this gives an empty list. And if we replace the CenterLine with the CenterPolygon, the number of AdministrativeDivisions (which includes not merely states but also counties and other units of government) becomes unwieldy. So we break the problem into pieces, identifying just the states and provinces through which the center line passes:

adminEntitiesPoly =
GeoEntities[
SolarEclipse[nextSolarEclipseDate, "TotalPhasePolygon",
EclipseType -> "Total"], "AdministrativeDivision"];
statesAndProvinces =
EntityValue[Entity["Country", "UnitedStates"],
"AdministrativeDivisions"]~Join~
EntityValue[Entity["Country", "Canada"],
"AdministrativeDivisions"]~Join~
EntityValue[Entity["Country", "Mexico"], "AdministrativeDivisions"];
eclipseStates = Intersection[adminEntitiesPoly, statesAndProvinces];

Then, for each of these states and provinces, we identify every city Mathematica knows about, strip out the small ones, and from the rest identify those through which the center line passes. For sorting, I also compute the distance from New York City (where I hang my hat).

nyc = Entity["City", {"NewYork", "NewYork", "UnitedStates"}];

allCities =
Union[Flatten[Map[GeoEntities[#, "City"] &, eclipseStates]]];
allCitiesOfSize = Select[allCities,
QuantityMagnitude[CityData[#, "Population"]] > 50000 &];
eclipseCitiesOnPath = Select[allCitiesOfSize,
QuantityMagnitude[GeoDistance[#, eclipseCenter]] < 1 &];

eclipseCitiesWithPop = SortBy[Map[<|"city" -> #, "pop" -> CityData[#, "Population"], "distance from home" -> GeoDistance[#, nyc]|> &, eclipseCitiesOnPath], Last];
Dataset[eclipseCitiesWithPop]

That’s manageable! And wow, the kids at UI Bloomington are lucky. Let’s see these cities on a map:

d = GeoGraphics[GeoMarker[eclipseCitiesOnPath]]; Show[a, b, c, d,
GeoCenter -> Entity["City", {"Chicago", "Illinois", "UnitedStates"}],
GeoRange -> Quantity[2500, "Miles"],
GeoProjection -> "Equirectangular"]

You see only three markers above rather than four because Cheektowaga is a suburb of Buffalo and their markers overlap. For me, Buffalo is the obvious destination. Let’s examine the eclipse’s path through that town in detail.

GeoGraphics[{GeoStyling[None], Red, Opacity[0.3], Thickness[0.1],
SolarEclipse[nextSolarEclipseDate, "TotalPhaseCenterLine",
EclipseType -> "Total"]}, GeoRange -> Quantity[8, "Miles"],
GeoCenter -> Entity["City", {"Buffalo", "NewYork", "UnitedStates"}],
ImageSize -> Full]

There you have it. The centerline passes about 2.5 miles south of downtown. Weather permitting, everybody here is going to get a great view.

Adios to the SledDog K9s

For the first time since the Clinton administration, I strapped on a pair of SledDog K9s. This was a failed model of snow skates with soft boots and removable trays on the bottom. Poorly designed, poorly executed, prone to failure, and dangerous even when working. They were kinda fun when I was young and stupid.

Now that I’m older (but still stupid), they weren’t any fun at all. Nearly zero control, almost constantly pitching me forward onto my face. I did one run and then left them against the wall in the lodge for somebody to steal.

24 hours later, they were still there! Evidently, eople are too honest, or too smart, to steal my SledDog K9s.

So I left them there again and headed for home. If you are in a ski lodge anywhere in North America and see a pair of SledDog K9s leaning against a wall, please take them and give them to somebody you don’t like.

Amazon.com pay-for reviews

It’s no secret that a lot of the reviews on Amazon.com are fake. It’s a particular giveaway when some obscure, generic item has thousands of nearly identical five-star reviews. In a slightly more sophisticated version of the scheme, some companies will pay reviewers to say nice things about their products. In that spirit, I’ve started getting a couple of entreaties a week to review items on eBay for cash.

See for example:

It’s clearly a scam, but what scam is it precisely? Are these lousy headphones for which they figure they’ll get better reviews if they pay people? They don’t seem to be giving the headphones for free, so maybe they’re $10 headphones that they sell for $40 by offering a $15 review payment. And maybe they double down on the fraud by not even paying the $15.

So basically, if you are considering buying some bluetooth earbuds, don’t get these.

Installing WordPress on Pair.com, the 2018 edition

Pair.com provides a software installation kit that will do this automatically, but they charge $3/month for access, which seems silly for free software. You can install WordPress yourself in a few minutes. These guidelines update a set I originally posted in 2010.

  1. Download wordpress software from https://wordpress.org/download/
  2. Inside the resulting folder, locate the wp-config-sample.php file and rename it to wp-config.php. Open this file in TextEdit (Mac), Notepad (PC), or another text editor.
  3. Log in to your Pair Networks account to create a new database for your WordPress installation. Go to the Account Control Center, then to “Databases,” “Create a New Database”.
  4. Assign a name to your new database. It is best to choose a name that will be easily identifiable if you plan to have multiple databases. Access level “local” and “monthly” optimization should be fine. Then click on the “Add Database” button. You will be brought to the New Database Details screen. Copy the server name, user name for full access, and the password.
  5. In the wp-config.php file that you have opened in your text editor, set the DB_NAME, DB_USER, DB_PASSWORD to the values for the account with “Full Access,” as WordPress will need to read data, write data, and create tables. Also set the DB_HOST variables (the last of those is the server name over at pair, probably something like db23923.pair.com). All of these must be exact matches to your database setup at Pair.com. You should also take this opportunity to assign unique phrases to the various authentication unique keys and salts in the wp-config file.
  6. Connect to your web server via FTP and upload all of the WordPress files, including the wp-config.php to the desired location on your Pair.com account. If you upload them to www.yourdomain.com/site/ then people will later be able to reach your wordpress content by going to that exact address.
  7. Start the WordPress installation PHP script by pointing your web browser to your domain/installation directory (www.yourdomain.com/site/installation in the example above), followed by /wp-admin/install.php. Modern versions of WordPress will also work from http://www.yourdomain.com/site/wp-admin/. Follow the on-screen prompts and the WordPress installation on your Pair.com account will be complete. If it can’t log in, try going back to the Pair.com database management screen, “Change A Password,” and give a new password to your main database user account. Enter this new password into your wp-config file, upload the fixed wp-config file back to the server, and try again.

Historical global Big Mac prices

Somewhere in the world a hedge fund manager has bought a Ferrarri with trading profits made possible by the following data:

indices = {"BIGMUS", "BIGMBZ", "BIGMMX"};
data = Map[
msBBGhistory[# <> " Index", "Px_Last", {1997, 1, 1}, "",
"Monthly"] &, indices];
DateListPlot[data, PlotStyle -> {Red, Blue, Purple},
PlotRange -> {1.1, 6.4}, Frame -> {True, True, False, False},
PlotLabel -> "Global Big Mac Prices (USD)",
Epilog -> {(Text[Style["U.S.", FontFamily -> "Calibri", FontSize -> 10, Red], {{2012, 1, 10}, 3.8(*vertical position*)}]), (Text[Style["Brazil", FontFamily -> "Calibri", FontSize -> 10, Blue], {{2011, 11, 1}, 4.9(*vertical position*)}]), (Text[Style["Mexico", FontFamily -> "Calibri", FontSize -> 10, Purple], {{2012, 1, 10}, 2.4(*vertical position*)}])}, ImageSize -> Large]

Historical big mac prices, U.S., Mexico and Brazil