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
  • Playing mini-golf recently, I realized that my protractor can only help me so far since it can't calculate the speed of the swing needed.  I decided a more sophisticated tool was needed and modeled a trick-shot in MapleSim.

    To start, I laid out the obstacles, the ball and club, the ground, and some additional visualizations in the MapleSim environment.


    When running the simulation, my first result wasn't even close to the hole (similar to when I play in real life!).


    The model clearly needed to be optimized. I went to the Optimization app in MapleSim (this can be found under Add Apps or Templates  on the left hand side).


    Inside the app I clicked "Load System" then selected the parameters I wanted to optimize.


    For this case, I'm optimizing 's' (the speed of the club) and 'theta' (the angle of the club). For the Objective Function I added a Relative Translation Sensor to the model and attached a probe to the Vector Norm of the output.


    Inside the app, I switched to the Objective Function section.  Selecting Probes, I added the new probe as the Objective Function by giving it a weight of 1.



    Scrolling down to "Execute Parameter Optimization", I checked the "Use Global Optimization Toolbox" checkbox, and clicked Run Parameter Optimization.


    Following a run time of 120 seconds, the app returns the graph of the objective function. 


    Below the plot, optimal values for the parameters are given. Plugging these back into the parameter block for the simulation we see that the ball does in fact go into the hole. Success!




    Can you guess what P() produces, without executing it?

    P:=proc(N:=infinity) local q,r,t,k,n,l,h, f;
    q,r,t,k,n,l,h := 1,0,1,1,3,3,0:
    while h<N do 
       if 4*q+r-t < n*t
       then f:=`if`(++h mod 50=0,"\n",`if`(h mod 10=0," ","")); printf("%d"||f,n);   
            q,r,t,k,n,l := 10*q,10*(r-n*t),t,k,iquo(10*(3*q+r),t)-10*n,l
       else q,r,t,k,n,l := q*k,(2*q+r)*l,t*l,k+1,iquo(q*(7*k+2)+r*l,t*l),l+2
    od: NULL

    I hope you will like it (maybe after execution).


    Feynman Diagrams
    The scattering matrix in coordinates and momentum representation


    Mathematical methods for particle physics was one of the weak spots in the Physics package. There existed a FeynmanDiagrams command, but its capabilities were too minimal. People working in the area complained about that. These diagrams are the cornerstone of calculations in particle physics (collisions involving from the proton to the Higgs boson), for example at the CERN. As an introduction for people curious, not working in the area, see "Why Feynman Diagrams are so important".


    This post is thus about a new development in Physics: a full rewriting of the FeynmanDiagrams command, now including a myriad of new capabilities (mainly a. b. and c. in the Introduction below), reversing the previous status of things entirely. This is work in collaboration with Davide Polvara from Durham University, Centre for Particle Theory.


    The introduction to the presentation below is as brief as it can get, emphasizing the examples instead. This material is reproducible in Maple 2019.2 after installing the Physics Updates, v.598 or higher.




    At the end it is attached the worksheet corresponding to this presentation, as well as the new FeynmanDiagrams help page with all the explanatory details.



    A scattering matrix S relates the initial and final states, `#mfenced(mrow(mo("&InvisibleTimes;"),mi("i"),mo("&InvisibleTimes;")),open = "&verbar;",close = "&rang;")` and `#mfenced(mrow(mo("&InvisibleTimes;"),mi("f"),mo("&InvisibleTimes;")),open = "&verbar;",close = "&rang;")`, of an interacting system. In an 4-dimensional spacetime with coordinates X, S can be written as:

    S = T(exp(i*`#mrow(mo("&int;"),mi("L"),mo("&ApplyFunction;"),mfenced(mi("X")),mo("&DifferentialD;"),msup(mi("X"),mn("4")))`))


    where i is the imaginary unit  and L is the interaction Lagrangian, written in terms of quantum fields  depending on the spacetime coordinates  X. The T symbol means time-ordered. For the terminology used in this page, see for instance chapter IV, "The Scattering Matrix", of ref.[1].


    This exponential can be expanded as

    S = 1+S[1]+S[2]+S[3]+`...`



    S[n] = `#mrow(mo("&ApplyFunction;"),mfrac(msup(mi("i"),mi("n")),mrow(mi("n"),mo("&excl;")),linethickness = "1"),mo("&InvisibleTimes;"),mo("&int;"),mi("&hellip;"),mo("&InvisibleTimes;"),mo("&int;"),mi("T"),mo("&ApplyFunction;"),mfenced(mrow(mi("L"),mo("&ApplyFunction;"),mfenced(mi("\`X__1\`")),mo("&comma;"),mi("&hellip;"),mo("&comma;"),mi("L"),mo("&ApplyFunction;"),mfenced(mi("\`X__n\`")))),mo("&InvisibleTimes;"),mo("&DifferentialD;"),msup(mi("\`X__1\`"),mn("4")),mo("&InvisibleTimes;"),mi("&hellip;"),mo("&InvisibleTimes;"),mo("&DifferentialD;"),msup(mi("\`X__n\`"),mn("4")))`


    and T(L(X[1]), `...`, L(X[n])) is the time-ordered product of n interaction Lagrangians evaluated at different points. The S matrix formulation is at the core of perturbative approaches in relativistic Quantum Field Theory, where exact solutions are known only for some 2-dimensional models.


     In brief, the new functionality includes computing:


    The expansion S = 1+S[1]+S[2]+S[3]+`...` in coordinates representation up to arbitrary order (the limitation is now only the hardware)


    The S-matrix element `#mfenced(mrow(mo("&InvisibleTimes;"),mi("f"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("S"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("i"),mo("&InvisibleTimes;")),open = "&lang;",close = "&rang;")` in momentum representation up to arbitrary order for given number of loops and initial and final particles (the contents of the `#mfenced(mrow(mo("&InvisibleTimes;"),mi("i"),mo("&InvisibleTimes;")),open = "&verbar;",close = "&rang;")` and `#mfenced(mrow(mo("&InvisibleTimes;"),mi("f"),mo("&InvisibleTimes;")),open = "&verbar;",close = "&rang;")` states); optionally, also the transition probability density, constructed using the square of the scattering matrix element abs(`#mfenced(mrow(mo("&InvisibleTimes;"),mi("f"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("S"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("i"),mo("&InvisibleTimes;")),open = "&lang;",close = "&rang;")`)^2, as shown in formula (13) of sec. 21.1 of ref.[1].


    The Feynman diagrams (drawings) related to the different terms of the expansion of S or of its matrix elements `#mfenced(mrow(mo("&InvisibleTimes;"),mi("f"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("S"),mo("&InvisibleTimes;"),mo("&verbar;"),mo("&InvisibleTimes;"),mi("i"),mo("&InvisibleTimes;")),open = "&lang;",close = "&rang;")`.


    Interaction Lagrangians involving derivatives of fields, typically appearing in non-Abelian gauge theories, are also handled, and several options are provided enabling restricting the outcome in different ways, regarding the incoming and outgoing particles, the number of loops, vertices or external legs, the propagators and normal products, or whether to compute tadpoles and 1-particle reducible terms.






    [1] Bogoliubov, N.N., and Shirkov, D.V. Quantum Fields. Benjamin Cummings, 1982.

    [2] Weinberg, S., The Quantum Theory Of Fields. Cambridge University Press, 2005.




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

    The ideas here are to allow 3D plotting commands such as plot3d to handle a `size` option similarly to how 2D plotting commands do so, and for the plots:-display command to also handle it for 3D plots.

    The size denotes the dimensions of the inlined plotting window, and not the relative lengths of the three axes.

    I'd be interested in any new problems introduced with this, eg. export, etc.


    # Using ToInert/FromInert
    # This might go in an initialzation file.
      if __ver>=18.0 and __ver<=2019.2 then
        if :-has(:-op([5,2,2,2,1],__KK),:-_Inert_PARAM(__NN)) then
          :-print("3D size patch done");
          :-print("3D size patch not appropriate; possibly already done");
        end if;
        :-print(sprintf("3D size patch not appropriate for version %a"),__ver);
      end if;
      :-print("3D size patch failed");
    end try:

    "3D size patch done"


    P := plot3d(sin(x)*y^2, x=-Pi..Pi, y=-1..1, size=[150,150],
                font=[Times,5], labels=["","",""]):

    plots:-display(P, size=[300,300], font=[Times,10]);

    # inherited from the contourplot3d (the plot3d is unset).
      plots:-contourplot3d(sin(x)*y^2, x=-Pi..Pi, y=-1..1,
                           thickness=3, contours=20, size=[800,800]),
      plot3d(sin(x)*y^2, x=-Pi..Pi, y=-1..1, color="Gray",
             transparency=0.1, style=surface)

    # Some options should still act as 2D-plot-specific.
    try plot3d(sin(x)*y^2, x=-Pi..Pi, y=-1..1, legend="Q");
        print("Not OK");
    if StringTools:-FormatMessage(lastexception[2..-1])
       ="the legend option is not available for 3-D plots"
    then print("OK"); else print("Not OK"); error; end if; end try;




    If this works fine then it might be a candidate for inclusion in an initialization file, so that it's
    automatically available.

    I was trying to display a Physics[Vectors] vector name in a 3dplot with an up arrow
    on it. I found that this old 2008 trick still works in MAPLE 2018.





    # Using MAPLE 2018.2


    t:= textplot3d([-1.1,1.1,1,v_]):




    # I found this on an old 2008 post
    t:= textplot3d([-1.1,1.1,1,typeset(`#mover(mi(` || v ||  `),mo("→"))`)]):




    Application of MapleSim in Science and Engineering: a simulationbased approach

    In this research work I show the methods of embedded components together with modeling and simulation carried out with Maple and MapleSim for the main areas of science and engineering (mathematics, physics, civil, mechanical etc); These two latest scientific softwares belonging to the company Maplesoft. Designed to be generated and used by teachers of education, as well as by university teachers and engineers; the results are highly optimal since the times saved in calculations are invested in analyzes and interpretations; among other benefits; in this way we can use our applications in the cloud since web technology supports Maple code with procedural and component syntax.


    Lenin AC

    Ambassador of Maple


     The Joint Mathematics Meetings are taking place next week (January 1518) in Denver, CO. This meeting is a must-attend for anyone interested in learning about innovative mathematical research, advancing mathematical achievement, providing the communication and tools to progress in the field, encouraging mathematical research, and connecting with the mathematical community.

    Maplesoft will at booth #1100  in the networking area (located just outside the exhibit hall doors). Stop by our booth or the networking area to chat with me and other members of the Maplesoft team, pick up some free Maplesoft swag or win some prizes. We’ve got some good ones!

    There are also several interesting Maple-related talks and events happening this week. 

    Attend our Workshop - Maple: Math Software for Teaching, Learning and Research

    Thursday January 16th, 2020

    Centennial Ballroom AHYATT Denver Colorado

    Catered Reception: 6:00PM6:30PM
    Training Workshop: 6:30PM8:00PM

    Are you new to the Maple world and interested in finding out what Maple can do for you? Are you an old hand at Maple but curious about the many new features we’ve added in the past few years? Come join us for an interactive workshop that will guide you through Maple’s capabilities, with an emphasis on our latest additions.

    The topics we’ll be covering include:

    • Our natural math notation for input and output
    • Tools for creating interactive documents that incorporate math, text and graphics
    • An overview of our vast library containing packages for advanced mathematics research scientific and engineering applications
    • A brief look at Maple’s powerful programming language|
    • Online and mobile tools that augment the Maple experience


    We are also 3 show floor talks, at the end of Aisle 600 inside the exhibits:

    The Maple Companion App

     January 15

    3:00 pm -3:55 pm

    Using Maple to Enhance Teaching and Learning

     January 16

    11:00 am-11:55 am

    The Maple Companion App

    January 17

    11:00 am- 11:55 am


    If you are attending the Joint Math Meetings and plan on presenting anything on Maple, please let me know and I'll add it to our list!

    See you there!


    S:=cat("Happy New Year 2020!   "$3):
    N:=length(S): a:=0.77*Pi: h:=2*Pi/N:
    display(seq(textplot([cos(a-k*h), sin(a-k*h),S[k+1]], 
            rotation=-Pi/2+a-k*h, 'font'=["times","roman",24]), k=0..N-4), axes=none);