Maplesoft Blogger Profile: Samir Khan

Technical professional in industry or government

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.

Posts by Samir Khan

We've just launched Maple Flow 2024!

You're in the driving seat with Maple Flow - each new feature has a straight-line connection to a user-driven demand to work faster and more efficiently.

Head on over here for a rundown of everything that's new, but I thought I'd share my personal highlights here.

If your result contains a large vector or matrix, you can now scroll to see more data. You can also change the size of the matrix to view more or fewer rows and columns.

You can resize rows and columns if they're too large or small, and selectively enable row and column headers.

If the vector or matrix in your result contains a unit, you can now rescale units with the Context Panel (for the entire matrix) or inline (for individual entries).

A few releases ago, we introduced the Variables palette to help you keep track of all the user-defined parameters at point of the grid cursor.

You can now insert variables into the worksheet from the Variables palette. Just double-click on the appropriate name.

Maple Flow already features command completion - just type the first few letters of a command, and a list of potential completions appears. Just pick the completion you need with a quick tap of the Tab key.

We've supercharged this feature to give potential arguments for many popular functions. Type a function name followed by an opening bracket, and a list appears.

In case you've missed it, the argument completion list also features (when they make sense) user-defined variables.

You can now link to different parts of the same worksheet. This can be used to create a table of contents that lets you jump to different parts of larger worksheets.

This page lists everything that's new in the current release, and all the prior releases. You might notice that we have three releases a year, each featuring many user-requested items. Let me know what you want to see next - you might not have to wait that long!

We've just launched Maple Flow 2023!

The new release offers many enhancements that help you calculate and write reports faster, resulting in polished technical documents. Let me describe a few of my favorite new features below.

You can now change the units of results inline in the canvas, without taking your hands off the keyboard. You can still use the Context Panel, but the new method is faster and enhances the fluid workflow that Flow exemplifies.

You can also enter a partial unit inline; Flow will automatically insert more units to dimensionally balance the system.

This is useful when results are returned in base dimensions (like time, length and mass) but you want to rescale to higher-level derived units. For an energy analysis, for example, you might guess that the result should contain units of Joules, plus some other units, but you don't know what those other units are; now, you can request that the result contains Joules, and Flow fills the rest in automatically.

The new Variables Palette lists all the user-defined variables and functions known to Flow at the point of the cursor. If you move your grid cursor up or down, the variables palette intelligently removes or adds entries.

You can now import an image by simply dragging it from a file explorer into the canvas.

This is one of those small quality-of-life enhancement that makes Flow a pleasure to use.

You can now quickly align containers to create ordered, uncluttered groups.

We've packed a lot more into the new release - head on over here for a complete rundown. And if you're tempted, you can get a trial here.

We have a lot more in the pipeline - the next 12 months will be very exciting. Let me know what you think!

We've just released Maple Flow 2022.2. The update enhances the user experience in many areas, including user interaction, performance, and the interface.

Performance is a signficant focus.

  • Maple Flow prioritizes the evaluation of the math you see on screen, giving you faster calculation updates for the part of the worksheet you’re working on, with more math being evaluated as you scroll down.
  • We also have more users developing larger documents. Adding white space to large documents, and interacting with sections is now more response and snappier.

In response to many user requests for faster interaction, a new optional evaluation method lets you simply hit equals to evaluate math and display results.

We've also refreshed the in-product Application Gallery with a new look and many new applications (this includes a library of section properties).


 

You can also optionally restrict printing to the left-most column of pages, allowing you to have off-screen supporting calculations not displayed in the final report.

You'll find a complete list of enhhacements here, and you can download the update here.

Mathematical visualizations are beautiful representations of technical phenomena.  From the visual “perfection” of the golden spiral to the pattern generation of fractals, so many works of art can be boiled down to formulas and equations.  Such is the case with N.G. de Bruijn’s medallion and frieze patterns.  Given two starting values, two lines of mathematical formulae produce a recursive sequence of complex numbers.  We can associate these numbers with the four cardinal directions, following the steps on a plot to produce beautiful patterns.  The patterns are of two different types, the closed medallion or repeating frieze, depending on the starting values.

