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
  • My interface has frozen, but above is a screen shot of what is by far the most unusual response from the CAS in the i guess 8 or so years ive been using it in total.


    *updated situation its allowing me to interrupt evaluation

    The development of the calculation of moments using force vectors is clearly observed by taking a point and also a line. Different exercises are solved with the help of Maple syntax. We can also visualize the vector behavior in the different configurations of the position vector. Applications designed exclusively for engineering students. In Spanish.

    Lenin Araujo Castillo

    Ambassador of Maple

    A project that I have been working on is adding some functionality for Cluster Analysis to Maple (a small part of a much bigger project to increase Maple’s toolkit for exploratory data mining and data analysis). The launch of the MapleCloud package manager gave me a way to share my code for the project as it evolves, providing others with some useful new tools and hopefully gathering feedback (and collaborators) along the way.

    At this point, there aren’t a lot of commands in the ClusterAnalysis package, but I have already hit upon several interesting applications. For example, while working on a command for plotting clusters of points, one problem I encountered was how to draw the minimal volume enclosing ellipsoid around a group (or cluster) of points. After doing some research, I stumbled upon Khachiyan’s Algorithm, which related to solving linear programming problems with rational data. The math behind this is definitely interesting, but I’m not going to spend any time on it here. For further reading, you can explore the following:

    Khachiyan’s Algorithm had previously been applied in some other languages, but to the best of my knowledge, did not have any Maple implementations. As such, the following code is an implementation of Khachiyan’s Algorithm in 2-D, which could be extended to N-dimensional space rather easily.

    This routine accepts an Nx2 dataset and outputs either a plot of the minimum volume enclosing ellipsoid (MVEE) or a list of results as described in the details for the ‘output’ option below.

    MVEE( X :: DataSet, optional arguments, additional arguments passed to the plotting command );

    The optional arguments are as follows:

    • tolerance : realcons;  specifies the convergence criterion
    • maxiterations : posint; specifies the maximum number of iterations
    • output : {identical(data,plot),list(identical(data,plot))}; specifies the output. If output includes plot, then a plot of the enclosing ellipsoid is returned. If output includes data, then the return includes is a list containing the matrix A, which defines the ellipsoid, the center of the ellipse, and the eigenvalues and eigenvectors that can be used to find the semi-axis coordinates and the angle of rotation, alpha, for the ellipse.
    • filled : truefalse; specifies if the returned plot should be filled or not


    #Minimum Volume Enclosing Ellipsoid
    MVEE := proc(XY, 
                  {tolerance::positive:= 1e-4}, #Convergence Criterion
                  {maxiterations::posint := 100},
                  {output::{identical(data,plot),list(identical(data,plot))} := data},
                  {filled::truefalse := false} 

        local alpha, evalues, evectors, i, l_error, ldata, ldataext, M, maxvalindex, n, ncols, nrows, p1, semiaxes, stepsize, U, U1, x, X, y;
        local A, center, l_output; #Output

        if hastype(output, 'list') then
            l_output := output;
            l_output := [output];
        end if;


        ldata := Statistics:-PreProcessData(XY, 2, 'copy');

        nrows, ncols := upperbound(ldata);
        ldataext := Matrix([ldata, Vector[column](nrows, ':-fill' = 1)], 'datatype = float');

        if ncols <> 2 then
            error "expected 2 columns of data, got %1", ncols;
        end if;

        l_error := 1;

        U := Vector[column](1..nrows, 'fill' = 1/nrows);

        ##Khachiyan Algorithm##
        for n to maxiterations while l_error >= tolerance do

            X := LinearAlgebra:-Transpose(ldataext) . LinearAlgebra:-DiagonalMatrix(U) . ldataext;
            M := LinearAlgebra:-Diagonal(ldataext . LinearAlgebra:-MatrixInverse(X) . LinearAlgebra:-Transpose(ldataext));
            maxvalindex := max[index](map['evalhf', 'inplace'](abs, M));
            stepsize := (M[maxvalindex] - ncols - 1)/((ncols + 1) * (M[maxvalindex] - 1));
            U1 := (1 - stepsize) * U;
            U1[maxvalindex] := U1[maxvalindex] + stepsize;
            l_error := LinearAlgebra:-Norm(LinearAlgebra:-DiagonalMatrix(U1 - U));
            U := U1;

        end do;

        A := (1/ncols) * LinearAlgebra:-MatrixInverse(LinearAlgebra:-Transpose(ldata) . LinearAlgebra:-DiagonalMatrix(U) . ldata - (LinearAlgebra:-Transpose(ldata) . U) . LinearAlgebra:-Transpose((LinearAlgebra:-Transpose(ldata) . U)));
        center := LinearAlgebra:-Transpose(ldata) . U;
        evalues, evectors := LinearAlgebra:-Eigenvectors(A);
        evectors := evectors(.., sort[index](1 /~ (sqrt~(Re~(evalues))), `>`, ':-output' = ':-permutation'));
        semiaxes := sort(1 /~ (sqrt~(Re~(evalues))), `>`);
        alpha := arctan(Re(evectors[2,1]) / Re(evectors[1,1]));

        if l_output = [':-data'] then
            return A, center, evectors, evalues;
        elif has( l_output, ':-plot' ) then
                x := t -> center[1] + semiaxes[1] * cos(t) * cos(alpha) - semiaxes[2] * sin(t) * sin(alpha);
                y := t -> center[2] + semiaxes[1] * cos(t) * sin(alpha) + semiaxes[2] * sin(t) * cos(alpha);
                if filled then
                    p1 := plots:-display(subs(CURVES=POLYGONS, plot([x(t), y(t), t = 0..2*Pi], ':-transparency' = 0.95, _rest)));
                    p1 := plot([x(t), y(t), t = 0..2*Pi], _rest);
                end if;
            return p1, `if`( has(l_output, ':-data'), op([A, center, evectors, evalues]), NULL );
        end if;

    end proc:


    You can run this as follows:


                    plots:-pointplot(M, symbol=solidcircle,symbolsize=15)],



    As it stands, this is not an export from the “work in progress” ClusterAnalysis package – it’s actually just a local procedure used by the ClusterPlot command. However, it seemed like an interesting enough application that it deserved its own post (and potentially even some consideration for inclusion in some future more geometry-specific package). Here’s an example of how this routine is used from ClusterAnalysis:


    X := Import(FileTools:-JoinPath(["datasets/iris.csv"], base = datadir));

    kmeans_results := KMeans(X[[`Sepal Length`, `Sepal Width`]],
        clusters = 3, epsilon = 1.*10^(-7), initializationmethod = Forgy);

    ClusterPlot(kmeans_results, style = ellipse);



    The source code for this is stored on GitHub, here:

    Comments and suggestions are welcomed.


    If you don’t have a copy of the ClusterAnalysis package, you can install it from the MapleCloud window, or by running:



    These worksheets provide the volume calculations  of a small causal diamond near the tip of the past light cone, using dimensional analysis and particular test metrics.

    I recommend them for anyone working in causet theory on the problem of finding higher order corrections.





    With this app you will be able to interpret the curvatures generated by two position vectors, either in the plane or in space. Just enter the position vectors and drag the slider to calculate the curvature at different times and you will of course be able to observe its respective graph. At first I show you how it is developed using the natural syntax of Maple and then optimize our
     app with the use of buttons. App made in Maple for engineering students. In spanish.


    Lenin Araujo Castillo

    Ambassador of Maple

    There is a problem with mapleprimes favorites. 

    Looking at my list of favorites it cites I have 6 pages, however when I get to page 3 it shows a list of only six items and no more page listings after clicking the back button and going again to page 3 even less appear.  I was looking for specific questions and posts I have favorited which seem to be abscent from the listing. 

    Can mapleprimes administrators please address the problem?

    This is Maple:

    These are some primes:

    22424170499, 106507053661, 193139816479, 210936428939, 329844591829, 386408307611,
    395718860549, 396412723027, 412286285849, 427552056871, 454744396991, 694607189303,
    730616292977, 736602622363, 750072072203, 773012980121, 800187484471, 842622684461

    This is a Maple prime:

    In plain text (so you can check it in Maple!) that number is:


    This is a 3900 digit prime number. It took me about 400 seconds of computation to find using Maple.  Inspired by the Corpus Christi College Prime, I wanted to make an application in Maple to make my own pictures from primes.

    It turns out be be really easy to do because prime numbers are realy quite common.  If you have a piece of ascii art where all the characters are numerals, you could just call on it and get a prime number that is still ascii art with a couple digits in the corner messed up (for a number this size, I expect fewer than 10 of the least significant digits would be altered).  You may notice, however, that my Maple Prime has beautiful corners!  This is possible because I found the prime in a slightly different way.

    To get the ascii art in Maple, I started out by using to import ( )  and process the original image.  First then and to get a nice 78 pixel wide image.  Then to make it a pure 1-bit black or white image.

    Then, from the image, I create a new Array of the decimal digits of the ascii art and my prime number.  For each of the black pixels I randomly use one of the digits or and for the white pixels (the background) I use 's.  Now I convert the Array to a large integer and test if it is prime using (it probably isn't) so, I just randomly change one of the black pixels to a different digit (there are 4 other choices) and call again. For the Maple Prime I had to do this about 1000 times before I landed on a prime number. That was surprisingly fast to me! It is a great object lesson in how dense the prime numbers really are.

    So that you can join the fun without having to replicate my work, here is a small interactive Maple document that you can use to find prime numbers that draw ascii art of your source images. It has a tool that lets you preview both the pixelated image and the initial ascii art before you launch the search for the prime version.

    With this application you will learn the beginning of the study of the vectors. Graphing it in a vector space from the plane to the space. You can calculate its fundamental characteristics as triangle laws, projections and strength. App made entirely in Maple for engineering students so they can develop their exercises and save time. It is recommended to first use the native syntax then the embedded components. In Spanish.

    Movie #01

    Movie #02

    Movie #03

    Lenin Araujo Castillo

    Ambassador of Maple

    I'd like to present the following bugs in the IntTutor command.

    1. Initialize

    Student[Calculus1]:-IntTutor((1+cos(3*x))^(3/2), x);

    then press the All Steps button. The command produces the answer (see


    which is not correct in view of

    plot(diff((4/9)*sqrt(2)*sin((3/2)*x)^3-(4/3)*sqrt(2)*sin((3/2)*x), x)-(1+cos(3*x))^(3/2), x = 0 .. .2);

    One may compare it with the Mathematica result Step-by-step2.pdf.

    2. Initialize

    Student[Calculus1]:-IntTutor(cos(x)^2/(1+tan(x)), x);

    In the window press the Next Step button. This crashes (The kernel connection has been lost) my comp in approximately an half of hour (see screen2.docx). One may compare it with the Mathematica result Step-by-step.pdf .

    Indeed,  "We wanted the best, but it turned out like always" .

    This is a toy example illustrating three possible ways to define a group.

    An icosahedron:

    with(GroupTheory): with(Student[LinearAlgebra]): with(geom3d):
    icosahedron(ii): vv := vertices(ii):
    PLOT3D(POLYGONS(op(evalf(faces(ii))), TRANSPARENCY(.75)),
      op(zip(TEXT, 1.1*evalf(vv), [`$`(1..12)])), AXESSTYLE(NONE));

    The group of rotations is generated by the rotation around the diagonal (1,4) and the rotation around the line joining the midpoints of the edges (1,2) and (3,4), by the angles 2*Pi/5 and Pi respectively.

    Define the group by how the two rotations permute the 6 main diagonals of the icosahedron:

    gr := PermutationGroup({[[2, 5, 3, 4, 6]], [[1, 2], [5, 6]]});
                                 60, 5

    Or define the group by the relations between the two rotations:

    gr2 := FPGroup([a, b], [[a$5], [b$2], [a, b, a, b, a, b]]);
                                 60, 5

    Finally, define a group with elements that are rotation matrices:

    m1 := RotationMatrix(2*Pi/5, Vector(op(4, vv) - op(1, vv))):
    m2 := RotationMatrix(Pi, Vector(add(op(3..4, vv) - op(1..2, vv)))):
    m1, m2 := op(evala(convert([m1, m2], radical))):
    gr3 := CustomGroup([m1, m2], `.` = evala@`.`, `/` = evala@rcurry(`^`, -1), `=` = Equal);
                                 60, 5
    AreIsomorphic(SmallGroup(60, 5), AlternatingGroup(5));

    One question is how to find out that the group is actually A5 without looking up the group (60, 5) elsewhere.

    Also, it doesn't matter for this example, but adding `1`=IdentityMatrix(3) to the CustomGroup definition gives an error.


    With the launch of Maple 2017, we really wanted to showcase some of the amazing people that work so hard to make Maple. We wanted to introduce our developers to our awesome user community, put names to faces, and have some fun in the process.

    We’ll be doing this Q&A session from time to time with team members from the Maple, MapleSim, Maple T.A. and Möbius development groups.

    My first Q&A is with Math Architect, Paulina Chin. If you’re a regular MaplePrimes user, you’ll know her as @pchin. Let’s get right into the questions.

    1. What do you do at Maplesoft?

    I’m a member of the Math Software group. Much of my time goes toward developing and maintaining parts of the Maple library, but I occasionally develop Maple content related to math education as well.

    1. What did you study in school?

    I started in Applied Mathematics and then continued with graduate work in Computer Science and Electrical Engineering. My graduate and post-doc research  were in the area of numeric computation.

    1. What area(s) of Maple are you currently focusing on in your development?

    For many years, I’ve been working on the plotting and typesetting features in Maple. I also work on the Grading package and related applications.

    1. What’s the coolest feature of Maple that you’ve had a hand in developing?

    The Typesetting (2-D math) system in Maple is undoubtedly the most challenging and complex project I’ve worked on, and it involves careful coordination among a team of developers. I’m not sure others would see it as cool, because the features are not flashy like some of the visualization features I’ve worked on. However, whenever we implement a new feature and it works well, it’s really satisfying because it makes mathematics that much more accessible to users.

    1. What do you like most about working at Maplesoft? How long have you worked here?

    I’ve been at Maplesoft 17 years and my work has never been boring. I especially enjoy being surrounded by a very diverse and dedicated group of co-workers, and it’s terrific when we get new students, interns and visitors who come from all parts of the world. All of these people contribute to the great atmosphere here.

    1. Favorite hobby?

    I like discussing books as much as reading them. I run several book clubs, including the one here at Maplesoft. I also enjoy working with young people and volunteer at my daughter’s high school, helping students train for programming contests.

    1. What do you like on your pizza?

    Pineapple and hot peppers.

    1. What’s your favourite movie?

    I have so many favourites that it’s hard to answer this question. At the moment, I might say Notorious, The Empire Strikes Back, and Annie Hall, but ask me again next week and I’ll probably give you a different list.

    1. What skill would you love to learn? (That you haven’t already) Why?

    I wish I could play a musical instrument. I know a number of highly skilled amateur and professional musicians, and I’ve always admired their abilities.

    1. Who’s your favourite mathematician?

    I’d have to say it’s Euclid. When I was in Grade 6, my teacher saw I was bored with the math exercises we were doing and gave me a book on geometric constructions. That was the start of a life-long fascination with math. I even named my cat Euclid but she didn’t live up to the name, as she turned out to be lovable but not very smart.

    It can be interesting to consider a directional derivative of f(z) in the direction w:

    %ddiff(f(z), z, w) = %limit((f(z + w*h) - f(z))/(w*h), h = 0);
    ddiff := proc (fz0, z, dir) local rule, fz, dfz, ans;
      dfz := %ddiff(fz, z, dir)*dir;
      rule :=
       [abs(1, fz::anything) = (conjugate(fz)*dfz + fz*conjugate(dfz))/(2*abs(fz)*dfz),
        signum(1, fz::anything) = (conjugate(fz)*dfz - fz*conjugate(dfz))/(2*abs(fz)*conjugate(fz)*dfz)];
      ans := applyrule(rule, diff(fz0, z));
      ans := value(ans);
      ans := [ans, op(convert~(ans, [abs, argument, Re, Im, signum, conjugate]))];
      op(1, sort(simplify(ans, size), length)) end proc;

    For analytic functions the derivative is the same in any direction:

    ddiff(sqrt(Re(f(z))^2+Im(f(z))^2)*exp(I*argument(f(z))), z, w); # f(z) in disguise
                                --- f(z)

    For non-analytic functions that's no longer the case:

    ddiff(conjugate(z), z, w);
    ddiff(conjugate(f(z)), z, 1+I);
                              -I --- f(z)
    ddiff(abs(z), z, z);
    ddiff(ln(abs(z)), z, z);

    Some of those derivates have simple geometric interpretations: the derivative of argument(z) in the direction z is zero, since argument(z) doesn't change when moving in the direction z from the point z; the derivative of abs(z) in the direction I*z is zero, since the direction is tangent to the circle abs(z)=constant; since signum(z) is a function of argument(z) only, its derivative in the direction z is zero as well.

    Interestingly, the derivative taken twice in the direction z is zero for each of the six basic functions:

    map(fz -> ddiff(ddiff(fz, z, z), z, z), [abs, argument, Re, Im, signum, conjugate](z));
                           [0, 0, 0, 0, 0, 0]

    Does that have some simple geometric interpretation as well?


    I was asked if I would put together a list of top resources to help students who are using Maple for the first time.  An awful lot of students will be cracking Maple open in the next few weeks (the ones who are keeping up with their assignments, at least – for others, it sometimes takes little longer :-), so it seemed like a good idea.

    So then I had to decide what to do. I know Top N lists are very popular (Ten Things that Will Shock You about Your Math Software!), and there are tons of Maple training resources available to fill such a list without any difficulties.  But personally, I don’t always like Top N lists. What are the chances that there are exactly N things you need to know, for nice values of N? And how often you are really interested in all N items? I just want to get straight to the points I care about.

    I decided I’d try a matrix. So here you go: a mini “choose your own adventure” guide for getting to know Maple.  Pick the row that corresponds to what you want to do, and the column for how you want to do it.  All on a single, page, and ad-free!

    And best of luck for the new school year.



    I like words

    I like videos

    Just let me try it

    Product Overview

    Inside Maple, from the Help menu, select Take a Tour of Maple then click on the Ten Minute Tour button.


    (Okay, even though I like words, too, you might also want to watch the video in the next column. The whole “picture is worth a thousand words” does have some truth to it, much as I don’t always like to admit it. J)

    Watch Clickable Math


    Keep in mind that if you prefer to use commands instead of these Clickable Math tools, you can do that too.  Personally, I mix and match.

    You’ll figure it out.

    Getting Started Info

    Read the Maple Quick Start Tutorial Guide, as a PDF, or from the Help system. To access this guide from within Maple, start Maple, click on the Getting Started icon the left, then select the Quick Start Guide (first icon in the second row).

    Watch the Maple Quick Start Tutorial Video.

    The most important things to remember are

    1. Right click on your math expression to bring up a menu of things you can do, like plotting or integrating or solving your expression
    2. If you have just entered an exponent or the denominator of a fraction, use the right arrow key to get out of it.

    How do I? Essentials

    Look at the “How do I” section of the Maple Portal (Start Maple, click on the Getting Started icon, click on the Maple Portal icon; or search for “MaplePortal” in the help system).  Also look at the Maple Portal for Students, using the button from the Maple Portal.

    Check out the dozens of videos in the Maple Training Video collection.

    You can do a lot with the context menus and the various tools you’ll find on the Tools menu. But when in doubt, look at the list of “How do I” tasks from the Maple Portal described in the “words” column and pull out what you need from there.

    What now?

    The help system is your friend. Not only does it have help pages for every feature and every command, but it includes both the Maple User Manual and the Maple Programming Guide (also available as PDFs).

    Check out the collection of videos on the Maplesoft YouTube channel.  (And the help system is your friend, too. We can’t make videos to cover every last thing, and if we did, you wouldn’t have time to watch them all!)

    Maple comes with many examples and applications you can look at and modify.  You can browse through the Start page resources, or search for “examples,index” in the help system to see the full list.


    And yes, the help system is your friend, too.  But don’t worry, no one is going to make you read the manual.





    Dear Users,

    I have received a congratulations from a Mapleprime user for my post (on Finite Element Analysis - Basics) posted two years earlier. I  did not touch that subject for two years for obvious reasons. Now that a motivation has come, I have decided to post my second application using embedded components. This I was working for the past two years and with the support from Maplesoft technical support team and Dr.RobertLopez. I thank them here for this workbook has come out well to my satisfaction and has given me confidence to post it public.

    About the workbook

    I have tried to improve the performance of a 2-Stroke gasoline engine to match that of a four stroke engine by using exhaust gas recirculation. Orifice concept is new and by changing the orifice diameter and varying the % of EGR, performance was monitored and data stored in Excel workbook. These data can be imported to Maple workbook by you as you want for each performance characteristic. The data are only my experimental and not authentic for any commercial use.

    This Maple workbook generates curves from data for various experiments conducted by modifying the field variables namely Orifice diameter, % Exhaust gas Recirculation and Heat Exchanger Cooling. Hence optimum design selection is possible for best performance.

    Thanks for commenting, congratulating or critisising!! All for my learning and improving my Maple understanding!! 

    In this app you can use from the creation of curve, birth of the position vector and finally applied to the displacement and the distance traveled. All this application revolves around the creation of a path and the path of a particle over this generated by vectors. You will only have to insert the vector components and the times to evaluate. Designed for engineering students guided through Maple. In Spanish. Updated


    Lenin Araujo C

    Ambassador of Maple

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