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
  • restart;

    torus:= (x^2+y^2+z^2 + R^2-r^2)^2 - 4*R^2*(x^2+y^2):

    torus1:=eval(torus,[r=1,R=4]);

    (x^2+y^2+z^2+15)^2-64*x^2-64*y^2

    (1)

    plots:-implicitplot3d(torus1=0, x=-6..6,y=-6..6,z=-6..6, numpoints=5000, scaling=constrained, view=-2..2);

     

    sol1:=solve(torus1<0, [x,y,z]); # It should be easy for Maple

    [[x = 0, y < -3, -5 < y, z < (-y^2-8*y-15)^(1/2), -(-y^2-8*y-15)^(1/2) < z], [x = 0, y < 5, 3 < y, z < (-y^2+8*y-15)^(1/2), -(-y^2+8*y-15)^(1/2) < z]]

    (2)

    eval(torus1, [x=3,y=2,z=0]); # in the interior

    -48

    (3)

    eval(sol1, [x=3,y=2,z=0]);   # ???

    [[3 = 0, 2 < -3, -5 < 2, 0 < (-35)^(1/2), -(-35)^(1/2) < 0], [3 = 0, 2 < 5, 3 < 2, 0 < (-3)^(1/2), -(-3)^(1/2) < 0]]

    (4)

     

     

    Download Bug-solve_ineqs.mw

    This Maplesoft guest blog post is from Prof. Dr. Johannes Blümlein from Deutsches Elektronen-Synchrotron (DESY), one of the world’s leading particle accelerator centres used by thousands of researchers from around the world to advance our knowledge of the microcosm. Prof. Dr. Blümlein is a senior researcher in the Theory Group at DESY, where he and his team make significant use of Maple in their investigations of high energy physics, as do other groups working in Quantum Field Theory. In addition, he has been involved in EU programs that give PhD students opportunities to develop their Maple programming skills to support their own research and even expand Maple’s support for theoretical physics.


     

    The use of Maple in solving frontier problems in theoretical high energy physics

    For several decades, progress in theoretical high energy physics relies on the use of efficient computer-algebra calculations. This applies both to so-called perturbative calculations, but also to non-perturbative computations in lattice field theory. In the former case, large classes of Feynman diagrams are calculated analytically and are represented in terms of classes of special functions. In early approaches started during the 1960s, packages like Reduce [1] and Schoonship [2] were used. In the late 1980s FORM [3] followed and later on more general packages like Maple and Mathematica became more and more important in the solution of these problems. Various of these problems are related to data amounts in computer-algebra of O(Tbyte) and computation times of several CPU years currently, cf. [4].

    Initially one has to deal with huge amounts of integrals. An overwhelming part of them is related by Gauss’ divergence theorem up to a much smaller set of the so-called master integrals (MIs). One performs first the reduction to the MIs which are special multiple integrals. No general analytic integration procedures for these integrals exist. There are, however, several specific function spaces, which span these integrals. These are harmonic polylogarithms, generalized harmonic polylogarithms, root-valued iterated integrals and others. For physics problems having solutions in these function spaces codes were designed to compute the corresponding integrals. For generalized harmonic polylogarithms there is a Maple code HyperInt [5] and other codes [6], which have been applied in the solution of several large problems requiring storage of up to 30 Gbyte and running times of several days. In the systematic calculation of special numbers occurring in quantum field theory such as the so-called β-functions and anomalous dimensions to higher loop order, e.g. 7–loop order in Φ4 theory, the Maple package HyperLogProcedures [7] has been designed. Here the largest problems solved require storage of O(1 Tbyte) and run times of up to 8 months. Both these packages are available in Maple only.

    A very central method to evaluate master integrals is the method of ordinary differential equations. In the case of first-order differential operators leading up to root-valued iterative integrals their solution is implemented in Maple in [8] taking advantage of the very efficient differential equation solvers provided by Maple. Furthermore, the Maple methods to deal with generating functions as e.g. gfun, has been most useful here. For non-first order factorizing differential equation systems one first would like to factorize the corresponding differential operators [9]. Here the most efficient algorithms are implemented in Maple only. A rather wide class of solutions is related to 2nd order differential equations with more than three singularities. Also here Maple is the only software package which provides to compute the so-called 2F1 solutions, cf. [10], which play a central role in many massive 3-loop calculations

    The Maple-package is intensely used also in other branches of particle physics, such as in the computation of next-to-next-to leading order jet cross sections at the Large Hadron Collider (LHC) with the package NNLOJET and double-parton distribution functions. NNLOJET uses Maple extensively to build the numerical code. There are several routines to first build the driver with automatic links to the matrix elements and subtraction terms, generating all of the partonic subprocesses with the correct factors. To build the antenna subtraction terms, a meta-language has been developed that is read by Maple and converted into calls to numerical routines for the momentum mappings, calls to antenna and to routines with experimental cuts and plotting routines, cf. [11].

    In lattice gauge calculations there is a wide use of Maple too. An important example concerns the perturbative predictions in the renormalization of different quantities. Within different European training networks, PhD students out of theoretical high energy physics and mathematics took the opportunity to take internships at Maplesoft for several months to work on parts of the Maple package and to improve their programming skills. In some cases also new software solutions could be obtained. Here Maplesoft acted as industrial partner in these academic networks.

    References

    [1] A.C. Hearn, Applications of Symbol Manipulation in Theoretical Physics, Commun. ACM 14 No. 8, 1971.

    [2] M. Veltman, Schoonship (1963), a program for symbolic handling, documentation, 1991, edited by D.N. Williams.

    [3] J.A.M. Vermaseren, New features of FORM, math-ph/0010025.

    [4] J. Blümlein and C. Schneider, Analytic computing methods for precision calculations in quantum field theory, Int. J. Mod. Phys. A 33 (2018) no.17, 1830015 [arXiv:1809.02889 [hep-ph]].

    [5] E. Panzer, Algorithms for the symbolic integration of hyperlogarithms with applications to Feynman integrals, Comput. Phys. Commun. 188 (2015) 148–166 [arXiv:1403.3385 [hep-th]].

    [6] J. Ablinger, J. Blümlein, C .Raab, C. Schneider and F. Wissbrock, Calculating Massive 3-loop Graphs for Operator Matrix Elements by the Method of Hyperlogarithms, Nucl. Phys. 885 (2014) 409-447 [arXiv:1403.1137 [hep-ph]].

    [7] O. Schnetz, φ4 theory at seven loops, Phys. Rev. D 107 (2023) no.3, 036002 [arXiv: 2212.03663 [hep-th]].

    [8] J. Ablinger, J. Blümlein, C. G. Raab and C. Schneider, Iterated Binomial Sums and their Associated Iterated Integrals, J. Math. Phys. 55 (2014) 112301 [arXiv:1407.1822 [hep-th]].

    [9] M. van Hoeij, Factorization of Differential Operators with Rational Functions Coefficients, Journal of Symbolic Computation, 24 (1997) 537–561.

    [10] J. Ablinger, J. Blümlein, A. De Freitas, M. van Hoeij, E. Imamoglu, C. G. Raab, C. S. Radu and C. Schneider, Iterated Elliptic and Hypergeometric Integrals for Feynman Diagrams, J. Math. Phys. 59 (2018) no.6, 062305 [arXiv:1706.01299 [hep-th]].

    [11] A. Gehrmann-De Ridder, T. Gehrmann, E.W.N. Glover, A. Huss and T.A. Morgan, Precise QCD predictions for the production of a Z boson in association with a hadronic jet, Phys. Rev. Lett. 117 (2016) no.2, 022001 [arXiv:1507.02850 [hep-ph]].

         Happy Easter to all those who celebrate! One common tradition this time of year is decorating Easter eggs. So, we’ve decided to take this opportunity to create some egg-related math content in Maple Learn. This year, a blog post by Tony Finch inspired us to create a walkthrough exploring the four-point egg. The four-point egg is a method to construct an egg-shaped graph using just a compass and a ruler, or in this case, Maple Learn. Here's the final product: 

         The Maple Learn document, found here, walks through the steps. In general, each part of the egg is an arc corresponding to part of a circle centred around one of the points generated in this construction. 

         For instance, starting with the unit circle and the three red points in the image below, the blue circle is centred at the bottom point such that it intersects with the top of the unit circle, at (0,1). The perpendicular lines were constructed using the three red points, such that they intersect at the bottom point and pass through opposite side points, either (-1,0) or (1,0). Then, the base of the egg is constructed by tracing an arc along the bottom of the blue circle, between the perpendicular lines, shown in red below.

     

         Check out the rest of the steps in the Maple Learn Document. Also, be sure to check out other egg-related Maple Learn documents including John May’s Egg Formulas, illustrating other ways to represent egg-shaped curves with mathematics, and Paige Stone’s Easter Egg Art, to design your own Easter egg in Maple Learn. So, if you’ve had your fill of chocolate eggs, consider exploring some egg-related geometry - Happy Easter!  

    Here are the Maple sources for the paper "Maximum Gap among Integers Having a Common Divisor with an Odd semi-prime" published on Journal of Advances in Mathematics and Computer Science 39 (10):51-61, at :https://doi.org/10.9734/jamcs/2024/v39i101934.

     

    gap := proc(a, b) return abs(a - b) - 1; end proc

    HostsNdivisors := proc(N)

    local i, j, g, d, L, s, t, m, p, q, P, Q, np, nq;

    m := floor(1/2*N - 1/2);

    L := evalf(sqrt(N));

    P := Array();

    Q := Array();

    s := 1; t := 1;

    for i from 3 to m do

       d := gcd(i, N);

        if 1 < d and d < L then P(s) := i; s++;

        elif L < d then Q(t) := i; t++; end if;

    end do;

      np := s - 1;

      nq := t - 1;

     for i to np do printf("%3d,", P(i)); end do;

      printf("\n");

      for i to nq do printf("%3d,", Q(i)); end do;

      printf("\n gaps: \n");

      for i to np do

         for j to nq do

          p := P(i); q := Q(j);

          g := gap(p, q);

          printf("%4d,", g);

      end do;

        printf("\n");

    end do;

    end proc

     

    HostOfpq := proc(p, q)

    local alpha, s, t, g, r, S, T, i, j;

       S := 1/2*q - 1/2;

       T := 1/2*p - 1/2;

       alpha := floor(q/p);

        r := q - alpha*p;

       for s to S do

         for t to T do

           g := abs((t*alpha - s)*p + t*r) - 1;

            printf("%4d,", g);

          end do;

         printf("\n");

     end do;

    end proc

    MapleSource.pdf

    MapleSource.mw

     

    To celebrate this day of mathematics, I want to share my favourite equation involving Pi, the Bailey–Borwein–Plouffe (BBP) formula:

    This is my favourite for a number of reasons. Firstly, Simon Plouffe and the late Peter Borwein (two of the authors that this formula is named after) are Canadian! While I personally have nothing to do with this formula, the fact that fellow Canadians contributed to such an elegant equation is something that I like to brag about.

    Secondly, I find it fascinating how Plouffe first discovered this formula using a computer program. It can often be debated whether mathematics is discovered or invented, but there’s no doubt here since Plouffe found this formula by doing an extensive search with the PSLQ integer relation algorithm (interfaced with Maple). This is an example of how, with ingenuity and creativity, one can effectively use algorithms and programs as powerful tools to obtain mathematical results.

    And finally (most importantly), with some clever rearranging, it can be used to compute arbitrary digits of Pi!

    Digit 2024 is 8
    Digit 31415 is 5
    Digit 123456 is 4
    Digit 314159 is also 4
    Digit 355556 is… F?

    That last digit might look strange… and that’s because they’re all in hexadecimal (base-16, where A-F represent 10-15). As it turns out, this type of formula only exists for Pi in bases that are powers of 2. Nevertheless, with the help of a Maple script and an implementation of the BBP formula by Carl Love, you can check out this Learn document to calculate some arbitrary digits of Pi in base-16 and learn a little bit about how it works.

    After further developments, this formula led to project PiHex, a combined effort to calculate as many digits of Pi in binary as possible; it turns out that the quadrillionth bit of Pi is zero! This also led to a class of BBP-type formulas that can calculate the digits of other constants like (log2)*(π^2) and (log2)^5.

    Part of what makes this formula so interesting is human curiosity: it’s fun to know these random digits. Another part is what makes mathematics so beautiful: you never know what discoveries this might lead to in the future. Now if you’ll excuse me, I have a slice of lemon meringue pie with my name on it 😋

     

    References
    BBP Formula (Wikipedia)
    A Compendium of BBP-Type Formulas
    The BBP Algorithm for Pi

    This post is to help anyone who is just as frustrated about typesetting in plots
    as I was before I solved my problem. (Note: the technique works with the version

    2020 and newer and may work with earlier versions.)

     

    Why? Because there is no obvious help in Maple showing what works. (And if folks

    can improve what I have posted,  please do so. At least when someone executes

    a search for this type of problem, they might see the best approach.)

    Goal: typeset a name of a function in any text of a plot.

    Approach: According to help, '?plot, typesetting',  one should use the
    option(procedure?) typeset.   For example:

    "restart;   plots:-setoptions(size = [400, 200]):    `f__1`(x) :=cos(x)*(e)^(-(x^(2))/(4)) :    p1 := plot(`f__1`(x), x = -5..5,                         legend = typeset("function ", `f__1`(x) )  );"

     

     

    However, what I want in the legend is the expression "`f__1`(x),"not the evaluated

    expression. Entering the name with single quotes around the expression leads to this:

     

    p1 := plot(f__1(x), x = -5 .. 5, legend = typeset("function ", 'f__1(x)'))

     

     

    which is great, except that when I wish to redisplay the plot

     

    plots:-display(p1)

     

    the expression f__1(x)is evaluated.

     

    According to the code completion capability of Maple, the procedure

    "Typesetting:-Typeset" exists, and it does not evaluate the function:

     

    p1 := plot(f__1(x), x = -5 .. 5, legend = Typesetting:-Typeset(f__1(x))); plots:-display(p1)

     

     

    except there is no help regarding this procedure.

     

    It appears that the procedure operates only on one item.

     

    Solution: Hence, the ultimate solution for my problem is to still use the typeset 

    option, but Typeset any expression.

     

    p1 := plot(f__1(x), x = -5 .. 5, legend = typeset("function ", Typesetting:-Typeset(f__1(x)))); plots:-display(p1)

     

     

    Again, if you can contribute to this post, I would appreciate it.


     

    Download MaplePrimies_-_Typesetting_in_plots.mw



    (EDITED 2024/03/11  GMT 17H)

    In a recent Question@cq mentionned in its last reply "In fact, I wanted to do parameter sensitivity analysis and get the functional relationship between the [...] function and [parameters]. Later, i will study how the uncertainty of [the parameters] affects the [...] function".
    I did not keep exchanging further on with @cq, simply replying that I could provide it more help if needed.

    In a few words the initial problem was this one:

    • Let X_1 and X_2 two random variables and G the random variable defined by  G = 1 - (X_1 - 1)^2/9 - (X_2 - 1)^3/16.
       
    •  X_1 and X_2 are assumed to be gaussian random variables with respective mean and standard deviation equal to (theta_1, theta_3) and (theta_2, theta_4).
       
    • The four theta parameters are themselves assumed to be realizations of four mutually independent uniform random variables Theta_1, ..., Theta_4 whose parameters are constants.
       
    • Let QOI  (Quantity Of Interest) denote some scalar statistic of G (for instance its Mean, Variance, Skweness, ...).
      For instance, if QOI = Mean(G), then  QOI expresses itself as a function of the four parameters theta_1, ..., theta_4.
      The goal of @cq is to understand which of those parameters have the greatest influence on QOI.


    For a quick survey of Sensitivity Analysys (SA) and a presentation of some of the most common strategies see Wiki-Overview


    The simplest SA is the Local SA (LSA) we are all taught at school: having chosen some reference point P in the [theta_1, ..., theta_4] space the 1st order partial derivatives d[n] = diff(QOI, theta_n) expressed at point P give a "measure" (maybe after some normalization) of the sensitivity, at point P, of QOI regardibg each parameter theta_n.


    A more interesting situation occurs when the parameters can take values in a neighorhood of  P which is not infinitesimal, or more generally in some domain without reference to any specific point P.
    That is where Global SA (GSA) comes into the picture.
    While the notion of local variation at some point P is well established, GSA raises the fundamental question of how to define how to measure the variation of a function over an arbitrary domain?
    Let us take a very simple example while trying to answer this question "What is the variation of sin(x) over [0, 2*Pi]?"

    1. If we focus on the global trend of sin(x)  mean there is no variation at all.
    2. If we consider peak-to-peak amplitude the variation is equal to 2.
    3. At last, if we consider L2 norm the variation is equal to Pi.
      (but the constant function x -> A/sqrt(2) has the same L2 norm but it is flat, and in some sense les fluctuating). 


    Statisticians are accustomed to use the concept of variance as a measure to quantify the dispersion of a random variable. At the end of the sixties  one of them, Ilya Meyerovich Sobol’,  introduced the notion of Variance-Based GSA as the key tool to define the global variation of a function. This notion naturally led to that of Sobol' indices as a measure of the sensitivity of a funcion regarding one of its parameters or, which most important, regarding any combination (on says interaction) of its parameters.

    The aim of this post is to show how Sobol' indices can be computed when the function under study has an analytic expression.
     

    The Sobol' analysis is based on an additive decomposition of this function in terms of 2^P mutually orthogonal fiunctions where P is the number of its random parameters.
    This decomposition and the ensuing integrations whose values will represent the Sobol' indices can be done analytically in some situation. When it is no longer the case specific numerical estimation methods have to be used;


    The attached file contains a quite generic procedure to compute exact Sobol' indices and total Sobol' indices for a function whose parameters have any arbitrary statistical distribution.
    Let's immediately put this into perspective by saying that these calculations are only possible if Maple is capable to find closed form expressions of some integrals, which is of course not always the case.

    A few examples are also provided, including the one corresponding to @cq's original question.
    At last two numerical estimation methods are presented.

    SOBOL.mw

     

         On International Women’s Day we celebrate the achievements of women around the world. One inspiring story of women in STEM is that of Sophie Germain (1776-1831), a French mathematician and physicist who made groundbreaking strides in elasticity theory and number theory. She learned mathematics from reading books in her father’s library, and while she was not permitted to study at the École Polytechnique, due to prejudice against her gender, she was able to obtain lecture notes and decided to submit work under the name Monsieur LeBlanc. Some prominent mathematicians at the time, including Joseph-Louis Lagrange and Carl Friedrich Gauss, with whom Germain wrote, recognized her intellect and were supportive of her work in mathematics. 

         Sophie Germain is remembered as a brilliant and determined trailblazer in mathematics. She was the first woman to win a prize from the Paris Academy of Sciences for her contributions in elasticity theory and was among the first to make significant contributions toward proving Fermat’s Last Theorem. Among her many accomplishments, one special case of Fermat’s Last Theorem she was able to prove is when the exponent takes the form of what is now known as a Sophie Germain prime: a prime, p, such that 2p+1 is also a prime. The associated prime, 2p+1, is called a safe prime. 

         To mark International Women’s Day, I’ve created a document exploring the Ulam spiral highlighting Sophie Germain primes and safe primes, as an adaptation of Lazar Paroski’s Ulam spiral document. The image below displays part of the Ulam spiral with Sophie Germain primes highlighted in red, safe primes highlighted in blue, primes that are both a Sophie Germain prime and safe prime highlighted in purple, and primes that are neither in grey. 

      

         The document also contains small explorations of these types of prime numbers. For instance, one interesting property of safe primes is that they must either be 5, 7 or take the form 12k-1 for some k≥1. This can be shown from the fact a safe prime q must equal 2p+1 for some prime, p (a Sophie Germain prime), by definition. Then, since q and p are prime, for q > 7 we can determine through contradiction that q ≡ 3 (mod 4) and q ≡ 5 (mod 6), to conclude q ≡ 11 (mod 12) ≡ -1 (mod 12). And so, q = 12k-1 for some k≥1. The Maple Learn document can be found here along with its Maple script. The document also includes a group where you can test whether some positive integer of your choice, n, is a Sophie Germain prime or a safe prime. Alternatively, given n, a button press will display the next Sophie Germain prime greater than n, using Maple’s NextSafePrime command in the number theory package.  

         In mathematics, there is no shortage of interesting rabbit holes to dive into; many of which are the result of past and present women in mathematics, like Sophie Germain, who have persevered despite their hardships. 

    A checkered figure is a connected flat figure consisting of unit squares. The problem is to cut this figure into several equal parts (in area and shape). Cuts can only be made on the sides of the cells. In mathematics, such figures are called polyominoes, and the problem is called the tiling of a certain polyomino with copies of a single polyomino. See https://en.wikipedia.org/wiki/Polyomino

    Below are 3 examples of such figures:

    We will define such figures by the coordinates of the centers of the squares of which it consists. These points must lie in the first quarter, and points of this figure must lie on each of the coordinate axes.

    Below are the codes for two procedures named  CutEqualParts  and  Picture . Required formal parameters of the first procedure: set  S  specifies the initial figure, r is the initial cell for generating subfigures, m is the number of parts into which the original figure needs to be divided. The optional parameter  s  equals (by default onesolution) or allsolutions. The starting cell  r  should be the corner cell of the figure. Then the set of possible subshapes for partitioning will be smaller. If there are no solutions, then the empty set will be returned. The second procedure  Picture  returns a picture of the obtained result as one partition (for a single solution) or in the form of a matrix if there are several solutions. In the second case, the optional parameter  d  specifies the number of rows and columns of this matrix.

    restart;
    CutEqualParts:=proc(S::set(list),r::list,m::posint, s:=onesolution)
    local OneStep, n, i1, i2, j1, j2, R, v0, Tran, Rot, Ref, OneStep1, M, MM, MM1, T, T0, h, N, L;
    n:=nops(S)/m;
    if irem(nops(S), m)<>0 then error "Should be (nops(S)/m)::integer" fi;
    if not (r in S) then error "Should be r in S" fi;
    if m=1 then return {S} fi;
    if m=nops(S) then return map(t->{t}, S) fi;
    i1:=min(map(t->t[1],select(t->t[2]=0,S)));
    i2:=max(map(t->t[1],select(t->t[2]=0,S)));
    j1:=min(map(t->t[2],select(t->t[1]=0,S)));
    j2:=max(map(t->t[2],select(t->t[1]=0,S)));
    OneStep:=proc(R)
    local n1, R1, P, NoHoles;
    R1:=R;
    n1:=nops(R1);
    R1:={seq(seq(seq(`if`(r1 in S and not (r1 in R1[i]) , subsop(i={R1[i][],r1}, R1)[],NULL),r1=[[R1[i,j][1],R1[i,j][2]-1],[R1[i,j][1]+1,R1[i,j][2]],[R1[i,j][1],R1[i,j][2]+1],[R1[i,j][1]-1,R1[i,j][2]]]), j=1..nops(R1[i])), i=1..n1)};
    NoHoles:=proc(s)
    local m1, m2, M1, M2, M;
    m1:=map(t->t[1],s)[1]; M1:=map(t->t[1],s)[-1];
    m2:=map(t->t[2],s)[1]; M2:=map(t->t[2],s)[-1];
    M:={seq(seq([i,j],i=m1..M1),j=m2..M2)}; 
    if ormap(s1->not (s1 in s) and `and`(seq(s1+t in s, t=[[1,0],[-1,0],[0,1],[0,-1]])), M) then return false fi;
    true;
    end proc:
    P:=proc(t)
    if `and`(seq(seq(seq(([i,0] in t) and ([j,0] in t) and not ([k,0] in t) implies not ([k,0] in S), k=i+1..j-1), j=i+2..i2-1), i=i1..i2-2)) and `and`(seq(seq(seq(([0,i] in t) and ([0,j] in t) and not ([0,k] in t) implies not ([0,k] in S), k=i+1..j-1), j=i+2..j2-1), i=j1..j2-2))  then true else false fi;
    end proc:
    select(t->nops(t)=nops(R[1])+1 and NoHoles(t) and P(t) , R1);
    end proc:
    R:={{r}}:
    R:=(OneStep@@(n-1))(R):
    v0:=[floor(max(map(t->t[1], S))/2),floor(max(map(t->t[2], S))/2)]:
    h:=max(v0);
    Tran:=proc(L,v) L+v; end proc:
    Rot:=proc(L, alpha,v0) <cos(alpha),-sin(alpha); sin(alpha),cos(alpha)>.convert(L-v0,Vector)+convert(v0,Vector); convert(%,list); end proc:
    Ref:=proc(T) map(t->[t[2],t[1]], T); end proc:
    OneStep1:=proc(T)
    local T1, n2, R1;
    T1:=T; n2:=nops(T1);
    T1:={seq(seq(`if`(r1 intersect `union`(T1[i][])={}, subsop(i={T1[i][],r1}, T1), NULL)[], r1=MM1 minus T1[i]), i=1..n2)};
    end proc:
    N:=0; 
    for M in R do
    MM:={seq(seq(seq(map(t->Tran(Rot(t,Pi*k/2,v0),[i,j]),M),i=-h-1..h+1),j=-h-1..h+1),k=0..3),seq(seq(seq(map(t->Tran(Rot(t,Pi*k/2,v0),[i,j]),Ref(M)),i=-h-1..h+1),j=-h-1..h+1), k=0..3)}:
    MM1:=select(t->(t intersect S)=t, MM):
    T:={{M}}:
    T:=(OneStep1@@(m-1))(T):
    T0:=select(t->nops(t)=m, T):
    if T0<>{} then if s=onesolution then return T0[1] else N:=N+1;
     L[N]:=T0[] fi; fi; 
    od:
    L:=convert(L,list);
    if L[]::symbol then return {} else L fi;
    end proc:
    
    Picture:=proc(L::{list,set},Colors::list,d:=NULL)
    local r;
    uses plots, plottools;
    if L::set or (L::list and nops(L)=1) or d=NULL then return
    display( seq(polygon~(map(t->[[t[1]-1/2,t[2]-1/2],[t[1]+1/2,t[2]-1/2],[t[1]+1/2,t[2]+1/2],[t[1]-1/2,t[2]+1/2]] ,`if`(L::set,L[j],L[1][j])), color=Colors[j]),j=1..nops(Colors)) , scaling=constrained, size=[800,600]) fi;
    if d::list then r:=irem(nops(L),d[2]);
    if r=0 then return
    display(Matrix(d[],[seq(display(seq(polygon~(map(t->[[t[1]-1/2,t[2]-1/2],[t[1]+1/2,t[2]-1/2],[t[1]+1/2,t[2]+1/2],[t[1]-1/2,t[2]+1/2]]  ,L[i,j]), color=Colors[j]),j=1..nops(Colors)), scaling=constrained, size=[400,300], axes=none), i=1..nops(L))])) else
    display(Matrix(d[],[seq(display(seq(polygon~(map(t->[[t[1]-1/2,t[2]-1/2],[t[1]+1/2,t[2]-1/2],[t[1]+1/2,t[2]+1/2],[t[1]-1/2,t[2]+1/2]]  ,L[i,j]), color=Colors[j]),j=1..nops(Colors)), scaling=constrained, size=[400,300], axes=none), i=1..nops(L)), seq(plot([[0,0]], axes=none, size=[10,10]),k=1..d[2]-r)]))  fi; fi; 
    end proc:
    

    Examples of use for figures 1, 2, 3
    In the first example for Fig.1 we get 4 solutions for m=4:

    S:=({seq(seq([i,j], i=0..4), j=0..2)} union {[2,3],[3,3],[3,4]}) minus {[0,0],[0,1]}:
    L:=CutEqualParts(S,[0,2],4,allsolutions);
    C:=["Cyan","Red","Yellow","Green"]:
    nops(L);
    Picture(L,C,[2,2]);
    

    In the second example for Fig.2 for m=2, we get 60 solutions (the first 16 are shown in the figure):

    S:={seq(seq([i,j], i=0..4), j=0..4)} minus {[2,2]}:
    L:=CutEqualParts(S,[0,0],2,allsolutions):
    nops(L);
     C:=["Cyan","Red"]:
    Picture(L[1..16],C,[4,4]);
    


    In the third example for Fig.3 and  m=2  there will be a unique solution:

    S:={seq(seq([i,j], i=0..5), j=0..3)}  minus {[5,0],[4,2]} union {[1,4],[2,4]}:
    L:=CutEqualParts(S,[0,0],2):
     C:=["Cyan","Red"]:
    Picture(L,C);
    


    Addition. It is proven that the problem of tiling a certain polyomino with several copies of a single polyomino is NP-complete. Therefore, it is recommended to use the CutEqualParts procedure when the numbers  nops(S)  and  nops(S)/m  are relatively small (nops(S)<=24  and nops(S)/m<=12), otherwise the execution time may be unacceptably long.

    Cutting_equal_parts.mw

    A blue triangle with white text