When you need a complex math visualization, Maple is a perfect place to go.  A demonstration of medallion and frieze patterns is available in the Maple Application Center, in which you can vary the starting values and watch the outcome change, along with more detailed background information.  However, there’s an even simpler way to explore this program with the help of Maple Learn.  Maple Learn has the same computational power as Maple, streamlined into an easy-to-use notebook style.  

Maple Learn includes many core features, and anything missing can be ported in through Maple.  This is done using Maple’s DocumentTools:-Canvas package.  The package contains the necessary procedures to convert Maple code into a “canvas”, which can be opened as a Maple Learn sheet.  This makes the whole document look cleaner and allows for easy sharing with friends.

The medallion and frieze document, along with the additional contextual information, is now also available in Maple Learn’s Document Gallery, home to over one thousand example documents covering calculus, geometry, physics, and more.

We've just released Maple Flow 2022.1. We've squeezed in a few new features as requested by our users - I'll describe them below.

Before we get to that, I'd like to give everyone an open invitation to grab a Maple Flow trial - I'd love to know what you think. I'm fanatically devoted to making Flow better, but I can only do that if you give me your feedback.

You can specify if you want your results to be globally displayed using engineering, scientific, or fixed notation

Supporting images can be cut and pasted from another source directly into Maple Flow using standard clipboard operations.

You can now insert a time stamp in headers and footers. And you can optionally place a border around the header, footer or body of the page.

New content in the help system makes it easier to get started with advanced features, including techniques for optimization and signal processing.

Go here to learn more...and don't forget to grab a trial.

 

We’ve just released Maple Flow 2022!

The name of the product – Flow - references a psychological concept known as the flow state. You might know it as being in the zone. That’s when you’re so immersed in your present task that outside distractions melt away, your problem solving skills are firing on all four cylinders, and feel-good neurochemicals flood your brain.

Maple Flow supports a mathematical flow state through a simple design that productively guides the loosely structured and somewhat haphazard way that most people work.

Since Maple Flow's release a year ago, we've regularly added new features through updates, and we're commited to maintaining that momentum. These updates are driven by user feedback, so keep sending your comments and requests my way.

Here’s what we have lined up for you in Flow 2022.

Flow 2022 features a new in-product help system - see it in action here:

In addition to copying & pasting equations and expressions from a help page, you can open entire help pages as worksheets. The nature of Flow means that the help pages have a certain immediacy that becomes very tangible once you start working with them.

You can change the background colour of containers to highlight important results or draw the reader's attention to specific groups of containers.

Prior versions of Flow were a toolbox that needed to be installed on top of Maple.

Now, Flow 2022 is completely standalone, and does not require an existing installation of Maple.This makes managing an installation of Flow far simpler.

A new options menu let you specify how you want worksheet hyperlinks to open – in the same application window, or in a new application window.

We've also made many other quality-of-life changes to Flow. Head on over to the Maple Flow website to learn more or download an evaluation.

I’m excited to announce the launch of a new math tool called Maple Flow. Here, I’ll outline our motivation for developing this product, and talk about its features.

A large fraction of Maple users are professional engineers .

All use Maple, but very few say that they do math for a living, in much the same way a plumber wouldn’t say they use a wrench for a living.

They say things like:

  • I design concrete retaining walls
  • I simulate the transients on a transmission line
  • I design heat exchangers
  • I model the absorbency of diapers
  • I design subsea pipelines
  • I need to optimize the trajectory of a space shuttle
  • I work for a power generation company doing load flow analysis
  • I model how a robot arm needs to move

Some of these applications are mathematically simple (but are based on scientific principles, such as the conservation of heat, mass and momentum). The equations consist of basic arithmetic operations, trig and log functions, sprinkled with the occasional numeric integration.

Sometimes, the equations are already formalized in design guides, published by organizations like the IEEE, ASME or ISO. Given the specific physical context, engineers just need to implement the calculations in the right order (this is especially true for Civil and Structural engineering). These applications require you to think at an engineering level.

These are what we call design calculations, done by design engineers.

On the other end of the spectrum, some of these applications are mathematically complex. You might need to derive equations, manipulate PDEs, work with quaternions or transformation matrices, or do some programming. These applications require you to think at a mathematical level.

