Samir Khan

1911 Reputation

20 Badges

16 years, 102 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.

MaplePrimes Activity


These are Posts that have been published by Samir Khan

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!

 

I like tweaking plots to get the look and feel I want, and luckily Maple has many plotting options that I often play with. Here, I visualize the same data several times, but each time with different styling.

First, some data.

restart:
data_1 := [[0,0],[1,2],[2,1.3],[3,6]]:
data_2 := [[0.5,3],[1,1],[2,5],[3,2]]:
data_3 := [[-0.5,3],[1.3,1],[2.5,5],[4.5,2]]:

This is the default look.

plot([data_1, data_2, data_3])

I think the darker background on this plot makes it easier to look at.

gray_grid :=
 background      = "LightGrey"
,color           = [ ColorTools:-Color("RGB",[150/255, 40 /255, 27 /255])
                    ,ColorTools:-Color("RGB",[0  /255, 0  /255, 0  /255])
                    ,ColorTools:-Color("RGB",[68 /255, 108/255, 179/255]) ]
,axes            = frame
,axis[2]         = [color = black, gridlines = [10, thickness = 1, color = ColorTools:-Color("RGB", [1, 1, 1])]]
,axis[1]         = [color = black, gridlines = [10, thickness = 1, color = ColorTools:-Color("RGB", [1, 1, 1])]]
,axesfont        = [Arial]
,labelfont       = [Arial]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,filled          = false
,transparency    = 0
,thickness       = 5
,style           = line:

plot([data_1, data_2, data_3], gray_grid);

I call the next style Excel, for obvious reasons.

excel :=
 background      = white
,color           = [ ColorTools:-Color("RGB",[79/255,  129/255, 189/255])
                    ,ColorTools:-Color("RGB",[192/255, 80/255,   77/255])
                    ,ColorTools:-Color("RGB",[155/255, 187/255,  89/255])]
,axes            = frame
,axis[2]         = [gridlines = [10, thickness = 0, color = ColorTools:-Color("RGB",[134/255,134/255,134/255])]]
,font            = [Calibri]
,labelfont       = [Calibri]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,transparency    = 0
,thickness       = 3
,style           = point
,symbol          = [soliddiamond, solidbox, solidcircle]
,symbolsize      = 15:

plot([data_1, data_2, data_3], excel)

This style makes the plot look a bit like the oscilloscope I have in my garage.

dark_gridlines :=
 background      = ColorTools:-Color("RGB",[0,0,0])
,color           = white
,axes            = frame
,linestyle       = [solid, dash, dashdot]
,axis            = [gridlines = [10, linestyle = dot, color = ColorTools:-Color("RGB",[0.5, 0.5, 0.5])]]
,font            = [Arial]
,size            = [400*1.78, 400]:

plot([data_1, data_2, data_3], dark_gridlines);

The colors in the next style remind me of an Autumn morning.

autumnal :=
 background      =  ColorTools:-Color("RGB",[236/255, 240/255, 241/255])
,color           = [  ColorTools:-Color("RGB",[144/255, 54/255, 24/255])
                     ,ColorTools:-Color("RGB",[105/255, 108/255, 51/255])
                     ,ColorTools:-Color("RGB",[131/255, 112/255, 82/255]) ]
,axes            = frame
,font            = [Arial]
,size            = [400*1.78, 400]
,filled          = true
,axis[2]         = [gridlines = [10, thickness = 1, color = white]]
,axis[1]         = [gridlines = [10, thickness = 1, color = white]]
,symbol          = solidcircle
,style           = point
,transparency    = [0.6, 0.4, 0.2]:

plot([data_1, data_2, data_3], autumnal);

In honor of a friend and ex-colleague, I call this style "The Swedish".

swedish :=
 background      = ColorTools:-Color("RGB", [0/255, 107/255, 168/255])
,color           = [ ColorTools:-Color("RGB",[169/255, 158/255, 112/255])
                    ,ColorTools:-Color("RGB",[126/255,  24/255,   9/255])
                    ,ColorTools:-Color("RGB",[254/255, 205/255,   0/255])]
,axes            = frame
,axis            = [gridlines = [10, color = ColorTools:-Color("RGB",[134/255,134/255,134/255])]]
,font            = [Arial]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,filled          = false
,thickness       = 10:

plot([data_1, data_2, data_3], swedish);

This looks like a plot from a journal article.

experimental_data_mono :=

background       = white
,color           = black
,axes            = box
,axis            = [gridlines = [linestyle = dot, color = ColorTools:-Color("RGB",[0.5, 0.5, 0.5])]]
,font            = [Arial, 11]
,legendstyle     = [font = [Arial, 11]]
,size            = [400, 400]
,labeldirections = [horizontal, vertical]
,style           = point
,symbol          = [solidcircle, solidbox, soliddiamond]
,symbolsize      = [15,15,20]:

plot([data_1, data_2, data_3], experimental_data_mono, legend = ["Annihilation", "Authority", "Acceptance"]);

If you're willing to tinker a little bit, you can add some real character and personality to your visualizations. Try it!

I'd also be very interested to learn what you find attractive in a plot - please do let me know.

So here's something silly but cool you can do with Maple while you're "working" from home.

  • Record a few seconds of your voice on a microphone that's close to your mouth (probably using a headset). This is your dry audio.
  • On your phone, record a single clap of your hands in an enclosed space, like your shower cubicle or a closet. Trim this audio to the clap, and the reverb created by your enclosed space. This is your impulse response.
  • Send both sound files to whatever computer you have Maple on.
  • Using AudioTools:-Convolution, convolve the dry audio with the impulse response . This your wet audio and should sound a little bit like your voice was recorded in your enclosed space.

Here's some code. I've also attached my dry audio, an impulse response recorded in my shower (yes, I stood inside my shower, closed the door, and recorded a single clap of my hands on my phone), and the resulting wet audio.

with( AudioTools ):
dry_audio := Read( "MaryHadALittleLamb_sc.wav" ):
impulse_response := Read( "clap_sc.wav" ):
wet_audio := Normalize( Convolution( dry_audio, impulse_response ) ):
Write("wet_audio.wav", wet_audio );

A full Maple worksheet is here.

AudioSamplesForReverb.zip

1 2 3 4 5 6 7 Last Page 2 of 12