MaplePrimes Posts

MaplePrimes Posts are for sharing your experiences, techniques and opinions about Maple, MapleSim and related products, as well as general interests in math and computing.

Latest Post
  • Latest Posts Feed
  • Hi

    The Physics Updates for Maple 2019 (current v.331 or higher) is already available for installation via MapleCloud. This version contains further improvements to the Maple 2019 capabilities for solving PDE & BC as well as to the tensor simplifier. To install these Updates,

    • Open Maple,
    • Click the MapleCloud icon in the upper-right corner to open the MapleCloud toolbar 
    • In the MapleCloud toolbar, open Packages
    • Find the Physics Updates package and click the install button, it is the last one under Actions
    • To check for new versions of Physics Updates, click the MapleCloud icon. If the Updates icon has a red dot, click it to install the new version

    Note that the first time you install the Updates in Maple 2019 you need to install them from Packages, even if in your copy of Maple 2018 you had already installed these Updates.

    Also, at this moment you cannot use the MapleCloud to install the Physics Updates for Maple 2018. So, to install the last version of the Updates for Maple 2018, open Maple 2018 and enter PackageTools:-Install("5137472255164416", version = 329, overwrite)

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

    This application solves a set of compatible equations of two variables. It also graphs the intersection point of the variable "x" and "y". If we want to observe the intersection point closer we will use the zoom button that is activated when manipulating the graph. If we want to change the variable ("x" and "y") we enter the code of the button that solves and graphs. In spanish.

    Lenin Araujo Castillo

    Ambassador of Maple

    Maple users often want to write a derivative evaluated at a point using Leibniz notation, as a matter of presentation, with appropriate variables and coordinates. For instance:


    Now, Maple uses the D operator for evaluating derivatives at a point, but this can be a little clunky:

    p := D[1,2,2,3](f)(a,b,c);
    q := convert( p, Diff );

    u := D[1,2,2,3](f)(5,10,15);
    v := convert( u, Diff );

    How can we tell Maple, programmatically, to print this in a nicer way? We amended the print command (see below) to do this. For example:

    print( D[1,2,2,3](f)(a,b,c), [x,y,z] );
    print( D[1,2,2,3](f)(5,10,15), [x,y,z] );

    print( 'D(sin)(Pi/6)', theta );

    Here's the definition of the custom version of print:

    # Type to check if an expression is a derivative using 'D', e.g. D(f)(a) and D[1,2](f)(a,b).
            proc( f )     
                   if op( [0,0], f ) <> D and op( [0,0,0], f ) <> D then
                           return false;
                   end if;       
                   if not type( op( [0,1], f ), 'name' ) or not type( { op( f ) }, 'set(algebraic)' ) then
                           return false;
                   end if;       
                   if op( [0,0,0], f ) = D and not type( { op( [0,0,..], f ) }, 'set(posint)' ) then
                           return false;
                   end if;       
                   return true;          
            end proc      
    # Create a local version of 'print', which will print expressions like D[1,2](f)(a,b) in a custom way,
    # but otherwise print in the usual fashion.
    local print := proc()
            local A, B, f, g, L, X, Y, Z;
            # Check that a valid expression involving 'D' is passed, along with a variable name or list of variable names.
            if ( _npassed < 2 ) or ( not _passed[1] :: 'Dexpr' ) or ( not passed[2] :: 'Or'('name','list'('name')) ) then
                   return :-print( _passed );
            end if;
            # Extract important variables from the input.
            g := _passed[1]; # expression
            X := _passed[2]; # variable name(s)
            f := op( [0,1], g ); # function name in expression
            A := op( g ); # point(s) of evaluation
            # Check that the number of variables is the same as the number of evaluation points.
            if nops( X ) <> nops( [A] ) then
                   return :-print( _passed );
            end if;
            # The differential operator.
            L := op( [0,0], g );
            # Find the variable (univariate) or indices (multivariate) for the derivative(s).
            B := `if`( L = D, X, [ op( L ) ] );
            # Variable name(s) as expression sequence.
            Y := op( X );
            # Check that the point(s) of evaluation is/are distinct from the variable name(s).
            if numelems( {Y} intersect {A} ) > 0 then
                   return :-print( _passed );
            end if;
            # Find the expression sequence of the variable names.
            Z := `if`( L = D, X, X[B] );
            return print( Eval( Diff( f(Y), Z ), (Y) = (A) ) );
    end proc:

    Do you use Leibniz Notation often? Or do you have an alternate method? We’d love to hear from you!

    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!

    It is my pleasure to announce the return of the Maple Conference! On October 15-17th, in Waterloo, Ontario, Canada, we will gather a group of Maple enthusiasts, product experts, and customers, to explore and celebrate the different aspects of Maple.

    Specifically, this conference will be dedicated to exploring Maple’s impact on education, new symbolic computation algorithms and techniques, and the wide range of Maple applications. Attendees will have the opportunity to learn about the latest research, share experiences, and interact with Maple developers.

    In preparation for the conference we are welcoming paper and extended abstract submissions. We are looking for presentations which fall into the broad categories of “Maple in Education”, “Algorithms and Software”, and “Applications of Maple” (a more extensive list of topics can be found here).

    You can learn more about the event, plus find our call-for-papers and abstracts, here:

    There have been several posts, over the years, related to visual cues about the values associated with particular 2D contours in a plot.

    Some people ask or post about color-bars [1]. Some people ask or post about inlined labelling of the curves [1, 2, 3, 4, 5, 6, 7]. And some post about mouse popup/hover-over functionality [1]., which got added as general new 2D plot annotation functionality in Maple 2017 and is available for the plots:-contourplot command via its contourlabels option.

    Another possibility consists of a legend for 2D contour plots, with distinct entries for each contour value. That is not currently available from the plots:-contourplot command as documented. This post is about obtaining such a legend.

    Aside from the method used below, a similar effect may be possible (possibly with a little effort) using contour-plotting approaches based on individual plots:-implicitplot calls for each contour level. Eg. using Kitonum's procedure, or an undocumented, alternate internal driver for plots:-contourplot.

    Since I like the functionality provided by the contourlabels option I thought that I'd highjack that (and the _HOVERCONTENT plotting substructure that plot-annotations now generate) and get a relatively convenient way to get a color-key via the 2D plotting legend.  This is not supposed to be super-efficient.

    Here below are some examples. I hope that it illustrates some useful functionality that could be added to the contourplot command. It can also be used to get a color-key for use with densityplot.


    contplot:=proc(ee, rng1, rng2)
      local clabels, clegend, i, ncrvs, newP, otherdat, others, tcrvs, tempP;
      (clabels,others):= selectremove(type,others,identical(:-contourlabels)=anything);
      if nops(clegend)>0 then
        if nops(clabels)>0 then
          return ':-PLOT'(seq(':-CURVES'(op(ncrvs[i]),op(indets(tcrvs[i],'specfunc(:-LEGEND)'))),
          return tempP;
        end if;
      elif nops(clabels)>0 then
        return plots:-contourplot(ee,rng1,rng2,others[],
        return plots:-contourplot(ee,rng1,rng2,others[]);
      end if;
    end proc:

    contplot(x^2+y^2, x=-2..2, y=-2..2,
          contours = 9,
          legendstyle = [location = right],

    contplot(x^2+y^2, x=-2..2, y=-2..2,
          contours = 17,
          legendstyle = [location = right],

    # Apparently legend items must be unique, to persist on document re-open.

    contplot(x^2+y^2, x=-2..2, y=-2..2,
          contours = 11,
          legendstyle = [location = right],
          legend=['contourvalue',seq(cat($(` `,i)),i=2..5),
                  'contourvalue',seq(cat($(` `,i)),i=6..9),

    contplot(x^2+y^2, x=-2..2, y=-2..2,
          contours = 8,

    contplot(x^2+y^2, x=-2..2, y=-2..2,
          contours = 13,