Let’s call the engineers doing this type of work research engineers. Research engineers are often more closely aligned with mathematicians than design engineers.

So we have design engineers and research engineers (and of course we have engineers with feet in both camps, to a varying degree).

Research engineers and design engineers do different mathematical things, and have different mathematical needs. Both groups use Maple, but one size doesn’t always fit well. Either the toe pinches a little, or the shirt is a mite too baggy.

This is where Maple Flow enters stage right.

Maple Flow is a new tool that we’ve built (and are continuing to expand and improve) with the needs of design engineers in mind.

  • The worksheet lets you put math anywhere – just point, click and type
  • The evaluation model is forward-in-space (unlike Maple’s forward in time evaluation model). This means the execution order is explicitly given by the position of the math on the canvas.
  • The worksheet updates automatically, so results are never stale
  • We’ve made several simplifications to massage away some of the complexity of the Maple programming language.
  • You can use nearly all of tools in the Maple programming language.

Here’s how we see people using Maple Flow. They

  • Enter a few major equations somewhere, followed by some parameters scattered around
  • Make the equations “see” the parameters by moving the parameters above the equations
  • Insert any parameters or equations you’ve forgotten, and move them into position, shifting the existing content out of the way to make room
  • Add text, and perhaps an image or plot
  • Finally, align math and format text for a presentable document

I’ve been using Maple Flow for a while now. I like the fact that the nature of Maple Flow means that you don’t have to start with a grand plan, with every computational detail planned out in advance. You’re encouraged to make things up as you go along, and gradually sculpt your calculations into shape.

Basically, Maple Flow doesn’t issue stiff penalties for making mistakes. You fix them, and then move on.

I also like that Maple Flow makes you feel like you’re “touching” your equations, shifting things about easily with either the mouse or the keyboard. There’s a certain tactility and immediacy to Maple Flow that gives me a micro dose of dopamine every time I use it.

Maple Flow’s freeform interface lets you experiment with space, alignment and layout, drawing attention to different groups of equations.

For example, you can design calculation documents that look like this.

You can use nearly all of the Maple programming language in Flow. Here’s a command from the plots package.

Here’s fsolve in action.

The Maple Flow website has more information, including a demo video.

As ever, your feedback is gratefully received.

 

I’ll admit it. There are times when I don't fully understand every mathematical advancement each release of Maple brings. Given the breadth of what Maple does, I guess that isn't surprising.

In development meetings, I make the pretence of keeping up by looking serious, nodding knowingly and occasionally asking to go back to the previous slide “for a minute”. I’ve been doing this since 2008 and no one’s caught on yet.

But I do understand

  • the joy on a user’s (Zoom) face when they finally solve a complex problem with a new version of Maple
  • the smiley emojis that students send us when they understand a tricky math concept with the help of an improved Maple tutor
  • and the wry smile on a developer’s face when they get to work on a project they really want to work on, and the bigger smile when that project gets positive feedback

These are all moments that give me that magic dopamine hit.

The job that Karishma and I have is to make users happy. We don’t have to be top-flight mathematicians, engineers or computer scientists to do that. We just have to know what itch to scratch.

Here’s some things I think might give you that dopamine hit when you get your hands on Maple 2021. You can also explore the new release yourself at What’s New in Maple 2021.

Worksheet mode has been my go-to interface for when I just want to get stuff done. This is mostly because worksheet mode always felt like a more structured environment for developing math when I didn’t have all the steps planned out in advance, and I found that structure helpful. I’d use Document mode when I needed to use the Context Panel for math operations and didn’t want to see the commands, or I needed to create a nice looking document without input carets. And this was fine – each mode has its own strengths and uses – but I what I really wanted was the best of both worlds in a single environment.

This year, we’ve made one change that has let me transition far more of my work into Document mode.

In Document Mode, pressing Enter in a document block (math input) now always moves the cursor to the next math input (in previous releases, the cursor may have moved to the start of the next line of text).

This means you can now quickly update parameters and see the downstream effects with just the Enter key – previously, a key benefit of worksheet mode only.

There’s another small change we’ve made - inserting new math inputs.  In previous releases of Maple, you could only insert new document blocks above the in-focus block using a menu item or a three-key shortcut.