Description automatically generated

     

    Attention Maple enthusiasts! It gives me great pleasure to announce Maple 2024! Maple 2024 brings together a collection of new features and enhancements carefully designed to enrich your mathematical explorations. Maple 2024 is the result of a lot of hard work by a lot of people, and there is far more in it than I can cover here. But I’d like to share with you some of my favorite features in this release.

     

    AI Formula Assistant

    The AI Formula Assistant in Maple 2024 is undoubtedly the feature that excites me the most, especially considering how often I’m asked the question: 'When will Maple include AI features?' This assistant serves as your new mathematical companion and will change the way you look up and enter formulas and equations. Driven by advanced AI technology, it presents a range of relevant options based on your search query. Alongside suggestions, you'll also receive detailed explanations for each formula and its parameters so you can select the one you need, and then you can insert the formula into your document at a click of a button, as a proper Maple expression.

    A screenshot of a computer

Description automatically generated

     

     

    NaturalLanguage Package

    The Formula Assistant is built on top of the new NaturalLanguage package, which integrates powerful language models like GPT-4 and ChatGPT from OpenAI into Maple. With this feature, you can leverage large language models to process natural language within Maple. Ask the AI to explain concepts, provide additional details, find specific Maple commands, and more. Of course, since this is a Maple package, you can also use it as a basis to build your own AI-powered applications inside Maple. We’re really looking forward to seeing what you will do with it!

     

    A close-up of a document

