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
  • Here 'show triangle napoleon considering the sintaxis Maple, to be supplemented and explained with Math Apps.

    Napoleon_Triangle.mw

     

    Lenin Araujo Castillo

    Hi
    In connection with recent developments in the Physics package, we now have mathematical typesetting for all the inert functions of the mathematical language. Hey! This is within the Physics update available on the Maplesoft Physics: Research & Development webpage

    I think this is an interesting development that will concretely change the computational experience with these functions: it is not the same to compute with something you see displayed as %exp(x) instead of the same computation but flowing with it nicely displayed as an exponential function with the e in grey, reflecting that Maple understands this object as the exponential inert function, with known properties (all those of the active exp function), and so Maple can compute with the inert one taking these properties into account while not executing the function itself - and this is the essence of the inert function behaviour.

    Introducing mathematical display, copy and paste for all these inert functions of the mathematical language concretely increases the mathematical expressiveness of the system, for teaching, working and also for presenting ideas.

    Attached is a brief illustration.

    Edgardo S. Cheb-Terrab
    Physics, Maplesoft

    InertMathematicalFun.mw  InertMathematicalFun.pdf

    Hi all,

    I seem to have triggered a nasty bug in Maple 17.  Consider the following code:

      BlahObject := module()
        option object;
        export BlahMethod := proc()
        local C, d, i;
          add(C[i]*d[i] + C[i], i=1..4);
        return NULL;
        end proc;
      end module;

    It triggers a Maple kernel crash for me when doing object construction:

     B := Object(BlahObject);

    The offending line is the one with add( ). It is ok if I add C[i]*d[i], but when the line contains both * and + it causes kernel death every time.  This is strange as the proc is not even being executed... only constructing the object. 

    I am running Maple 17.02, it's also present in 17.01.  But interestingly, it runs fine in Maple 16.  Bug in Maple 17? 

    Thanks,
    Ian.

    Maplesoft is a long standing supporter of the Who Wants to Be a Mathematician contest for high school students. For years, we have donated Maple as prizes to winners of the national and regional contests.

    This year, being the 25th anniversary of Maplesoft’s incorporation, the company decided to support several projects that encourage the use of math amongst high school students and young adults. We dedicated a bigger budget towards projects that would enable us to make a significant impact on students and impress upon them the need for math and science in their future careers.

    One project we undertook this year is giving an extreme makeover to the Who Wants to Be a Mathematician contest! With Maplesoft as a “Technology Sponsor”, the contest that was administered on pen-and-paper moved to a digital format. We donated our testing and assessment tool, Maple T.A. to administer the tests online, making the software accessible to every student that participated. This meant the students took an online test, and were automatically and instantly graded using Maple T.A.

    The 2013 competition is underway, and the results are extremely positive:

    • The number of students that participated in the contest doubled this year, with over 2000 students from over 150 schools participating.
    • The competition introduced a second level of tests, making the competition more rigorous. After the first elimination round, eligible contestants moved to a second round with questions of increased difficulty levels.
    • By avoiding much of the paper work and manual corrections, the organizers saw significant savings in time and money.

    Custom test questions were created in Maple T.A., which were accessed by students from a server hosted by Maplesoft. The simple and easy to use interface of Maple T.A. enabled the students to take the test without spending time learning the tool. Maple T.A. supports the use of standard mathematical notation in both the question text and student responses. Maple T.A. also allows free-response questions, including questions that have more than one correct answer.

    Who Wants to Be a Mathematician is a math contest for high school students, organized by the American Mathematical Society (AMS), as part of its Public Awareness Program. Ten students will be chosen for the semifinals and two will qualify for the finals to be held at the Joint Math Meetings in January 2014.

    More information about the contest that is currently in progress can be found on the AMS website

     

    Just came across this

    Press esc twice then enter.  Maple becomes unresponsive. 

     

     

    I made a small change to the Task Filtering code I uploaded a few weeks ago.  The new code has better memory performance and, most importantly has more stable memory usage which means it can actually run very large examples.  Here is the new version of the code:

    FilterCombPara := module( )
        local ModuleApply,
                doSplit,
                splitCombs,
                makeNewPrefix,
                lessThanX,
                filterCombs;

        lessThanX := proc( x, i ) x<=i; end;

        doSplit := proc( i::integer, prefix::set(posint), rest::set(posint),
                                                    k::posint, filter::appliable, $ )
            splitCombs( prefix union {i}, remove( lessThanX, rest, i ), k-1, filter );
        end;

        splitCombs := proc( prefix::set(posint), rest::set(posint), k::posint,
                                                                    filter::appliable, $ )
            if ( numelems( rest ) < k ) then
                NULL;
            elif ( k = 1 ) then
                filterCombs( prefix, rest, filter );
            else
                op( Threads:-Map( doSplit, rest, prefix, rest, k, filter ) );
            end;
        end;

        makeNewPrefix := proc( i, prefix ) { i, op( prefix ) } end;
        filterCombs := proc( prefix::set(posint), rest::set(posint), filter::appliable, $ )
            local i, f;

            op(select( filter, map( makeNewPrefix, rest, prefix ) )):
        end;

        ModuleApply := proc( n::posint, k::posint, filter::appliable, $ )
            [ splitCombs( {}, {seq( i,i=1..n )}, k, filter ) ];
        end;

    end:

    This code has the small mapping functions as module members instead of declared inline.  This means that less memory is churned as this code is excuted.  For a long runs, this helps keeps the memory stable.

    As an example, I ran the following example:

    > CodeTools:-Usage( FilterCombPara( 113,7, x->false ) );
    memory used=17.39TiB, alloc change=460.02MiB, cpu time=88.52h, real time=20.15h
                                                      []

    It used 88 CPU hours to run, but only 20 hours of real time (go parallelism!)  It used 17 Terabytes of memory, but only allocated 500 M.  This example is pretty trival, as the filter returned false for all combinations, so it did not collect any matches during the run.  However as long as the number of matches is small, that shouldn't be an issue.  If the number of matches is too large to fit in memory, then this code may need to be modified to write the matches out to disk instead of trying to hold them all in memory at once.

    Darin

    -- Kernel Developer Maplesoft

    FilterComb.mw

    Good morning to all our Mapleprimes members.

     

    It is very helpful to many persons who are very passion and dedicated to teach Mathematics using Maple technology if the software package is loaded with updated maple procedures of all the topics.

    I am being of them, request the technical authorities and the eminant professors to support and develop this requirement.It becomes an open door to many people to enter and aquire the immence knowledge in Maple.

     

     

    With thanks & Regards

     

    M.Anand

    Assistant Professor in Mathematics

    SR International Institute of Technology,

    Hyderabad, Andhra Pradesh, INDIA.

    The work consists of two independent procedures. The first procedure  IsConvex  checks the convexity of a polygon. The second procedure  IsSimple  verifies the simplicity of a polygon. Formal argument   is the list of vertices of the polygon.

    Regarding the basic concepts, see  http://en.wikipedia.org/wiki/Polygon

     

    IsConvex:=proc(X::listlist)

    local n, Z, f, i, x, y;

    n:=nops(X);

    Z:=[op(X),X[1]];

    f:=seq((x-Z[i,1])*(Z[i+1,2]-Z[i,2])-(y-Z[i,2])*(Z[i+1,1]-Z[i,1]),i=1..n);

       for i to n do

        if  convert([seq(is(subs(x=j[1],y=j[2],f[i])<=0), j in {op(X)} minus  {X[i],X[irem(i,n)+1]})],`or`) and      convert([seq(is(subs(x=j[1],y=j[2],f[i])>=0),

        j in {op(X)} minus {X[i],X[irem(i,n)+1]})], `or`) then break fi;

       od;

    if i<=n then return false else true fi;

    end proc:

     

    IsSimple:=proc(X::listlist)

    local n, Z, i, j, f, T, Q, x, y;

    Z:=[op(X),X[1],X[2]]; n:=nops(X);

    if n>nops({op(X)}) then   return false  fi;

       for i from 2 to nops(Z)-1 do

         if is((Z[i-1,1]-Z[i,1])*(Z[i+1,1]-Z[i,1])+(Z[i-1,2]-Z[i,2])*(Z[i+1,2]-Z[i,2]) =  sqrt((Z[i-1,1] -Z[i,1])^2+(Z[i-1,2]-Z[i,2])^2)*sqrt((Z[i+1,1]-Z[i,1])^2 +(Z[i+1,2]-Z[i,2])^2)) then return false fi;

       od;

    f:=seq((x-Z[i,1])*(Z[i+1,2]-Z[i,2])-(y-Z[i,2])*(Z[i+1,1]-Z[i,1]),i=1..n);

    _Envsignum0:= 0: 

       for i from 1 to n do

       T[i]:=[]; Q[i]:=[];

          for j from 1 to n do

          if modp(j-i,n)<>0 and modp(j-i,n)<>1 and modp(j-i,n)<>n-1 and                  not(signum(subs(x=Z[j,1],y=Z[j,2],f[i])*subs(x=Z[j+1,1],y=Z[j+1,2],f[i]))=-1 and             signum(subs(x=Z[i,1],y=Z[i,2],f[j])*subs(x=Z[i+1,1],y=Z[i+1,2],f[j]))=-1) then

          if (subs(x=Z[j,1],y=Z[j,2],f[i])=0 implies (signum((Z[j,1]-Z[i,1])*(Z[i+1,1]-Z[j,1]))=-1 or             signum((Z[j,2]-Z[i,2])*(Z[i+1,2]-Z[j,2]))=-1)) then

          T[i]:=[op(T[i]),1]; Q[i]:=[op(Q[i]),1] else  T[i]:=[op(T[i]),1]  fi; fi;   od;

           od; 

    convert([seq(nops(T[i])=n-3,i=1..n), seq(nops(Q[i])=n-3,i=1..n)],`and`)  

    end proc:

     

    Examples:

    X:=[[0,0],[1,0],[2,1],[3,0],[4,0],[2,2]]: IsConvex(X), IsSimple(X);

    X:=[[0,0],[2,0],[1,1],[1,-1]]: IsConvex(X), IsSimple(X);

    X:=[[0,0],[2,0],[1,1],[1,0], [-1,-1]]: IsConvex(X), IsSimple(X);

    X:=[[0,0],[1,0],[1,2],[-2,2],[-2,-2],[3,-2],[3,4],[-4,4],[-4,-4],[5,-4],[5,6],[-6,6],[-6,-6],[7,-6],[7,8],[-6,8],[-6,7],[6,7],[6,-5],[-5,-5],[-5,5],[4,5],[4,-3],[-3,-3],[-3,3],[2,3],[2,-1],[-1,-1],[-1,1],[0,1]]: IsConvex(X), IsSimple(X);

    X:=[seq([cos(2*Pi*k/17), sin(2*Pi*k/17)], k=0..16)]: IsConvex(X), IsSimple(X);

    Testing_polygons.mws 

    Edited: The variables  x  and  y  are made local.

     

    La aplicacion de las matrices en su más claro ejemplo, dirigido explicitamente a la criptografia; solo hay que tener conocimiento de algebra de matrices y calculo de matriz inversa. (versión español).

    The application of the matrices in its most obvious example, explicitly directed to cryptography; just have to have knowledge of matrix algebra and inverse matrix calculation. (version english).

     

    Criptografia.mw

     

    Lenin Araujo Castillo

    Physics Pure

    Computer Science

    I am baffled by this choice of Maple. When one goes to Maple website and look at the help pages on the web, like this

    http://www.maplesoft.com/support/help/Maple/view.aspx?path=convert/rational

    Then all the commands in the help pages are shown using build-in images. This means if one sees a command they want to copy to try, they are not able to copy it using the mouse since it is an image, or even may be to copy it to some text file for later use, email it, etc...

    Basically one can just look at it. 

    Compare this to Mathematica web help page

    http://reference.wolfram.com/mathematica/ref/Rationalize.html

    Where one can click on any Mathematica command, and a small windows opens with plain text format of the command that one can copy and paste anywhere.

    Not only that, the formatting of the commands in Maple help pages are all in the new document mode style (the italic math font used, which I can't stand looking at, that is why I do not use document mode). 

    So, for someone using worksheet, and want to see the good old fashioned Maple commands (1D, nothing fancy, plain text), they can't find those.  It would be nice to have a version of the help web pages in 1D, for those who want to browse help in classical Maple code and not interested in all document mode.

    (Yes, I know I can do that in Maple itself on my desktop, but many times I use google to find a Maple command, and it leads me to Maple help pages, and then I find I can't copy the command). Then I have to open the local help page on my Maple, and look for the same command again in order to copy something).

     

    I really very much like this package since it works just perfectly converting units and also supports CGS for people doing calculations in theoretical physics. I have just a suggestion concerning the formattig: As is explained in many physics books and also at the units standard website http://physics.nist.gov/, units shouldn't be placed in square brackets since these brackets are defined such that [m] = kg means: unit of m is kg. To write is m = 3 [kg] is a very common and unharmful mistake, also used very often when labelling axes in figures, e.g. m [kg] instead of the correct m/kg or m (kg). Another issue is that units shouldn't be printed italic but upright and any physics journal requests its authors to consider this rule. Again, this is not a "mistake" but on the other hand the Maple pretty-print output is already so nice that considering such rules would even make it perfect.

    I am fully aware that omitting the brackets could be considered harmful if someone has an algebraic expression in front of the unit where symbols and units could be mixed. On the other hand having the usual interspace between unit and expression, the unit being upright and maybe even coloured (analogously to e.g. operators in the physics package) units and symbols could be easily held apart.

    On the help page updates,Maple17,SignalProcessing

    If I open the current help page in a worksheet window and enter through each line individually I get an error on executing 2.1.8

    The !!! will execute the whole page no problem although it brings up the second issue which is using the stop hand, it won't stop the calculation of the entire worksheet part way through. 

     

    Congratulations to Eric Miles, a graduate teaching assistant at Colorado State University, for winning the second individual prize of The Möbius App Challenge! Eric will be receiving an iPad prize pack for his app Stretch and Translate Sin(x).

    Maplesoft launched the Möbius App Challenge earlier this year to give Maplesoft community members the opportunity to get involved in the creation of Möbius Apps. This contest seeks to challenge users to create Math Apps using Maple, submit them to The Möbius Project website, then award the most useful, creative, and effective submissions. Finalists from the individual level challenge are chosen four times a year, so make sure to enter the next round of the challenge for your chance at a Maplesoft prize pack!

    For full contest details and to enter, please visit: http://www.maplesoft.com/lp/mobius/index.aspx.

    Jonny Zivku
    Maplesoft Product Manager, Maple T.A.

    Well-known problem is the problem of placing eight shess queens on an 8×8 chessboard so that no two queens attack each other. In this post, we consider the same problem of placing  m  shess queens on an  n×n  chessboard. The problem has a solution if  n>3  and  m<=n .

    Work consists of two procedures. The first procedure  Queens  returns the total number of solutions and saves a complete list of all solutions (global variable  S ). The second procedure  QueensPic  shows the user-defined solutions from the list  S  on the board. Formal argument  t  is the number of solutions in each row of the display. The second procedure should be used in the standard interface, rather than in the classic one, since in the latter it may not work properly.

    Queens := proc (m::posint, n::posint)

    local It, K, l, L, M, P;

    global S, p, q;

    It := proc (L)

    local P, k, i, j;

    M := []; k := nops(L[1]);

    for i in L do

    for j to n do

    if convert([seq(j <> i[s, 2], s = 1 .. k)], `and`) and convert([seq(l[k+1]-i[s, 1] <> i[s, 2]-j, s = 1 .. k)], `and`) and convert([seq(l[k+1]-i[s, 1] <> j-i[s, 2], s = 1 .. k)], `and`) then M := [op(M), [op(i), [l[k+1], j]]]

    fi;

    od; od;

    M;

    end proc;

    K := combinat:-choose([`$`(1 .. n)], m);

    S := [];

    for l in K do P := [];

    L := [seq([[l[1], i]], i = 1 .. n)];

    P := [op(P), op((It@@(m-1))(L))];

    S := [op(S), op(P)]

    od;

    p := args[1]; q := args[2];

    nops(S);

    end proc:

     

    QueensPic := proc (M, t::posint)

    local m, n, HL, VL, T, A, N;

    uses plottools, plots;

    m := p; n := q; N := nops(args[1]);

    HL := seq(line([.5, .5+k], [.5+n, .5+k], color = black, thickness = 2), k = 0 .. n);

    VL := seq(line([.5+k, .5], [.5+k, .5+n], color = black, thickness = 2), k = 0 .. n);

    T := [seq(textplot([seq([op(M[i, j]), Q], j = 1 .. m)], color = red, font = [TIMES, ROMAN, 24]), i = 1 .. N)];

    if m <= n and 3 < n then

    A := seq(display(HL, VL, T[k], axes = none, scaling = constrained), k = 1 .. N), seq(display(plot([[0, 0]]), axes = none, scaling = constrained), k = 1 .. t*ceil(N/t)-N);

    Matrix(ceil(N/t), t, [A]);

    display(%);

    fi;

    end proc:

     

    Examples of work:

    Queens(5, 6);  

    S[70], S[140], S[210];

    QueensPic([%], 3); 

                                                                                248

    [[1, 5], [2, 3], [3, 6], [4, 4], [6, 1]], [[1, 3], [2, 5], [4, 1], [5, 4], [6, 2]], [[2, 1], [3, 4], [4, 2], [5, 5], [6, 3]]

     

    Two solutions of classic problem:

    Queens(8, 8); 

    S[64..65];

    QueensPic(%, 2);

                                                                                          92

    [[[1, 5], [2, 8], [3, 4], [4, 1], [5, 7], [6, 2], [7, 6], [8, 3]], [[1, 6], [2, 1], [3, 5], [4, 2], [5, 8], [6, 3], [7, 7], [8, 4]]]

     

     

    Queens_problem.mw

    First 81 82 83 84 85 86 87 Last Page 83 of 297