In Maple 2021, if you move the insertion point to the left of a document block (Home position), the cursor is now bold, as illustrated here:

Now, if you press Enter, the in-focus prompt is moved down and a new empty math input is created.

Once you get used to this change, Ctrl+Shift+K seems like a distance memory!

@Scot Gould logged a request that Maple numerically solve a group of differential equations collected together in a vector. And now you can!

Before Maple 2021, this expression was unchanged after evaluation. Now, it is satisfyingly simpler.

We’ve dramatically increased the scope of the signal processing package.             

My favorite addition is the MUSIC function. With some careful tuning, you can generate a pseudo power spectrum at frequencies smaller than one sample.

First generate a noisy data set with three frequencies (two frequencies are closer than one DFT bin).

with(SignalProcessing): 
num_points:= 2^8: 
sample_rate := 100.0:
T := Vector( num_points, k -> 2 * Pi * (k-1) / sample_rate, 'datatype' = 'float[8]' ): 
noisy_signal:=Vector( num_points, k -> 5 * sin( 10.25 * T[k] ) + 3 * sin( 10.40 * T[k] ) - 7 * sin( 20.35 * T[k] )) + LinearAlgebra:-RandomVector(num_points, generator=-10..10):
dataplot(noisy_signal, size = [ 800, 400 ], style = line)

 

Now generate a standard periodogram

Periodogram( noisy_signal, samplerate = sample_rate, size = [800, 400] )

This approach can’t discriminate between the two closely spaced frequencies.

And now the MUSIC pseudo spectrum

MUSIC( noisy_signal, samplerate = sample_rate, dimension = 6, output = plot );

The Maple Quantum Chemistry Toolbox from RDMChem, a separate add-on product to Maple, is a powerful environment for the computation and visualization of the electronic structure of molecules. I don’t pretend to understand most of what it does (more knowing nods are required). But I did get a kick out of its new molecular dictionary. Did you know that caffeine binds to adenosine receptors in the central nervous system (CNS), which inhibits adenosine binding? Want to know more about the antiviral drug remdesivir? Apparently it looks like this:

We put a lot of work into resources for students and educators in this release, including incorporating study guides for Calculus, Precalculus, and Multivariate Calculus, a new student package for ODEs, and the ability to obtain step-by-step solutions to even more problems.  But my favourite thing out of all this work is the new SolvePractice command in the Grading Tools package.  Because it lets you build an application that does this:

I like this for three main reasons:

  1. It lets students practise solving equations in a way that actually helps them figure out what they’ve done wrong, saving them from a spiral of frustration and despair
  2. The same application can be shared via Maple Learn for students to use in that environment if they don’t have Maple
  3. The work we did to create that “new math entry box” can also be used to create other Maple applications with unknown numbers of inputs (see DocumentTools). I’m definitely planning on using this feature in my own applications.

Okay, yes, we know. Up until recently, our LaTeX export has been sadly lacking. It definitely got better last year, but we knew it still wasn’t good enough. This year, it’s good. It’s easy. It works.  And it’s not just me saying this. The feedback we got during the beta period on this feature was overwhelmingly positive.

That’s just the tip of the Maple 2021 iceberg of course. You can find out more at What’s New in Maple 2021.  Enjoy!

 

Maple 2020 offers many improvements motivated and driven by our users.

Every single update in a new release has a story behind it. It might be a new function that a customer wants, a response to some feedback about usability, or an itch that a developer needs to scratch.

I’ll end this post with a story about acoustic guitars and how they drove improvements in signal and audio processing. But first, here are some of my personal favorites from Maple 2020.

Graph theory is a big focus of Maple 2020. The new features include more control over visualization, additional special graphs, new analysis functions, and even an interactive layout tool.

I’m particularly enamoured by these:

  • We’ve introduced new centrality measures - these help you determine the most influential vertices, based on their connections to other vertices
  • You now have more control over the styling of graphs – for example, you can vary the size or color of a nodebased on its centrality

I’ve used these two new features to identify the most influential MaplePrimes users. Get the worksheet here.

@Carl Love – looks like you’re the biggest mover and shaker on MaplePrimes (well, according to the eigenvector centrality of the MaplePrimes interaction graph).