Description automatically generated

     

     

    Argument Completion
    We’ve had a lot of requests from people who wanted Maple’s command completion features to do even more, and I’m happy to say that Maple 2024 delivers. The new argument completion feature in Maple 2024 is poised to significantly enhance your experience with commands. For many users, including myself, not being aware of all the options a command takes is a challenge, often leading me to refer to help pages for clarification. With argument completion, that's no longer a concern. Just enter the command with the help of the existing command completion feature, then automatic argument completion takes over to guide you through the rest. Give it a try with the 'plot' command!

    A screenshot of a computer

Description automatically generated

     

    Check My Work

    A personal favorite feature that's gotten even better in Maple 2024 is Check My Work. As someone who has tutored students, I vividly recall their stress before exams, often receiving emails and text messages from them seeking last-minute help. At the time, I found myself wishing the students had a way to check their work themselves, so we would all be less stressed! So I was super excited when we added the first Check My Work feature a couple of years ago, and am very happy that it gets better ever year. In Maple 2024, we’ve expanded its capabilities to support problems involving factoring, simplification, and limits.

    A screenshot of a computer

Description automatically generated

    Scrollable Matrices:
    This feature will definitely resonate with many of the engineers in the Maple Primes community. If you're someone who works with worksheets containing large matrices, you've likely wished that you could scroll the matrices inside your document instead of having to launch a separate matrix browser. With Maple 2024, your wish has come true.

     

    A white sheet with numbers and lines

