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
  • Last week Michael Pisapia, Maplesoft European VP, attended the opening reception of Mathematics: The Winton Gallery at the Science Museum in London. Ahead of being open to the public on 8th December, contributors and donors were invited to take a look behind the scenes of the new gallery, which explores how mathematicians, their tools and ideas have helped to shape the modern world over the last four hundred years.

    The gallery is a spectacular space, designed by the world-renowned Zaha Hadid Architects, housing over a hundred artefacts of mathematical origin or significance. It is divided up into disciplines ranging from navigation to risk assessment, and gambling to architecture. Inspired by the Handley Page aircraft, the largest object on display, and suspended as the centrepiece, the gallery is laid out using principles of mathematics and physics. It follows the lines of airflow around it in a stunning display of imagined aerodynamics, brought to life using light and sculpture. You can learn more about its design in this video.

    Guests at the reception enjoyed a specially commissioned piece of music from the Royal College of Music titled ‘Gugnunc’, named after the aircraft and inspired by the rhythms of Morse code and mathematical and mechanical processes, and performed at the centre of the gallery.

    Of course any exhibit celebrating all things maths is of great interest to us here at Maplesoft, but this one especially so, since Mathematics: The Winton Gallery showcases the earliest available version of Maple.

    A copy of Maple V, from 1997, sits in ‘The Power of Computers’ section of the Winton Gallery, in an exhibit which tells the story of the significant role played by mathematical software in improving the quality of mathematics education and research. Other objects in the section include a Calculating Machine from the Scientific Service circa 1939, a PDP-8 minicomputer from the 1960s, and part of Charles Babbage’s mid-19th century analytical engine, intended as a high-powered mathematical calculator.

    As many of you will remember, Maple V was a major milestone in the history of Maple, providing unparalleled interactivity, powerful symbolics and creative visualization in mathematical computation and modeling. For a walk down memory lane, check out Maple V: The Future of Mathematics (ca. 1994) on YouTube.

    Seeing this copy of Maple finally in place in the exhibit marks the end of a long journey – and not just in the miles it travelled to arrive at the museum from its home in Canada. When we were first approached by the Science Museum for a donation of Maple, we launched a hunt to find not just the right copy of Maple with its box and manuals, but also artefacts that showcased the origin and history of Maple. It was a journey down memory lane for the inventors of Maple as well as the first few employees as they dug out old correspondences, photos, posters and other memorabilia that could be showcased. Today they can be proud of their contribution to this display at the Science Museum. 

    Although the case of historic software packages is visually less impressive than many of the other items in the gallery, it certainly attracted plenty of attention as guests made their way in for the first time. 

    For fans of Maple V - and there are many - it’s reassuring that the Science Museum are now entrusted with preserving not only the iconic packaging, but with telling the story of Maple’s history and marking its place in the evolution of mathematics and technology.

    To learn more about Mathematics: The Winton Gallery, its highlights and architecture, visit http://www.sciencemuseum.org.uk/mathematics

    To see the timeline of Maple’s evolution over the years, visit:  http://www.maplesoft.com/25anniversary/

    Let us consider 

    Student[Precalculus]:-LimitTutor(sqrt(x), x = 2);

    One expects a nice illustration of the result sqrt(2). But instead of that one reads "f(x) approaches 1.41 as x approaches 2". This is simply clueless and forms a wrong understanding of limits. It should also be noticed that all the entries (left, 2-sided, and right) produce the same animation. The same issue with other limits I tried, e.g.

    Student[Precalculus]:-LimitTutor(sqrt(x), x = 1);

    . I think this command should be completely rewritten or excluded from Maple. 

    A number of MaplePrimers have asked how one might use the section and subsections of a Maple worksheet to structure the source code of an extended Maple package.  The usual answer is that it cannot be done; a module-based Maple package must be assigned in a single input region in a worksheet.  A recommended alternative is to write the source in text files and use either command line tools or the Maple read command from a worksheet to assign the package.  Because the read command handles Maple preprocessor macros, specifically the $include macro, the source can be conveniently split into smaller files.

    I prefer this file-based method for development because text files are generally more robust than Maple worksheets, can be edited with the user's preferred editor, can be put under version control, and can be searched and modified by standard Unix-based tools.  However, not everyone is familiar with this method of development.  With that in mind, I wrote a small Maple package, CodeBuilder, that permits splitting the source of a Maple package (or any Maple code) into separate code edit regions in a standard Maple worksheet, using $include macros to include the source of other regions.  To build the package, the code edit regions are written to external files, using the names of the regions as the local file name relative to a temporary directory.

    The package includes a method to run mint on the source code.  The result can be either printed in the worksheet or displayed in a pop-up maplet that allows selecting the infolevel and the region to check.

    CodeBuilder includes help pages and a simple example (referenced from the top-level help page) demonstrating the usage.  To install the package, unzip the attached zip file and follow the directions in the README file.

    CodeBuilder-1-0-3.zip

    Errata Just noticed that a last minute change broke some of the code.  Do not bother with the 1-0-1 version; I'll upload a new version shortly.  The latest version (1-0-3) is now available.

    Let us look in RealDomain and then in the RealDomain:-solve command. One is addressed to the usual solve command. The commands of the RealDomain package are not still documented since Maple 7 when the package was introduced. There is a general description only 

    • By default, Maple performs computations under the assumption that the underlying number system is the complex field. The RealDomain package provides an environment in which computations are performed under the assumption that the basic underlying number system is the field of real numbers.
    • Results returned by procedures are postprocessed by discarding values containing any detectable non-real answers or replacing them with undefined where appropriate.

    The above is not enough. Here is an example which confuses me: 

    RealDomain:-solve(exp(I*x) = -1, AllSolutions);
    NULL

    though 

    solve(exp(I*x) = -1, AllSolutions);
                             Pi (2 _Z1 + 1)
    

    and 

    RealDomain:-solve(exp(I*x) = -1);
                                   Pi
    

    I lie awake thinking about that. Maplesoft staff help me!

    The DFT windowing functions in the SignalProcessing package seem to be inconsistent in the type of data they will accept, and the type they return.

    BartlettHannWindow,  BlackmanHarrisWindow, BlackmanNuttallWindow,   BohmanWindow, CauchyWindow, CosineWindow, ExponentialWindow, FlatTopWindow,  GaussianWindow, HannPoissonWindow, ParzenWindow, PoissonWindow,  RectangleWindow, ReiszWindow, RiemannWindow, TaperedCosineWindow, TriangleWindow, TukeyWindow

    accept Arrays, containing almost any data type (haven't tried them all!) as input. and always return a Vector[row].

    But

    BartlettWindow, BlackmanWindow, HammingWindow, HannWindow, KaiserWindow

    require that the option datatype=float[8] be set in the Array() constructor, which is used as input and always return an hfarray.

    Thus, for example

    with(SignalProcessing);
    sig:= Array( -50..50,
                            fill=1
                        ):
    BartlettHannWindow(sig); # this works
    BartlettWindow(sig);# this fails with datatype unsupported error

    Very confusing!!!!

    Let us consider 

    Statistics:-Mode(Binomial(n, p));
                            floor((1 + n) p)
    

    Up to Wiki, the output is not correct. Simply no words.

    The copy paste and snip tool used to work.  I can no longer use either to paste in mapleprimes.

    There seems to be a bug in determining the folowing integral analytically:

    integrate(-(3/2*(exp(-(1/4)*x)*x-sqrt(Pi)*erf((1/2)*sqrt(x))*sqrt(x)))/(sqrt(x)*sqrt(Pi)*erf((1/2)*sqrt(x))), x = 0..1)

    Maple gives as a result

    3/2

    However, numerically integrating it

    integrate(-(3/2*(exp(-(1/4)*x)*x-sqrt(Pi)*erf((1/2)*sqrt(x))*sqrt(x)))/(sqrt(x)*sqrt(Pi)*erf((1/2)*sqrt(x))), x=0..1,numeric)

    gives

    0.1195461293

    In fact, integrating it from a to b,

    integrate(-(3/2*(exp(-(1/4)*x)*x-sqrt(Pi)*erf((1/2)*sqrt(x))*sqrt(x)))/(sqrt(x)*sqrt(Pi)*erf((1/2)*sqrt(x))), x=a..b)

    gives

    -3/2 a + 3/2 b

    suggesting that Maple thinks the integrand is just 3/2. If one plots it, then it becomes obvious that this is not the case.


     

    with(Statistics):````

    X := Statistics:-RandomVariable(Normal(0, 1)):

    PDF(sin(X), t)

    piecewise(t <= -1, 0, t < 1, 2^(1/2)*exp(-(1/2)*arcsin(t)^2)/(Pi^(1/2)*(-t^2+1)^(1/2)), 1 <= t, 0)

    (1)

    int(%, t = -1 .. 1)

    2*erf((1/4)*Pi*2^(1/2))

    (2)

    evalf(%)

    1.767540069

    (3)

    ``


    There were recently submitted a dozen Maple bugs by me and others. Maplesoft have brought no responses. They keep strategic silence. True merit is not afraid of criticism.

    Download Bug_in_Statistics_PDF.mw


     

    I found a strange bug in int.
    For some functions f(x), Maple is able to compute the antiderivative (correctly) but refuses to compute the definite integral.
    Or, computes the integral over 0..1  and  0..2  but refuses to compute over 1..2.

    int(exp(x^3), x);  #ok

    -(1/3)*(-1)^(2/3)*((2/3)*x*(-1)^(1/3)*Pi*3^(1/2)/(GAMMA(2/3)*(-x^3)^(1/3))-x*(-1)^(1/3)*GAMMA(1/3, -x^3)/(-x^3)^(1/3))

    (1)

    int(exp(x^3), x=1..2); #?

    int(exp(x^3), x = 1 .. 2)

    (2)

    int(exp(x^3), x=1..2, method=FTOC); #??

    int(exp(x^3), x = 1 .. 2, method = FTOC)

    (3)

    int(exp(x^3), x=0..2); #?

    int(exp(x^3), x = 0 .. 2)

    (4)

    int(exp(-x^3), x);  #ok

    (3/4)*x*exp(-(1/2)*x^3)*WhittakerM(1/6, 2/3, x^3)/(x^3)^(1/6)+exp(-(1/2)*x^3)*WhittakerM(7/6, 2/3, x^3)/(x^2*(x^3)^(1/6))

    (5)

    int(exp(-x^3), x=0..2);  #ok

    (3/4)*2^(1/2)*exp(-4)*WhittakerM(1/6, 2/3, 8)+(1/8)*2^(1/2)*exp(-4)*WhittakerM(7/6, 2/3, 8)

    (6)

    int(exp(-x^3), x=0..1);  #ok

    (3/4)*exp(-1/2)*WhittakerM(1/6, 2/3, 1)+exp(-1/2)*WhittakerM(7/6, 2/3, 1)

    (7)

    int(exp(-x^3), x=1 .. 2);  #???

    int(exp(-x^3), x = 1 .. 2)

    (8)


     

    Download !strange-bug-int.mw

    Let us consider 

    restart; J := int(cos(a*x)^2/(x^2-1), x = -infinity .. infinity, CPV);
    -(1/4)*Pi*sin(2*a)*csgn(I*a)-(1/4)*Pi*sin(2*a)*csgn(I/a)

    This result is not true for a=I:

    eval(J, a = I);
                                   0
    

    In this case the integral under consideration diverges because of 

    cos(I*x)^2;
                                    
                                cosh(x) ^2
    

     

    On some platforms, my editor of choice has become the aptly named Sublime Text. Unfortunately, it does not seem to have built in syntax highlighting for the Maple programming language and so I set out to write some.  In the end, I wrote enough highlighting to keep me sane when looking at Maple source, but it could use a lot more work.  So in case anyone is interested I've put what I have in a Github repository: SublimeTextMaple

    If you use Sublime Text, please download it and add your own enhacements and share in turn.

    I find it hard to believe when I enter the search term Maple 6 Maple 7 maple 8 etc.. old versions search prior to Maple 10 it only brings up a maximum of 4 pages.  I know there are more applications of old.  

    Are all applications still there and the search just not bringing them up?

    Let us consider 

    maximize(int(exp(-x^4), x = k .. 3*k), location);

    Error, (in maximize) invalid input: iscont expects its 1st argument, f, to be of type algebraic, but received x = k .. 3*k
    whereas the expected output is 

    [(2*((1/40)*GAMMA(1/4, (1/80)*ln(3))*5^(1/4)*ln(3)^(3/4)-(1/40)*GAMMA(1/4, (81/80)*ln(3))*5^(1/4)*ln(3)^(3/4)))*5^(3/4)*(1/ln(3))^(3/4), [k = (1/10)*10^(3/4)*ln(3)^(1/4)]]

    as Mma 11 produces. The following 

    RealDomain:-solve(diff(int(exp(-x^4), x = k .. 3*k), k));
      -(1/10)*5^(3/4)*ln(3)^(1/4), (1/10)*5^(3/4)*ln(3)^(1/4)

    is not a workaround because of 

    int(exp(-x^4), x = (1/10)*5^(3/4)*ln(3)^(1/4) .. (3/10)*5^(3/4)*ln(3)^(1/4));
      FAIL

     

    Let us consider 

    MultiSeries:-series(Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)), x = 0);
    
    x-(1/2)*x^2+(1/4)*x^4-(1/2)*x^6 +O(x^7)
    

    The above result contradicts 

    MultiSeries:-limit(diff(Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)), x), x = 0);
                               undefined
    MultiSeries:-limit((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = 0, right);
                                   1
    MultiSeries:-limit((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = 0, left);
                               undefined
    plot((Psi((2*x+1)/(2*x))-Psi((x+1)/(2*x)))/x, x = -0.1e-1 .. 0.1e-2, discont, y = -5 .. 5);
    

    First 52 53 54 55 56 57 58 Last Page 54 of 298