We’ve also started using graph theory elsewhere in Maple. For example, you can generate static call graph to visualize dependencies between procedures calls in a procedure

You now get smoother edges for 3d surfaces with non-numeric values. Just look at the difference between Maple 2019 and 2020 for this plot.

Printing and PDF export has gotten a whole lot better.  We’ve put a lot of work into the proper handling of plots, tables, and interactive components, so the results look better than before.

For example, plots now maintain their aspect ratio when printed. So your carefully constructed psychrometric chart will not be squashed and stretched when exported to a PDF.

We’ve overhauled the start page to give it a cleaner, less cluttered look – this is much more digestible for new users (experienced users might find the new look attractive as well!). There’s a link to the Maple Portal, and an updated Maple Fundamentals guide that helps new users learn the product.

We’ve also linked to a guide that helps you choose between Document and Worksheet, and a link to a new movie.

New messages also guide new users away from some very common mistakes. For example, students often type “e” when referring to the exponential constant – a warning now appears if that is detected

We’re always tweaking existing functions to make them faster. For example, you can now compute the natural logarithm of large integers much more quickly and with less memory.

This calculation is about 50 times faster in Maple 2020 than in prior versions:

Many of our educators have asked for this – the linear algebra tutorials now return step by step solutions to the main document, so you have a record of what you did after the tutor is closed.

Continuing with this theme, the Student:-LinearAlgebra context menu features several new linear algebra visualizations to the Student:-LinearAlgebra Context Menu. This, for example, is an eigenvector plot.

Maple can now numerically evaluate various integral transforms.

The numerical inversion of integral transforms has application in many branches of science and engineering.

Maple is the world’s best tool for the symbolic solution of ODEs and PDEs, and in each release we push the boundary back further.

For example, Maple 2020 has improved tools for find hypergeometric solutions for linear PDEs.

This might seem like a minor improvement that’s barely worth mentions, but it’s one I now use all the time! You can now reorder worksheet tabs just by clicking and dragging.

The Hough transform lets you detect straight lines and line segments in images.

Hough transforms are widely used in automatic lane detection systems for autonomous driving. You can even detect the straight lines on a Sudoku grid!

The Physics package is always a pleasure to write about because it's something we do far better than the competition.

The new explore option in TensorArray combines two themes in Maple - Physics and interactive components. It's an intuitive solution to the real problem of viewing the contents of higher dimensional tensorial expressions.

There are many more updates to Physics in Maple 2020, including a completely rewritten FeynmanDiagrams command.

The Quantum Chemistry Toolbox has been updated with more analysis tools and curriculum material.

There’s more teaching content for general chemistry.

Among the many new analysis functions, you can now visualize transition orbitals.

I promised you a story about acoustic guitars and Maple 2020, didn’t I?

I often start a perfectly innocuous conversation about Maple that descends into several weeks of intense, feverish work.

The work is partly for me, but mostly for my colleagues. They don’t like me for that.

That conversation usually happens on a Friday afternoon, when we’re least prepared for it. On the plus side, this often means a user has planted a germ of an idea for a new feature or improvement, and we just have to will it into existence.

One Friday afternoon last year, I was speaking to a user about acoustic guitars. He wanted to synthetically generate guitar chords with reverb, and export the sound to a 32-bit Wave file. All of this, in Maple.

This started a chain of events that that involved least-square filters, frequency response curves, convolution, Karplus-Strong string synthesis and more. We’ll package up the results of this work, and hand it over to you – our users – over the next one or two releases.

Let me tell you what made it into Maple 2020.

Start by listening to this:

It’s a guitar chord played twice, the second time with reverb, both generated with Maple.

The reverb was simulated with convolving the artificially generated guitar chord with an impulse response. I had a choice of convolution functions in the SignalProcessing and AudioTools packages.

Both gave the same results, but we found that SignalProcessing:-Convolution was much faster than its AudioTools counterpart.

There’s no reason for the speed difference, so R&D modified AudioTools:-Convolution to leverage SignalProcessing:-Convolution for the instances for which their options are compatible. In this application, AudioTools:-Convolution is 25 times faster in Maple 2020 than Maple 2019!

