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
  • I like to use Maple debugger to help me debug and I am sure many do.

    It is good that Maple comes with a debugger. I type "stopat(proc_name);" and then the debugger comes up when proc_name is called.

    But the Maple debugger is hard to use. It appears to be primitive compared to other commerical debuggers that come with other known developments systems.

    For example, the output of "enter a debugger command" is displayed back into the same screen where the code is listed. This makes hard to see. There is only one window. It is also hard to see where one is in the source code is. So I have to keep clicking on the "list" button to display the lines again and look for the small "*" on the left.

    Basically, it is good to have the debugger, but it seems Maplesoft is not doing any improvements to make it easier to use. It is so 1980 looking compared to other easy and powerful to use debuggers, such as Matlab debugger, Visual studio, and others.

    Could Maplesoft please make some improvements to the debugger? At least make separate side window for output of debugger commands, and improve the code listing issue? It will also be nice to have a call stack view, and variable view window, and to see where one is in the call chain.

    Is this the only debugger available for Maple? 

    add, floats, and Kahan sum

     

    I found an intresting fact about the Maple command add for floating point values.
    It seems that add in this case uses a summation algorithm in order to reduce the numerical error.
    It is probably the Kahan summation algorithm (see wiki), but I wonder why this fact is not documented.

    Here is a simple Maple procedure describing and implementing the algorithm.

     

     

    restart;

    Digits:=15;

    15

    (1)

    KahanSum := proc(f::procedure, ab::range)  
    local S,c,y,t, i;      # https://en.wikipedia.org/wiki/Kahan_summation_algorithm
    S := 0.0;              # S = result (final sum: add(f(n), n=a..b))
    c := 0.0;              # c = compensation for lost low-order bits.
    for i from lhs(ab) to rhs(ab) do
        y := f(i) - c;     
        t := S + y;              
        c := (t - S) - y;        
        S := t;                  
    od;                         
    return S
    end proc:

     

    Now, a numerical example.

     

     

    f:= n ->  evalf(1/(n+1/n^3+1) - 1/(n+1+1/(n+1)^3+1));

    proc (n) options operator, arrow; evalf(1/(n+1/n^3+1)-1/(n+2+1/(n+1)^3)) end proc

    (2)

    n := 50000;
    K := KahanSum(f, 1..n);

    50000

     

    .333313334133301

    (3)

    A := add(f(k),k=1..n);

    .333313334133302

    (4)

    s:=0.0:  for i to n do s:=s+f(i) od:
    's' = s;

    s = .333313334133413

    (5)

    exact:=( 1/3 - 1/(n+1+1/(n+1)^3+1) );

    6250249999999900000/18751875067501050009

    (6)

    evalf( [errK = K-exact, errA = A-exact, err_for=s-exact] );

    [errK = 0., errA = 0.1e-14, err_for = 0.112e-12]

    (7)

    evalf[20]( [errK = K-exact, errA = A-exact, err_for=s-exact] );

    [errK = -0.33461e-15, errA = 0.66539e-15, err_for = 0.11166539e-12]

    (8)

     


    Download KahanSum.mw

    At Maplesoft, we are excited to be celebrating our 30th year of incorporation. This anniversary is a tremendous milestone for us. As a leading provider of mathematics-based software solutions for science, technology, engineering and mathematics (STEM), this longevity attests to our ability to grow along with changing market conditions, to continually enhance the quality of our offerings and strengthen our partnerships with industry leaders.

    As a company, it is our goal to actively connect and partner with our users and industry leaders to advance STEM education and continue to revolutionize engineering design processes. When it comes to academics, we believe our partnerships and outreach initiatives help improve STEM education, develop and enhance digital learning tools and foster online education. To that end, Maplesoft is an Affiliate Member of the Fields Institute, Educational Outreach Champion of Perimeter Institute, and Technology Partner of the American Math Society’s “Who Wants to be a Mathematician” student competition. On the commercial side, we work closely with our commercial partners to seamlessly integrate our technology with complementary tools. Our relationships with prominent companies such as Rockwell Automation, B&R, Altair and more, allow us to continue leading this charge.

    At Maplesoft, we work continuously to improve our technology offerings by developing new products and enhancing our existing technology. Maple 2018, the newest version of our flagship product Maple, offers new and improved features to benefit all users, no matter what they use Maple for. It provides an environment where students and instructors can enrich the classroom experience, researchers can accelerate their projects and engineers can refine their calculation management processes. Möbius, our online courseware platform, enables instructors to author rich content, explore important STEM concepts using engaging, interactive applications, visualize problems and solutions, and test students’ understanding by answering questions that are graded instantly.

    On the engineering side, we are revolutionizing the engineering design process using Digital Twins, which are virtual machine designs created in MapleSim, Maplesoft’s modeling and simulation software. By taking a virtual approach to machine-level system integration, engineers can commission faster, earlier, and with less risk.

    Maplesoft has come a long way since our humble beginnings as a research project at the University of Waterloo. Our website features a timeline that provides insights and information on our incredible journey. The company was built on a foundation of creativity and passion for mathematics and we have worked hard to preserve that legacy. The growth experienced over the past 30 years, along with the drive of our global employee and partner base, will ensure Maplesoft continues to be a driving force in the world of online education and design engineering long into the future.

    We invite you to join us as we continue our journey towards new and exciting developments and innovations.

    Due to the mechanistic process of our students and little creativity in analysis in schools and universities to be professionally trained is that STEM education appears (science, technology, engineering and mathematics) is a new model that is being considered in other countries and with very slow step in our city. In this work the methods with STEM will be visualized but using computational tools provided by Maplesoft which is a company that leads online education for adolescents and adults in the current market. In Spanish.

    ECI_UNT_2018.pdf

    ECI_UNT_2018.mw

    Lenin Araujo Castillo

    Ambassador of Maple

    There is a bug in inttrans:-hilbert:

    restart;

    inttrans:-hilbert(sin(a)*sin(t+b), t, s);
    # should be:
    sin(a)*cos(s+b);   expand(%);

    sin(a)*cos(s)

     

    sin(a)*cos(s+b)

     

    sin(a)*cos(s)*cos(b)-sin(a)*sin(s)*sin(b)

    (1)

    ########## correction ##############

    `inttrans/expandc` := proc(expr, t)
    local xpr, j, econst, op1, op2;
          xpr := expr;      
          for j in indets(xpr,specfunc(`+`,exp)) do
              econst := select(type,op(j),('freeof')(t));
              if 0 < nops(econst) and econst <> 0 then
                  xpr := subs(j = ('exp')(econst)*combine(j/('exp')(econst),exp),xpr)
              end if
          end do;
          for j in indets(xpr,{('cos')(linear(t)), ('sin')(linear(t))}) do
              if type(op(j),`+`) then
                  op1:=select(has, op(j),t); ##
                  op2:=op(j)-op1;            ##
                  #op1 := op(1,op(j));
                  #op2 := op(2,op(j));
                  if op(0,j) = sin then
                      xpr := subs(j = cos(op2)*sin(op1)+sin(op2)*cos(op1),xpr)
                  else
                      xpr := subs(j = cos(op1)*cos(op2)-sin(op1)*sin(op2),xpr)
                  end if
              end if
          end do;
          return xpr
    end proc:

    #######################################

    inttrans:-hilbert(sin(a)*sin(t+b), t, s); expand(%);

    -(1/2)*cos(a-b)*sin(s)+(1/2)*sin(a-b)*cos(s)+(1/2)*cos(a+b)*sin(s)+(1/2)*sin(a+b)*cos(s)

     

    sin(a)*cos(s)*cos(b)-sin(a)*sin(s)*sin(b)

    (2)

     


    Download hilbert.mw

     

    To demonstrate Maple 2018’s new Python connectivity, we wanted to integrate a large Python library. The result is the DeepLearning package - this offers an interface to a subset of the Tensorflow framework for machine learning.

    I thought I’d share an application that demonstrates how the DeepLearning package can be used to recognize the numbers in images of handwritten digits.

    The application employs a very small subset of the MNIST database of handwritten digits. Here’s a sample image for the digit 0.

    This image can be represented as a matrix of pixel intensities.        

    The application generates weights for each digit by training a two-layer neural network using multinomial logistic regression. When visualized, the weights for each digit might look like this.

    Let’s say that we’re comparing an image of a handwritten digit to the weights for the digit 0. If a pixel with a high intensity lands in

    • an intensely red area, the evidence is high that the number in the image is 0
    • an intensely blue area, the evidence is low that the number in the image is 0

    While this explanation is technically simplistic, the application offers more detail.

    Get the application here

    Using Maple's native syntax, we can calculate the components of acceleration. That is, the tangent and normal scalar component with its respective units of measure. Now the difficult calculations were in the past because with Maple we solved it and we concentrated on the interpretation of the results for engineering. In spanish.

    Calculo_Componentes_Aceleracion_Curvilínea.mw

    Uso_de_comandos_y_operadores_para_calculos_de_componentes_de_la_aceleración.mw

    Lenin Araujo Castillo

    Ambassador of Maple

     

     

    The Maple splash screen needs a makeover, it's not too exciting so looking at the maplesoft website the opening screen has an image that would have been rather fitting for the Maple 2018 splash screen.  Here's the image I'm talking about.

    Last week, my colleague Erik Postma and I had the pleasure of spending a few hours with a group of bright and motivated high school students at the Math for Real: High School Math Solves Real Problems workshop held at the Fields Institute for Research in Mathematical Sciences in Toronto, and sponsored by the Fields Institute and NSERC PromoScience. The purpose of this three-day workshop was to train students for the International Mathematical Modeling Challenge, also known as IM2C.

    The IM2C is hosted by York University and run by the IM2C-Canada committee, consisting of parents and high school teachers, as well as faculty and students in York’s Department of Mathematics and Statistics. In this competition, students working in small teams have five days to solve a mathematical modelling problem in diverse application areas. To support the “Real World” aspect of the contest, students are expected not just to showcase their mathematical creativity and problem-solving skills, but they are also asked to clearly communicate their analyses and conclusions through a written report and visualizations.

    The contest allows students to use appropriate software tools to help them with their tasks. Of course I am biased but I can’t help thinking that Maple is the perfect tool for students wanting to do a combination of prototyping, modelling, visualization and document-preparation. The IM2C organizers also thought that the students could benefit from our software, so Erik gave an hour-long introduction to Maple. I was impressed by the students’ enthusiastic remarks and sometimes challenging questions, though admittedly they were partly motivated by the chance to receive as prizes our highly coveted limited-quantity “Math Matters” t-shirts.

    The workshop also introduced the students to other software products, taught modelling and writing skills, and had them work on fun practice problems. Over the lunch break, I was struck by the sense of camaraderie at this event, which probably should not have surprised me, as unlike many other competitions involving mathematics, this one is a true team-based activity. Both Erik and I are eager to see what the students will be doing with Maple. Responding to the students’ enthusiasm and interest, Maplesoft has agreed to offer complimentary Maple licenses to all students participating in IM2C. 

    As a Corporate Affiliate of the Fields Institute, Maplesoft is pleased to provide training and support to students and researchers that come to Fields for its many events. Developers like myself are encouraged to participate in the institute’s events when possible, and I’ve had the opportunity to attend a number of workshops in the past few years. I encourage you to look at their wide range of activities and to consider visiting the culturally diverse city of Toronto!


    Minimum:
    1. Maple Tour
    2. Maple Quick Start
    3. Quick Help
    4. Quick Reference Card
    5. Math Apps
    6. Plotting Guide
    ...
    https://drive.google.com/file/d/1ZAlFQ8_MbuKNsr2PDIyEHmIoogKInBmE/view?usp=sharing

    Is that only for my students?

    In worksheets:
    https://drive.google.com/file/d/1cfA8WKPXSQQxJQR7KbyYHBY6g4OjHaSn/view?usp=sharing

    The first update to the Maple 2018 Physics, Differential Equations and Mathematical Functions packages is available. As has been the case since 2013, this update contains fixes, enhancements to existing functionality, and new developments in the three areas. 

    The webpage for these updates will continue being the Maplesoft R&D Physics webpage. Starting with Maple 2018, however, this update is also available from the MapleCloud.

    To install the update: open Maple and click the Cloud icon (upper-right corner), select "Packages" and search for "Physics Updates". Then, in the corresponding "Actions" column, click the third icon (install pop-up).

    NOTE May/1: the "Updates" icon of the MapleCloud toolbar (that opens when you click the upper-right icon within a Maple document / worksheet), now works fine, after having installed the Physics Updates version 32 or higher.

    These first updates include:

    • New Physics functionality regarding Tensor Products of Quantum States; and Coherent States.
    • Updates to pdsolve regarding PDE & Boundary Conditions (exact solutions);
    • A change in notation: d_(x), the differential of a coordinate in the Physics package, is now displayed as shown in this Mapleprimes post.


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

    This is about the recent implementation of tensor products of quantum state spaces in the Physics package, in connection with an exchange with the Physics of Information Lab of the University of Waterloo. As usual this development is available to everybody from the Maplesoft R&D Physics webpage. This is the last update for Maple 2017. The updates for Maple 2018, starting with this same material, will begin being distributed through the MapleCloud next week.

    Tensor Product of Quantum State Spaces

     

    Basic ideas and design

     

     

    Suppose A and B are quantum operators and Ket(A, n), et(B, m) are, respectively, their eigenkets. The following works since the introduction of the Physics package in Maple

    with(Physics)

    Setup(op = {A, B})

    `* Partial match of  'op' against keyword 'quantumoperators'`

     

    [quantumoperators = {A, B}]

    (1)

    A*Ket(A, alpha) = A.Ket(A, alpha)

    Physics:-`*`(A, Physics:-Ket(A, alpha)) = alpha*Physics:-Ket(A, alpha)

    (2)

    B*Ket(B, beta) = B.Ket(B, beta)

    Physics:-`*`(B, Physics:-Ket(B, beta)) = beta*Physics:-Ket(B, beta)

    (3)

    where on the left-hand sides the product operator `*` is used as a sort of inert form (it has all the correct mathematical properties but does not perform the contraction) of the dot product operator `.`, used on the right-hand sides.

     

    Suppose now that A and B act on different, disjointed, Hilbert spaces.

     

    1) To represent that, a new keyword in Setup , is introduced, to indicate which spaces are disjointed, say as in disjointedhilbertspaces = {A, B}.  We want this notation to pop up at some point as {`&Hscr;`[A], `&Hscr;`[B]} where the indexation indicates all the operators acting on that Hilbert space. The disjointedspaces keyword has for synonyms disjointedhilbertspaces and hilbertspaces. The display `&Hscr;`[A] is not yet implemented.

     

    NOTE: noncommutative quantum operators acting on disjointed spaces commute between themselves, so after setting  - for instance - disjointedspaces = {A, B}, automatically, A, B become quantum operators satisfying (see comment (ii) on page 156 of ref. [1])

     

    "[A,B][-]=0"

     

    2) Product of Kets and Bras (KK, BB, KB and BK) where K and B belong to disjointed spaces, are understood as tensor products satisfying, for instance with disjointed spaces A and B (see footnote on page 154 of ref. [1]),

     

    `&otimes;`(Ket(A, alpha), Ket(B, beta)) = `&otimes;`(Ket(B, beta), Ket(A, alpha)) 

     

    `&otimes;`(Bra(A, alpha), Ket(B, beta)) = `&otimes;`(Ket(B, beta), Bra(A, alpha)) 

     

    while of course

    Bra(A, alpha)*Ket(A, alpha) <> Bra(A, alpha)*Ket(A, alpha)

     

    Details

       

     

    3) All the operators of one disjointed space act transparently over operators, Bras and Kets of the other disjointed spaces, for example

     

    A*Ket(B, n) = A*Ket(B, n)

    and the same for the Dagger of this equation, that is

    Bra(B, n)*Dagger(A) = Bra(B, n)*Dagger(A)