Application Centre Highlights
Is it Raining in Moscow? Ask Maple
Maple 7's Sockets package allows you
to download real-time Web data into your Maple applications.
A team of Waterloo Maples application specialists
took this package for a test-drive by connecting to Lycos®s
weather Web site http://weather.lycos.com from inside a
Maple worksheet.
We created a Maple procedure that would connect to http://weather.lycos.com
and return the current temperature reported by Lycos for
any city we input to the procedure. (See Figures 1 and 2).
One might object, "If you want the weather in Moscow,
why not visit Lycos with a browser directly and spare yourself
the Maple programming?" However, the motivation of
the Sockets package goes beyond providing access to internet
data. It enables users to pull that data automatically into
mathematical analysis they developed in Maple, which the
Web sites themselves cannot provide. A more fitting title
to this article might be, "Why is it raining in Moscow?
Ask Maple."
In this particular Maple application, we collected current
temperatures from 30 cities selected from around the globe.
We then plotted the cities temperatures as points
on a sphere, with the locations of the points determined
by the cities latitude and longitude, and the colours
of the points determined by their current temperatures.
(See Figure 3).
One can spin the globe using Maples real-time 3-D
plot rotation and see how location influences temperature
at any given time of day, or time of the year. The application
is available from the Maple Application Centre at http://www.adeptscience.co.uk/go?pg=H31
Out of laziness, we didnt take the data analysis
any further, but one can imagine some fascinating directions
Maple could go from here. One could input the temperature
data to Maples curve-fitting procedures to estimate
the current temperature of any point on the earth as a function
of latitude and longitude. Then one would suddenly recall
the famous Meteorology Theorem from topology, which states
that at any given time, there exists a pair of antipodal
points on the planet having the exact same temperature and
barometric pressure. By applying Maples symbolic equation
solver to the temperature function, one could actually find
all such pairs of points. By repeating the process for different
times, one could study how the antipodal pairs shift throughout
the day. In such an analysis, the data acquisition merely
provides the icing. Maples maths engine provides the
cake.
Downloading data from a Web site with the Sockets package
presents a challenge, however. The data queries to a Web
site sent by a socket connection in Maple must have syntax
understood by the sites Web server. Because every
Web server has its own protocol, the user must do some homework
before attempting to connect to a server from Maple. For
example, in the Lycos page showing the weather in Berlin
(see Figure 4), the URL substring following the servers
IP ("weather.lycos.com") contains a code identifying
the page for Berlin, namely, "zipcode=EDDB&direct=true."
By viewing each citys page in Lycos, one would have
to acquire each citys code manually and hard-code
it into the Maple application. This is, in fact, what we
did to create the temperature application described above.
Maples user community has made incredibly creative
uses of the software that Waterloo Maple itself never even
dreamed of. We are confident that users will exploit the
opportunities presented by Maple 7s new Sockets package
in many exciting and imaginative ways.