We also discovered that the underlying library we use for the SignalProcessing package (the Intel IPP) gives two options for convolution that we were previously not using; a method which use an explicit formula and a “fast” method that uses FFTs. We modified SignalProcessing:-Convolution to accept both options (previously, we used just one of the methods),

That’s the story behind two new features in Maple 2020. Look at the entirety of what’s new in this release – there’s a tale for each new feature. I’d love to tell you more, but I’d run out of ink before I finish.

To read about everything that’s new in Maple 2020, go to the new features page.

While googling around for Season 8 spoilers, I found data sets that can be used to create a character interaction network for the books in the A Song of Ice and Fire series, and the TV show they inspired, Game of Thrones.

The data sets are the work of Dr Andrew Beveridge, an associate professor at Macalaster College (check out his Network of Thrones blog).

You can create an undirected, weighted graph using this data and Maple's GraphTheory package.

Then, you can ask yourself really pressing questions like

  • Who is the most influential person in Westeros? How has their influence changed over each season (or indeed, book)?
  • How are Eddard Stark and Randyll Tarly connected?
  • What do eigenvectors have to do with the battle for the Iron Throne, anyway?

These two applications (one for the TV show, and another for the novels) have the answers, and more.

The graphs for the books tend to be more interesting than those for the TV show, simply because of the far broader range of characters and the intricacy of the interweaving plot lines.

Let’s look at some of the results.