Description automatically generated with medium confidence

     

    Color Bars

    And finally, for those of you who appreciated the addition of color bars in Maple 2023 but wanted to see them extended to more 2D and 3D plots, you'll be delighted to know that this is exactly what we’ve done. We’ve also added new customization options, providing you with greater control over appearance.

     

    A close-up of a graph

Description automatically generated

     

    This is just a partial glimpse of what's new in Maple 2024. For a comprehensive overview, visit What’s New in Maple 2024.

    Maple Transactions frequently gets submissions that contain Maple code.  The papers (or videos, or Maple documents, or Jupyter notebooks) that we get are, if the author wants a refereed submission, sent to referees by a fairly usual academic process.  We look for well-written papers on topics of interest to the Maple community.

    But we could use some help in reviewing code, for some of the submissions.  Usually the snippets are short, but sometimes the packages involved are more substantial.

    If you would be interested in having your name on the list of potential code reviewers, please email me (or Paulina Chin, or Jürgen Gerhard) and we will gratefully add you.  You might not get called on immediately---it depends on what we have in the queue.

    Thank you very much, in advance, for sharing your expertise.

    Rob

    Time is running out for users of Mathcad® 15 worksheets.
    Engineers who need to retain their historical Mathcad project files are faced with a looming deadline to move the content to another file format.

    The good news is that Mathcad 15 users can turn to Maple Flow as an effective replacement design calculation tool. Maple Flow is an advanced calculation tool with a free-form layout that makes it easy for engineers to brainstorm, develop, and document their project designs.

    Maplesoft now has an efficient migration solution for moving critical Mathcad content to Maple Flow worksheets. This gives engineers a path to safeguard their critical reference designs, mathematical analyses, and engineering test results.

    Why are engineers moving from Mathcad 15?
    In 2025, some changes are expected that will severely restrict access to Mathcad 15 software. Here’s some background:

    • PTC announced that Mathcad 15 is end-of-sale effective December 2021, restricting license activations for new users.
    • Those existing Mathcad 15 customers who bought multiyear license extensions will see them expire by December 2025. After that, those with subscription licenses will not be able to open the app, and will not be able to access their historic design documents.
    • One of the significant issues engineers are encountering is that the new version of the software is not directly compatible with their historical Mathcad documents. PTC no longer has the right to distribute software versions with a third-party component, and has opted to use a different symbolic calculation engine in Mathcad Prime® that cannot read and edit the legacy files.
    • Another issue is that the Mathcad 15 software does not support Windows 11, so is typically run on Windows 10, a platform that Microsoft will not be supporting after October 2025.
    • Without a reliable way to keep accessing their project work in the Mathcad 15 format, engineers are looking for an alternative design worksheet platform.

    As a result, engineers with large repositories of these design files now face converting all the worksheets to a new format or risk losing access to valuable design reports, and the possible regulatory consequences.

    Maple Flow as a replacement for Mathcad 15
    Engineers who want a long-term stable environment for their critical project work can change their design workflow to use Maple Flow for everyday calculation tasks.

    The advanced math features and formatting options in Maple Flow make it a good fit for creating (and updating) design documentation and hand calculations, where engineers combine mathematical equations and variables that change regularly, and show the results in a report.

    Maple Flow has a short learning curve, and the range of example templates in the Application Center and the customized training all help users quickly get up to speed with Maple Flow commands and formatting features.

    How can I migrate Mathcad 15 content to Maple Flow?
    Maplesoft has created a series of migration strategies for users of Mathcad software to transition to Maple Flow for ongoing calculation needs or to meet compliance requirements.

    For engineers with a handful of worksheets, or where the calculations only span a few pages, it is relatively quick to reenter the calculations directly in Maple Flow. Some steps will need to be updated to the equivalent Maple Flow function, and there is also the opportunity to use features that are not available in Mathcad 15 (or its successor Mathcad Prime), such as advanced signal processing tools, thermodynamic data, and functionality for the analysis of linear systems.

    For engineering firms with large repositories of legacy Mathcad 15 files, Maplesoft has developed a convenient path to migrate batches of content into Maple Flow. Maplesoft Engineering Services guide customers through the migration process and apply an efficient Migration Assistant to move the equations, variable definitions, units, layout, and other supported features from Mathcad 15 worksheets to Maple Flow. The content is mapped to the equivalent Maple Flow functionality, so that calculations can be run and developed further. This allows project worksheets and templates to be recreated with the least investment in time.

    This image shows a calculation section before and after batch migration into Maple Flow format:

    Ongoing support from Maplesoft

    Maple Flow was first launched in 2021 and was developed to give engineers a single tool that can perform mathematical analysis and present results in a professional-looking format. There is built-in support for natural mathematical notation and tracking units, and the development roadmap continues to follow a user-focused approach, so new usability enhancements are regular and relevant.

    The current release of Maple Flow gives engineers a path to avoid losing legacy calculations and designs previously stuck in Mathcad 15 worksheets and reuse the content for ongoing project work.

    If you would like assistance from Maplesoft with migrating large repositories of design worksheets, please contact Maplesoft Sales.

    [This is a contributed article by Alex Beilby, Technical Marketing Mgr, Maplesoft]

    The Lunar New Year is approaching and 2024 is the Year of the Dragon! This inspired me to create a visualization approximating the dragon curve in Maple Learn, using Maple. 

    The dragon curve, first described by physicist John Heighway, is a fractal that can be constructed by starting with a single edge and then continually performing the following iteration process:  

    Starting at one endpoint of the curve, traverse the curve and build right triangles on alternating sides of each edge on the curve. Then, remove all the original edges to obtain the next iteration. 

    visual of dragon curve iteration procedure 

    This process continues indefinitely, so while we can’t draw the fractal perfectly, we can approximate it using a Lindenmayer system. In fact, Maple can do all the heavy lifting with the tools found in the Fractals package, which includes the LSystem subpackage to build your own Lindenmayer systems. The subpackage also contains different examples of fractals, including the dragon curve. Check out the Maple help pages here: 

    Overview of the Fractals Package  

    Overview of the Fractals:-LSystem Subpackage 

    Using this subpackage, I created a Maple script (link) to generate a Maple Learn document (link) to visualize the earlier iterations of the approximated dragon curve. Here’s what iteration 11 looks like: 

    eleventh iteration of dragon curve approximation  

    You can also add copies of the dragon curve, displayed at different initial angles, to visualize how they can fit together. Here are four copies of the 13th iteration: 

    four copies of the thirteenth iteration of the dragon curve approximation 

     

    Mathematics is full of beauty and fractals are no exception. Check out the LSystemExamples subpackage to see many more examples. 

     

    Happy Lunar New Year! 

     

    A ball on a turntable can move in circles instead of falling off the edge (provided the initial conditions are appropriate). The effect was demonstrated in a video and can be simulated with MapleSim. The amination below shows a simulation of a frictionless case (falling off the table) and the case with a coefficient of friction of one.

    Also demonstrated in the video: Tilting the table leads to a sideward (not a downhill) movement of the ball.

    The presenter of the video noted that in the untilted state, the ball eventually drifts off the table, attributing this to slippage. This drift is also observable in the animation above, where the ball starts moving in a spiral, whereas in a Maple simulation (below to the left), the ball follows a perfect circle. Only after optimizing contact and initial conditions, MapleSim produced a result (using the same parameters) that exhibits a similar circle, with a slight difference in angular orientation after completing two revolutions about the center of the circle.

     

    Some observations on the MapleSim model:

    • The results only slightly depend on the solvers. Numerical inaccuracies do not seem to be the reason for the difference in orientation. (Edit: see update below for the reason).
    • The ball bounces up and down in the MapleSim simulation (0.0025 of the balls radius). The bouncing is caused by the fact that the initial position of the ball is above the elastic equilibrium position with respect to the table (the elastic contact makes the ball sink in a bit). Adding damping in the settings of the contact element attenuates this effect and reduces the drift.
    • Drift is not observable anymore if in the contact element setting for "kmu" (smoothness coefficient of sliding friction) is set to larger values (above 10 in this example). This is an indication that sliding friction occurs during the simulation.
    • Choosing the equilibrium position as initial condition for the ball does not prevent initial bouncing because MapleSim sets an initial velocity for the ball that is directed away from the table. I did not manage to enforce strictly zero velocity. Maybe someone can tell why that is and how to set MapleSim to start the simulation without vertical velocity. (Edit: see update below for the reason).
    • Assuming an initial velocity towards the contact to cancel the initial vertical velocity set by MapleSim substantially reduces bouncing and increases the diameter of the circle. This finally leads to a diameter that matches the Maple simulation. Therefore the initial bouncing combined with slippage seems to dissipate energy which leads to smaller circles. Depending on the contact settings and initial conditions for vertical movement the diameter of the circle varied moderately by about 15%.

    In summary, MapleSim can be parametrized to simulate an ideal case without slippage. From there it should be possible to tune contact parameters to closely reproduce experiments where parameters are often not well known in advance.  

    Some thoughts for future enhancement of MapleSim:

    • In the model presented here, a patterned ball would have been helpful to visualize the tumbling movement of the ball. Marking two opposite sides of the ball with colored smaller spheres is a fiddly exercise that does not look nice.
    • A sensor component that calculates the energy of a moving rigid body would have helped identifying energy loss of the system. Ideally the component could have two ports for the rotational and translational energy components. I see professional interest in such calculations and not only educational value for toy experiments.
    • A port for slippage on the contact elements would have helped understanding where slippage occurs. Where slippage is, there is wear and this is also of interest for industrial applications.

    Turntable_Paradox.msim (contains parameter sets for the above observations)

    February 2nd is Groundhog Day in North America. A day when we look to small marmots to prognosticate the weather. If the groundhog sees its shadow when it emerges from its burrow, then it predicts 6 more weeks of winter, and if not, then spring begins today! Unfortunately there are many official weather predicting groundhogs. Fortunately, the excellent website Groundhog-Day.com tracks each of their predictions. Unfortunately, it doesn't tell you which groundhog to trust. Fortunately, it has an API and we can take the data and map it in Maple:

    This map assumes that each groundhog's prediction is valid at it's exact geographic coordinates, but that it's predictive powers fall off in inverse proportion to the distance away.  So, exactly halfway between a groundhog predicting early spring, and one predicting 6 more weeks of winter, we expect 3 more weeks of winter.  I handle that with Maple's Interpolation:-InverseDistanceWeightedInterpolation command with a radius of 1500 miles.  I plot a contourplot of that interpolating function, and then display it with the world map in DataSets:-Builtin:-WorldMap to generate the image above.

    All the code to do that can be found in the following worksheet which also using the URL packaget to fetch the most recent groundhog data possible from the website.

    Groundhog-Map.mw

    I've commented out a few lines that you might use to explore other possible maps.  You can filter to file to just include real living groundhogs and not all the other precitions (some from puppets, some from other animals) if you find that more trust worthy. You might also prefer to change the interpolation command, one of my collegues suggests that Interpolation:-NaturalNeighborInterpolation might be a better choice.

    First 8 9 10 11 12 13 14 Last Page 10 of 306