## 1164 Reputation

11 years, 196 days

My role is to help customers better exploit our tools. I’ve worked in selling, supporting and marketing maths and simulation software for all my professional career.

I’m fascinated by the full breadth and range of application of Maple. From financial mathematics and engineering to probability and calculus, I’m always impressed by what our users do with our tools.

However much I strenuously deny it, I’m a geek at heart. My first encounter with Maple was as an undergraduate when I used it to symbolically solve the differential equations that described the heat transfer in a series of stirred tanks. My colleagues brute-forced the problem with a numerical solution in Fortran (but they got the marks because that was the point of the course). I’ve since dramatized the process in a worksheet, and never fail to bore people with the story behind it.

I was born, raised and spent my formative years in England’s second city, Birmingham. I graduated with a degree in Chemical Engineering from The University of Nottingham, and after completing a PhD in Fluid Dynamics at Herriot-Watt University in Edinburgh, I started working for Adept Scientific – Maplesoft’s partner in the UK.

## Recognizing Handwritten Digits with Mach...

Maple 2018

To demonstrate Maple 2018’s new Python connectivity, we wanted to integrate a large Python library. The result is the DeepLearning package - this offers an interface to a subset of the Tensorflow framework for machine learning.

I thought I’d share an application that demonstrates how the DeepLearning package can be used to recognize the numbers in images of handwritten digits.

The application employs a very small subset of the MNIST database of handwritten digits. Here’s a sample image for the digit 0.

This image can be represented as a matrix of pixel intensities.

The application generates weights for each digit by training a two-layer neural network using multinomial logistic regression. When visualized, the weights for each digit might look like this.

Let’s say that we’re comparing an image of a handwritten digit to the weights for the digit 0. If a pixel with a high intensity lands in

• an intensely red area, the evidence is high that the number in the image is 0
• an intensely blue area, the evidence is low that the number in the image is 0

While this explanation is technically simplistic, the application offers more detail.

Get the application here

## Google Maps and Geocoding for Maple...

Maple

As a momentary diversion, I threw together a package that downloads map images into Maple using the Google Static Maps API.

If you have Maple 2017, you can install the package using the MapleCloud Package Manager or by executing PackageTools:-Install("5769608062566400").

This worksheet has several examples, but I thought I'd share a few below .

Here's the Maplesoft office

Let's view a roadmap of Waterloo, Ontario.

The package features over 80 styles for roadmaps. These are examples of two styles (the second is inspired by the art of Piet Mondrian and the De Stijl movement)