This a small section of the character interaction network for the first book in the A Song of Ice and Fire series (this is the entire visualization - it's big, simply because of the shear number of characters)

The graph was generated by GraphTheory:-DrawGraph (with method = spring, which models the graph as a system of protons repelling each other, connected by springs).

The highlighted vertices are the most influential characters, as determined by their Eigenvector centrality (more on this later).

 

The importance of a vertex can be described by its centrality, of which there are several variants.

Eigenvector centrality, for example, is the dominant eigenvector of the adjacency matrix, and uses the number and importance of neighboring vertices to quantify influence.

This plot shows the 15 most influential characters in Season 7 of the TV show Game of Thrones. Jon Snow is the clear leader.

Here’s how the Eigenvector centrality of several characters change over the books in the A Song of Ice and Fire series.

A clique is a group of vertices that are all connected to every other vertex in the group. Here’s the largest clique in Season 7 of the TV show.

Game of Thrones has certainly motivated me to learn more about graph theory (yes, seriously, it has). It's such a wide, open field with many interesting real-world applications.

Enjoy tinkering!

Last year, I read a fascinating paper that presented evidence of an exoplanet, inferred through the “wobble” (or radial velocity) of the star it orbits, HD 3651. A periodogram of the radial velocity revealed the orbital period of the exoplanet – about 62.2 days.

I found the experimental data and attempted to reproduce the periodogram. However, the data was irregularly sampled, as is most astronomical data. This meant I couldn’t use the standard Fourier-based tools from the signal processing package.

I started hunting for the techniques used in the spectral analysis of irregularly sampled data, and found that the Lomb Scargle approach was often used for astronomical data. I threw together some simple prototype code and successfully reproduced the periodogram in the paper.

 

After some (not so) gentle prodding, Erik Postma’s team wrote their own, far faster and far more robust, implementation.

This new functionality makes its debut in Maple 2019 (and the final worksheet is here.)

From a simple germ of an idea, to a finished, robust, fully documented product that we can put in front of our users – that, for me, is incredibly satisfying.

That’s a minor story about a niche I’m interested in, but these stories are repeated time and time again.  Ideas spring from users and from those that work at Maplesoft. They’re filtered to a manageable set that we can work on. Some projects reach completion in under a year, while other, more ambitious, projects take longer.

The result is software developed by passionate people invested in their work, and used by passionate people in universities, industry and at home.

We always pack a lot into each release. Maple 2019 contains improvements for the most commonly used Maple functions that nearly everyone uses – such as solve, simplify and int – as well features that target specific groups (such as those that share my interest in signal processing!)

I’d like to to highlight a few new of the new features that I find particularly impressive, or have just caught my eye because they’re cool.

Of course, this is only a small selection of the shiny new stuff – everything is described in detail on the Maplesoft website.

Edgardo, research fellow at Maplesoft, recently sent me a recent independent comparison of Maple’s PDE solver versus those in Mathematica (in case you’re not aware, he’s the senior developer for that function). He was excited – this test suite demonstrated that Maple was far ahead of its closest competitor, both in the number of PDEs solved, and the time taken to return those solutions.

He’s spent another release cycle working on pdsolve – it’s now more powerful than before. Here’s a PDE that Maple now successfully solves.

Maplesoft tracks visits to our online help pages - simplify is well-inside the top-ten most visited pages. It’s one of those core functions that nearly everyone uses.

For this release, R&D has made many improvements to simplify. For example, Maple 2019 better simplifies expressions that contain powers, exponentials and trig functions.

Everyone who touches Maple uses the same programming language. You could be an engineer that’s batch processing some data, or a mathematical researcher prototyping a new algorithm – everyone codes in the same language.

Maple now supports C-style increment, decrement, and assignment operators, giving you more concise code.

We’ve made a number of improvements to the interface, including a redesigned start page. My favorite is the display of large data structures (or rtables).

You now see the header (that is, the top-left) of the data structure.

For an audio file, you see useful information about its contents.

I enjoy creating new and different types of visualizations using Maple's sandbox of flexible plots and plotting primitives.

Here’s a new feature that I’ll use regularly: given a name (and optionally a modifier), polygonbyname draws a variety of shapes.

In other breaking news, I now know what a Reuleaux hexagon looks like.

Since I can’t resist talking about another signal processing feature, FindPeakPoints locates the local peaks or valleys of a 1D data set. Several options let you filter out spurious peaks or valleys

I’ve used this new function to find the fundamental frequencies and harmonics of a violin note from its periodogram.

Speaking of passionate developers who are devoted to their work, Edgardo has written a new e-book that teaches you how to use tensor computations using Physics. You get this e-book when you install Maple 2019.

The new LeastTrimmedSquares command fits data to an equation while not being signficantly influenced by outliers.

In this example, we:

  • Artifically generate a noisy data set with a few outliers, but with the underlying trend Y =5 X + 50
  • Fit straight lines using CurveFitting:-LeastSquares and Statistics:-LeastTrimmedSquares

LeastTrimmedSquares function correctly predicts the underlying trend.

We try to make every release faster and more efficient. We sometimes target key changes in the core infrastructure that benefit all users (such as the parallel garbage collector in Maple 17). Other times, we focus on specific functions.

For this release, I’m particularly impressed by this improved benchmark for factor, in which we’re factoring a sparse multivariate polynomial.

On my laptop, Maple 2018 takes 4.2 seconds to compute and consumes 0.92 GiB of memory.

Maple 2019 takes a mere 0.27 seconds, and only needs 45 MiB of memory!

I’m a visualization nut, and I always get a vicarious thrill when I see a shiny new plot, or a well-presented application.

I was immediately drawn to this new Maple 2019 app – it illustrates the transition between day and night on a world map. You can even change the projection used to generate the map. Shiny!

 

So that’s my pick of the top new features in Maple 2019. Everyone here at Maplesoft would love to hear your comments!

You might recall this image being shared on social media some time ago.

Source: http://cvcl.mit.edu/hybrid_gallery/monroe_einstein.html

Look closely and you see Albert Einstein. However, if you move further away (or make the image smaller), you see Marilyn Monroe.

To create the image, the high spatial frequency data from an image of Albert Einstein was added to the low spatial frequency data from an image of Marilyn Monroe. This approach was pioneered by Oliva et al. (2006) and is influenced by the multiscale processing of human vision.

  • When we view objects near us, we see fine detail (that is, higher spatial frequencies dominate).

  • However, when we view objects at a distance, the broad outline has greater influence (that is, lower spatial frequencies dominate).

I thought I'd try to create a similar image in Maple (get the complete application here).

Here's an overview of the approach (as outlined in Oliva et al., 2006). I used different source images of Einstein and Monroe.

Let's start by loading some packages and defining a few procedures.

restart:
with(ImageTools):
with(SignalProcessing):

fft_shift := proc(M)
   local nRows, nCols, quad_1, quad_2, quad_3, quad_4, cRows, cCols;
   nRows, nCols := LinearAlgebra:-Dimensions(M):
   cRows, cCols := ceil(nRows/2), ceil(nCols/2):
   quad_1 := M[1..cRows,      1..cCols]:
   quad_2 := M[1..cRows,      cCols + 1..-1]:  
   quad_3 := M[cRows + 1..-1, cCols + 1..-1]:
   quad_4 := M[cRows + 1..-1, 1..cCols]:
   return <<quad_3, quad_2 |quad_4, quad_1>>:
end proc:

PowerSpectrum2D := proc(M)
   return sqrt~(abs~(M))
end proc:

gaussian_filter := (a, b, sigma) -> Matrix(2 * a, 2 * b, (i, j) -> evalf(exp(-((i - a)^2 + (j - b)^2) / (2 * sigma^2))), datatype = float[8]):

fft_shift() swaps quadrants of a 2D Fourier transform around so that the zero frequency components are in the center.

PowerSpectrum2D() returns the spectra of a 2D Fourier transform

gaussian_filter() will be used to apply a high or low-pass filter in the frequency domain (a and b are the number of rows and columns in the 2D Fourier transform, and sigma is the cut-off frequency.

Now let's import and display the original Einstein and Monroe images (both are the same size).

einstein_img := Read("einstein.png")[..,..,1]:
Embed(einstein_img)

marilyn_img  := Read("monroe.png")[..,..,1]:
Embed(monroe_img)

Let's convert both images to the spatial frequency domain (not many people know that SignalProcessing:-FFT can calculate the Fourier transform of matrices).

einstein_fourier := fft_shift(FFT(einstein_img)):
monroe_fourier   := fft_shift(FFT(monroe_img)):

Visualizing the power spectra of the unfiltered and filtered images isn't necessary, but helps illustrate what we're doing in the frequency domain.

First the spectra of the Einstein image. Lower frequency data is near the center, while higher frequency data is further away from the center.

Embed(Create(PowerSpectrum2D(einstein_fourier)))

Now the spectra of the Monroe image.

Embed(Create(PowerSpectrum2D(monroe_fourier)))

Now we need to filter the frequency content of both images.

First, define the cutoff frequencies for the high and low pass Gaussian filters.

sigma_einstein := 25:
sigma_monroe   := 10:

In the frequency domain, apply a high pass filter to the Einstein image, and a low pass filter to the Monroe image.

nRows, nCols := LinearAlgebra:-Dimension(einstein_img):

einstein_fourier_high_pass := einstein_fourier *~ (1 -~ gaussian_filter(nRows/2, nCols/2, sigma_einstein)):
monroe_fourier_low_pass    := monroe_fourier   *~ gaussian_filter(nRows/2, nCols/2, sigma_monroe):

Here's the spectra of the Einstein and Monroe images after the filtering (compare these to the pre-filtered spectra above).

Embed(Create(PowerSpectrum2D(einstein_fourier_high_pass)))

Embed(Create(PowerSpectrum2D(monroe_fourier_low_pass)))

Before combining both images in the Fourier domain, let's look the individual filtered images.

einstein_high_pass_img := Re~(InverseFFT(fft_shift(einstein_fourier_high_pass))):
monroe_low_pass_img    := Re~(InverseFFT(fft_shift(monroe_fourier_low_pass))):

We're left with sharp detail in the Einstein image.

Embed(FitIntensity(Create(einstein_high_pass_img)))

But the Monroe image is blurry, with only lower spatial frequency data.

Embed(FitIntensity(Create(monroe_low_pass_img)))

For the final image, we're simply going to add the Fourier transforms of both filtered images, and invert to the spatial domain.

hybrid_image := Create(Re~(InverseFFT(fft_shift(monroe_fourier_low_pass + einstein_fourier_high_pass)))):
Embed(hybrid_image)

So that's our final image, and has a similar property to the hybrid image at the top of this post.

  • Move close to the computer monitor and you see Albert Einstein.
  • Move to the other side of the room, and Marilyn Monroe swims into vision (if you're myopic, just take off your glasses and don't move back as much).

To simulate this, here, I've successively reduced the size of the hybrid image

And just because I can, here's a hybrid image of a cat and a dog, generated by the same worksheet.

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

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!

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).

At your fingertips, you have

  • 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

1 2 3 4 Page 1 of 4