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. Wanting a procedure, but not wanting to reinvent the wheel, I did a search on mapleprimes for "Shoelace" (formula). I got the response below indicating a hit. But clicking on the hypertext, i get to page 41 of Kitonums replies, but not the actual thing i wanted. I go to "find on this page" in my browser firefox and input "Shoelace"...nothing. enter "thU"...nothing. Do I really have to go through all of his replies on the page?

     
    Kitonum - Replies
    ... ThU. You are right. Shoelace's formula is a wonderful formula! It ... ThU. You
    are right. Shoelace's formula is a wonderful formula! It ...

    Let us consider

    restart; Digits := 20; evalf(Int(abs(cos(1/t)), t = 0 .. 0.1e-1), 3);
       -0.639e-2

    Pay your attention to the minus sign. Simply no words. Mma produces 0.006377.

    evalf@Int.mw

    Ian Thompson has written a new book, Understanding Maple.

    I've been browsing through the book and am quite pleased with what I've read so far. As a small format paperback of just over 200 pages it packs in a considerable amount of useful information aimed at the new Maple user. It says, "At the time of writing the current version is Maple 2016."

    The general scope and approach of the book is explained in its introduction, which can currently be previewed from the book's page on amazon.com. (Click on the image of the book's cover, to "Look inside", and then select "First Pages" in the "Book sections" tab in the left-panel.)

    While not intended as a substitute for the Maple manuals (which, together, are naturally larger and more comprehensive) the book describes some of the big landscape of Maple, which I expect to help the new user. But it also explains how Maple is working at a lower level. Here are two phrases that stuck out: "This book takes a command driven, or programmatic, approach to Maple, with the focus on the language rather than the interface", followed closely by, "...the simple building blocks that make up the Maple language can be assembled to solve complex problems in an efficient way."

     

     

     

    A population p(t) governed by the logistic equation with a constant rate of harvesting satisfies the initial value problem diff(p(t), t) = (2/5)*p(t)*(1-(1/100)*p(t))-h, p(0) = a. This model is typically analyzed by setting the derivative equal to zero and finding the two equilibrium solutions p = 50+`&+-`(5*sqrt(100-10*h)). A sketch of solutions p(t) for different values of a suggests that the larger equilibrium is stable; the smaller, unstable.

     

    When a is less that the unstable equilibrium, p(t) becomes zero at a time t[e], and the population becomes extinct. If p(t) is not interpreted as pertaining to a population, its graph exists beyond t[e], and actually has a vertical asymptote between the two branches of its graph.

     

    In the worksheet "Logistic Model with Harvesting", two questions are investigated, namely,

     

    1. How does the location of this vertical asymptote depend on on a and h?
    2. How does the extinction time t[e], the time at which p(t) = 0, depend on a and h?

    To answer the second question, an explicit solution p = p(a, h, t), readily provided by Maple, is set equal to zero and solved for t[e] = t[e](a, h). It turns out to be difficult both to graph the surface t[e](a, h) and to obtain a contour map of the level sets of this function. Instead, we solve for a = a(t[e], h) and obtain a graph of a(h) with t[e] as a slider-controlled parameter.

     

    To answer the first question, the explicit solution, which has the form alpha*tan(phi(a, h, t))*beta(h)+50, exhibits its vertical asymptote when phi(a, h, t) = -(1/2)*Pi. Solving this equation for t[a] = t[a](a, h) gives the time at which the vertical asymptote is located, a function that is as difficult to graph as t[e]. Again the remedy is to solve for, and graph, a = a(h), with t[a] as a slider-controlled parameter.

     

    Download the worksheet: Logistic_with_Harvesting.mw

    Ever needed to measure something and all you had was a piece of paper?  This leads us to how we can use maple to figure out what we can measure using a sheet of standard 8-1/2" x 11" paper.

    Can we measure 6" with a sheet of paper?

    > eq := (17/2)*x+11*y = 6;
                                      17             
                                eq := -- x + 11 y = 6
                                      2              
    > eq2 := isolve(eq, a);
                       eq2 := {x = -20 - 22 a, y = 16 + 17 a}
    > subs(a = 0, b = 0, eq2);
                                  {x = -20, y = 16}
    

    So that is the simplest case, stacking up 16 pieces on the long side and subtracting 20 on the short side.  A total of toppling the piece of paper over 36 times.  That's a high percentage of of error. 

    But wait!  haha.   Wouldn't a fold make it simpler?  Sure!  Fold the 8.5" across and we now have 2.5" to work with.

    > eq := (17/2)*x+11*y+(5/2)*z = 6;
                                   17            5      
                             eq := -- x + 11 y + - z = 6
                                   2             2      
    > eq2 := isolve(eq, {a, b});
               eq2 := {x = a, y = 1 + 4 a + 5 b, z = -2 - 21 a - 22 b}
    > subs(a = 0, b = 0, eq2);
                               {x = 0, y = 1, z = -2}
    

    Less toppling of pieces of paper and much less error. 

     

     

    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

    First 58 59 60 61 62 63 64 Last Page 60 of 304