You can also find the longitude and latitude of a location (courtesy of Google's Geocoding API). Maple returns a nested list if it finds multiple locations.

The geocoding feature can also be used to add points to Maple 2017's built-in world maps.

Let me know what you think!

Maple

Yahoo Finance recently discontinued their (largely undocumented) historical stock quote API.

Previously, you simply send a HTTP:-Get request like this…

HTTP:-Get(“http://ichart.yahoo.com/table.csv?s=AAPL&a=00&b=1&c=2016&d=00&e=1&f=2017&g=d&ignore=.csv")

…and get historical OHLCV (open, high, low, close, trading volume) data in your worksheet (in this case for AAPL between 1 January 2016 and 1 January 2017).

This no longer works! Yahoo shut the door on this easy-to-use and widely disseminated API.

You can still download historical stock quotes from Yahoo Finance into Maple, but the process is now somewhat more involved. My complete code in this worksheet but I'll step through the process below.

If you visit the updated Yahoo Finance website and download historical data for a ticker, you see a URL like this in the status bar of your browser

Let's examine how ths URL is constructed.

• period1 and period2 are Unix time stamps for your start and end date
• interval is the data retrieval interval (this can be either 1d, 1w or 1m)
• crumb is an alphanumeric code that’s periodically regenerated every time you download new historical data from from the Yahoo Finance website using your browser. Moreover, crumb is paired with a cookie that’s stored by your browser.

Here’s how to extract and supply the cookie-crumb pair to Yahoo Finance so you can still use Maple to retrieve historical stock quotes

Send a dummy request to get a cookie-crumb pair

res:=HTTP:-Get("https://finance.yahoo.com/lookup?s=bananas"):

Grab the crumb from the response

i:=StringTools:-Search("CrumbStore\":{\"crumb\":\"",res[2]):
crumbValue := res[2][i+22..i+32]
crumbValue := "btW01FWTBn3"

Store the cookie from the response

Construct the URL

• Your desired start and end dates have to be defined as Unix time stamps. Converting a human readable date (like 1st January 2017) to a Unix timestamp is simple, so I won't cover it here.
• The previously retrieved crumb has to be added to the URL.
ticker:="AAPL":
p1 := 1497709183:
p2 := 1500301183:

Send the request to Yahoo Finance, including the cookie in the header

Your historical data is now returned

The historical data is now easily parsed into a matrix.

## My Favourite Maple Visualizations...

Maple

With Maple, you can create amazing visualizations that go far beyond the standard mathematical plots that you might typically expect (I wince every time I see yet another sine curve).

• plotting primitives that can be assembled in new and novel ways
• precise control over coloring (yay for ColorTools) and placement
• an interactive coding environment with inline plots, giving you quick visual feedback over aesthetic changes
• and a comprehensive mathematical programming language to glue everything together

Here, I thought I'd share a few of the visualizations I've really enjoyed creating over the last few years (and I'd like to emphasize 'enjoy' - doing this stuff is fun!)

Let me know if you want any of the worksheets.

Psychrometric chart with historical weather data for Waterloo, Ontario.

Ternary plot of the color of gold-silver-copper alloys

Spectrogram of a violin note played with vibrato

Colored zoom of the Mandelbrot set

Reporting dashboard for an Organic Rankine Cycle

Temperature-entropy plot of an ideal Rankine Cycle

Quaternion fractal

Historical sunpot data

Earthquake data

African literacy rates

## Announcing Maple 2017...

Maple 2017

Maple 2017 has launched!

Maple 2017 is the result of hard work by an enthusiastic team of developers and mathematicians.

As ever, we’re guided by you, our users. Many of the new features are of a result of your feedback, while others are passion projects that we feel you will find value in.

Here’s a few of my favourite enhancements. There’s far more that’s new - see What’s New in Maple 2017 to learn more.

MapleCloud Package Manager

Since it was first introduced in Maple 14, the MapleCloud has made thousands of Maple documents and interactive applications available through a web interface.

Maple 2017 completely refreshes the MapleCloud experience. Allied with a new, crisp, interface, you can now download and install user-created packages.

Simply open the MapleCloud interface from within Maple, and a mouse click later, you see a list of user-created packages, continuously updated via the Internet. Two clicks later, you’ve downloaded and installed a package.

This completely bypasses the traditional process of searching for and downloading a package, copying to the right folder, and then modifying libname in Maple. That was a laborious process, and, unless I was motivated, stopped me from installing packages.

The MapleCloud hosts a growing number of packages.

Many regular visitors to MaplePrimes are already familiar with Sergey Moiseev’s DirectSearch package for optimization, equation solving and curve fitting.

My fellow product manager, @DSkoog has written a package for grouping data into similar clusters (called ClusterAnalysis on the Package Manager)

Here’s a sample from a package I hacked together for downloading maps images using the Google Maps API (it’s called Google Maps and Geocoding on the Package Manager).

You’ll also find user-developed packages for exploring AES-based encryption, orthogonal series expansions, building Maple shell scripts and more.

Simply by making the process of finding and installing packages trivially easy, we’ve opened up a new world of functionality to users.

Maple 2017 also offers a simple method for package authors to upload workbook-based packages to the MapleCloud.

We’re engaging with many package authors to add to the growing list of packages on the MapleCloud. We’d be interested in seeing your packages, too!

We’re committed to continually improving the core symbolic math routines. Here area few examples of what to expect in Maple 2017.

Resulting from enhancements to the Risch algorithm, Maple 2017 now computes symbolic integrals that were previously intractable

Groeber:-Basis uses a new implementation of the FGLM algorithm. The example below runs about 200 times faster in Maple 2017.

gcdex now uses a sparse primitive polynomial remainder sequence together.  For sparse structured problems the new routine is orders of magnitude faster. The example below was previously intractable.

The asympt and limit commands can now handle asymptotic cases of the incomplete Γ function where both arguments tend to infinity and their quotient remains finite.

Among several improvements in mathematical functions, you can now calculate and manipulate the four multi-parameter Appell functions.

Appel functions are of increasing importance in quantum mechanics, molecular physics, and general relativity.

pdsolve has seen many enhancements. For example, you can tell Maple that a dependent variable is bounded. This has the potential of simplifying the form of a solution.

Plot Builder

Plotting is probably the most common application of Maple, and for many years, you’ve been able to create these plots without using commands, if you want to.  Now, the re-designed interactive Plot Builder makes this process easier and better.

When invoked by a context menu or command on an expression or function, a panel slides out from the right-hand side of the interface.

Generating and customizing plots takes a single mouse click. You alter plot types, change formatting options on the fly and more.

To help you better learn Maple syntax, you can also display the actual plot command.

You can distribute password-protected executable content. This feature uses the workbook file format introduced with Maple 2016.

You can lock down any worksheet in a Workbook. But from any other worksheet, you can send (author-specified) parameters into the locked worksheet, and extract (author-specified) results.

Plot Annotations

You can now get information to pop up when you hover over a point or a curve on a plot.

In this application, you see the location and magnitude of an earthquake when you hover over a point

Here’s a ternary diagram of the color of gold-silver-copper alloys. If you let your mouse hover over the points, you see the composition of the points

Plot annotations may seem like a small feature, but they add an extra layer of depth to your visualizations. I’ve started using them all the time!

Engineering Portal

In my experience, if you ask an engineer how they prefer to learn, the vast majority of them will say “show me an example”. The significantly updated Maple Portal for Engineers does just that, incorporating many more examples and sample applications.  In fact, it has a whole new Application Gallery containing dozens of applications that solve concrete problems from different branches of engineering while illustrating important Maple techniques.

Designed as a starting point for engineers using Maple, the Portal also includes information on math and programming, interface features for managing your projects, data analysis and visualization tools, working with physical and scientific data, and a variety of specialized topics.

Geographic Data

You can now generate and customize world maps. This for example, is a choropleth of European fertility rates (lighter colors indicate lower fertility rates)

You can plot great circles that show the shortest path between two locations, show varying levels of detail on the map, and even experiment with map projections.

A new geographic database contains over one million locations, cross-referenced with their longitude, latitude, political designation and population.

The database is tightly linked to the mapping tools. Here, we ask Maple to plot the location of country capitals with a population of greater than 8 million and a longitude lower than 30.

There’s much more to Maple 2017. It’s a deep, rich release that has something for everyone.