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
  • Hello, everyone! My name’s Sophie and I’m an intern at Maplesoft. @Samir Khan asked me to develop a couple of demonstration applications using the DeepLearning package - my work is featured on the Application Center

    I thought I’d describe two critical commands used in the applications – DNNClassifier() and DNNRegressor().

    The DNNClassifier calls tf.estimator.DNNClassifier from the Tensorflow Python API. This command builds a feedforward multilayer neural network that is trained with a set of labeled data in order to perform classification on similar, unlabeled data.

    Dataset used for training and validating the classifier has the type DataFrame in Maple. In the Prediction of malignant/benign of breast mass example, the training set is a DataFrame with 32 columns in total, with column labels: “ID Number”, “Diagnosis”, “radius”, “texture”, etc. Note that labeling the columns of the dataset is mandatory, as later the neural network needs to identify which feature column corresponds to which list of values.

    Feature columns are what come between the raw input data and the classifier model; they are required by Tensorflow to specify how the input data should be transformed before given to the model. Maple now supports three types of Feature Columns, including:

    • NumericColumn that represents real, numerical figure,
    • CategoricalColumn that denotes categorical(ordinal) data
    • BucketizedColumn that organizes continuous data into a discrete number buckets with specified boundaries.

    In this application, the input data consists of 30 real, numeric values that represents physical traits of a cell nucleus computed from a digitized image of the breast mass. We create a list of NumericColumns by calling

    with(DeepLearning):
    fc := [seq(NumericColumn(u,shape=[1]), u in cols[3..])]:

    where cols is a list of column labels and shape[1] indicates that each data input is just a single numeric value.

    When we create a DNNClassifier, we need to specify the feature columns (input layer), the architecture of the neural network (hidden layers) and the number of classes (output layer). Recall that the DNNClassifier builds a feedforward multilayer neural network, hence when we call the function, we need to indicate how many hidden layers we want and how many nodes there should be on each of the layer. This is done by passing a list of non-negative integers as the parameter hidden_units when we call the function. In the example, we did:

    classifier := DNNClassifier(fc, hidden_units=[20,40,20],num_classes=2):

    where we set 3 hidden layer each with 20, 40, 20 nodes respectively. In addition, there are 30 input nodes (i.e. the number of feature columns) and 1 output node (i.e. binary classification). The diagram below illustrates a simpler example with an input layer with 3 nodes, 2 hidden layers with 7, 5 nodes and an output layer with 1 node.

    (Created using NN-SVG by https://github.com/zfrenchee/NN-SVG)

    After we built the model, we can train it by calling

    classifier:-Train(train_data[3..32], train_data[2], steps = 256, num_epochs = 3, shuffle = true):

    where we

    1. Give the training data (train_data[3..32]) and the corresponding labels (train_data[2]) to the model.
    2. Specified that the entire dataset will be passed to the model for three times and each iteration has 256 steps.
    3. Specified that data batches for training will be created by randomly shuffling the tensors.

    Now the training process is complete, we can use the validation set to evaluate the effectiveness of our model.

    classifier:-Evaluate(test_data[3..32],test_data[2], steps = 32);

    The output indicates an accuracy of ~92.11% in this case. There are more indices like accuracy_basline, auc, average_loss that help us decide if we need to modify the architecture for better performance.

    We then build a predictor function that takes an arbitrary set of measurements as a DataSeries and returns a prediction generated by the trained DNN classifier.

    predictor := proc (ds) classifier:-Predict(Transpose(DataFrame(ds)), num_epochs = 1, shuffle = false)[1] end proc;

    Now we can pass a DataSeries with 30 labeled rows to the predictor: (Recall the cols is a list of the column names)

    ds := DataSeries([11.49, 14.59, 73.99, 404.9, 0.1046, 8.23E-02, 5.31E-02, 1.97E-02, 0.1779, 6.57E-02, 0.2034, 1.166, 1.567, 14.34, 4.96E-03, 2.11E-02, 4.16E-02, 8.04E-03, 1.84E-02, 3.61E-03, 12.4, 21.9, 82.04, 467.6, 0.1352, 0.201, 0.2596, 7.43E-02, 0.2941, 9.18E-02], labels = cols[3..]); 
    predictor(ds);
    

    The output indicates that the probability of this data being a class _id [0] is ~90.79%. In other words, according to our model, the probability of this breast mass cell being benign is ~90.79%.

    The use of the DNNRegressor is very similar (almost identical) to that of the Classifier, the only significant difference is that while the Classifier predicts discrete labels as classes, the Regressor predicts a continuous qualitative result with the provided data (Note that CategoricalColumn is still applicable). For more details about the basic usage of the DNNRegressor, please refer to Predicting the burnt area of a forest fires with DNN Regressor.

     

    Mukhametshina Liya

    Games with pseudo-fractals
     

    Homothety_Fractals.mw

     

      

      

    Aleksandrov Denis,
    7th grade
    secondary school #57 of Kazan

    _ANIMATED_PICTURE_ON_THE_COORDINATE_PLANE_Aleksandrov_D..mw

     

    We have just released a new version of MapleSim.  The MapleSim 2018 family of products offers new tools for developing digital twins, greater connectivity with other modeling tools, and expanded modeling scope. Improvements include:

    • New tools for creating motion profiles
    • FMI  import for FMI 2.0 Fixed-Step Co-Simulation
    • Optimized handling of large models
    • Inclusion of temperature effects in the MapleSim Hydraulics Library from Modelon and MapleSim Pneumatics Library from Modelon
    • Heat transfer through air and water with the MapleSim Heat Transfer Library from CYBERNET

    See What’s New in MapleSim 2018 for more information about these and other improvements.

    Who should be considered an 'expert'? How does one achieve expert status? In this guest MaplePrimes blog post, 'Understanding Maple' author Ian Thompson discusses his view of what makes an expert, his journey of becoming an expert in Maple, and the process of putting together and perfecting this resource for Maple users.

     

    In days of 8-bit computers, one would sometimes encounter individuals who knew everything about a particular device or piece of software. Single programmers wrote entire applications or games, and some could debug their work by looking directly at a core dump (a printout of the numbers stored in the computer’s memory). Some even managed to take computers beyond their specifications by exploiting design loopholes that the manufacturers hadn’t foreseen or intended. It would be fair to classify such individuals as ‘experts’.

    Fast forward twenty five years, and the picture is far less clear. The complexity of computers and software has grown to such an extent that even relatively small smartphone applications are created by teams of developers, and nobody understands every aspect of a CPU chip, much less an entire PC or tablet. Who now should be classified as an expert? One possibility is that an expert is a person who may sometimes need to look up the details of a rarely used command or feature, but who is never confused or frustrated by the behavior of the system or software in question (except where there is a bug), and never needs help from anyone, except perhaps on rare occasions from its creators.

    This rather stringent definition makes me an expert in only two areas of computing: the Fortran programming language, and the mathematical computation system Maple. An argument could be made for the typesetting system LATEX, but whilst this has a large number of expert users, there is also a much smaller group of more exalted experts, who maintain the system and develop new packages and extensions. It would be fair to say that I fall into the first category, but not the second.*

    How does one achieve expert status? Some software actively prevents this, by hiding its workings to such an extent that fully understanding its behavior is impossible. Where it is possible to gain expert status, I have experienced two very different routes, both starting during my time as a research student, when it became clear that Fortran and Maple would be useful in my work. There were several parallels. I knew a little about both, having used them for basic tasks as an undergraduate. However, working out why things went wrong and how to fix them was time-consuming and unrewarding, since it often relied on magic recipes obtained from unreliable sources, and in many cases I didn’t really understand why these worked, any more than I understood why my own attempts had not. I realized then that knowing a little was at the root of these problems. Partial knowledge, supplemented by contradictory, outdated and even downright bad advice from websites and well-meaning individuals (some of whom invariably labor under false pretences of their own expert status) is not an efficient way to approach scientific computing. In fact it’s just a recipe for frustration. In the case of Fortran, fixing this turned out to be easy, because there are lots of good books on the subject. Reading one of these eliminated all of my problems with the language at a stroke. I can’t claim that I remembered every command and its syntax, nor do I know them all now. This is hardly surprising — the Fortran Language Standard (a very terse document that sets out everything the language provides) now extends to more than 600 pages. Instead, the book provided a general picture of how things work in Fortran, and showed the right way to go about tackling a problem. This investment in time has since paid itself back hundreds of times over.

    The route to expert status in Maple was far more challenging. Its own help pages give a very comprehensive description of individual commands, but they are intended as a reference guide, and if it’s possible to become an expert using these alone, then I never discovered the correct order in which to read them. I found a number of books on Maple in the university library, but most were too basic to be useful, and others focused on particular applications. None seemed likely to give me the general picture — the feel for how things work — that would make Maple into the time-saving resource it was intended to be.

    The picture became clearer after I taught Maple to students in three different courses. Nothing encourages learning better than the necessity to teach someone else! Investigating the problems that students experienced gave me new opportunities to properly understand Maple, and eventually the few remaining gaps were filled in by the Programming Guide. This is a complex document, similar in length to the Fortran Language Standard, but with more examples. Personally I would only recommend it to readers with experience of programming language specifications. Students now started to ask how I came to know so much about Maple, and whether there was a book that would teach them the same. Since no such book existed, I decided to write one myself. As the old adage goes, if you want something doing properly, do it yourself. The project soon began to evolve as I tried to set down everything that the majority of Maple users need to know. I’ve always hated books that skirt around important but difficult topics, so where before I might have used a dirty trick to circumnavigate a problem, now I felt compelled to research exactly what was going on, and to try to explain it in a simple, concise way. When the first draft was complete, I approached Cambridge University Press (CUP). The editor arranged for reviews by four anonymous referees**, and by Maplesoft’s own programming team. This led to several major improvements. My colleague, Dr Martyn Hughes, also deserves a mention for his efforts in reading and commenting on four different drafts. Meanwhile, Maplesoft continued to release new editions of their software, and the drafts had to be revised to keep up with these. The cover was created by one of CUP’s designers, with instructions that it should not look too ‘treeish’ — one might be surprised by the number of books that have been written about Maple syrup, and it would be a shame for Understanding Maple to be mixed up with these by potential readers browsing the internet. Then there were the minor details: how wide should the pages be? What font should be used? Should disk be spelled with a ‘c’ or a ‘k’? Could quotes from other sources be used without the threat of legal action over copyright infringement? One rights holder laughably tried to charge $200 for a fragment of text from one of their books. Needless to say, no greenbacks were forthcoming.

    The resulting book is concise, with all the key concepts needed to gain an understanding of Maple, alongside numerous examples, packed into a mere 228 pages. It gives new users a solid introduction, and doesn’t avoid difficult topics. It isn’t perfect (in fact I have already started to list revisions that will be made if a second edition is published in the future) but I’ve seen very few problems that can’t be solved with the material it contains. Only time will tell if Understanding Maple will it create new experts. At the very least, I would certainly like to think it will make Maple far easier to grasp, and help new users to avoid some of the traps that caught me out many years ago.

     

    Learn more about Understanding Maple, which is published by Cambridge University Press.

    There are many questions that complain about Latex conversion in Maple.

    I'd like to again request that Maplesoft improves Latex output of its expressions. If Maple can just fix how it generates fractions, that will good enough for now.

    I am willing to send Maplesoft a personal check of the amount of one month salary for one of your developers to do this fix if you are willing to do it. It should not take more than one month to do this simple fix in your code. It might even take one day if someone knows the code.

    The problem comes when there is a fraction in the expression. the Latex output instead of using proper latex code using "\frac{}{}", it instead uses "/" which makes the output terrible.

    Another case, where Maple generate (expression)^{-1} instead of \frac{1}{expression}.

    It can't be that hard to fix these 2 issues, which can go a long way towards making the latex generated by Maple much better. Here is an example

    eq:=-(1/2)*1/y = (1/3)*x^3+z:
    sol:=solve(eq,y);

    latex(sol);
    -3/2\, \left( {x}^{3}+3\,z \right) ^{-1}

    Which renders as

    Which is terrible. The screen output is much better.

    Compare this to Mathematica

    eq = -(1/2)*(1/y) == (1/3)*x^3 + z;
    sol = y /. First@Solve[eq, y];
    TeXForm[sol]
    
       -\frac{3}{2 \left(x^3+3 z\right)}

    Which renders in Latex as

    If Maplesoft does not think Latex is improtant, then they are completely wrong. CAS support in Latex is very important. Ignoring Latex means you will lose customers who want good Latex support of the math output of Maple. After all, Math and Latex go togother. And Maple is supposed to be all about Mathematics.

    Any chance of Maplesoft taking some time to fix these issues in Latex? Maple has not had any improvement in Latex for years and years. I keep buying Maple each year, and nothing changes in its Latex export.

    thank you

    vv if you could please help adjust your code.  I've adjusted the start of the eurocup code to match the world cup however I haven't decoded your coding and probably won't be able to have time before the world cup starts.  I've got as far as adding the teams, flags and ratings of each team.

    Let me just say while copying and pasting the flag bytes to the code, Maple became a bitch to work worth (pardon my language) but I became so frustated because my laptop locked up twice.  The more I worked with Maple the slower it got, until it froze right up.  Copying and pasting large data in maple is almost to near IMPOSSIBLE.  .. perhaps this could be a side conversation.

    Here's the world cup file so far.

    2018_World_Cup.mw

    **edit added**
    Fixed flag sizes, couple of other fixes in other stats and added some additional stats
    2018_World_Cup7.mw

     

    ANIMATED image of cascade of opening matryoshkas

    E.R. Ibragimova

     

     

    ИбрагимоваЭ.Р_03_Казань_Матрёшки.mws

    Murtazin Shamil, 6th grade

    Simulation of the animated image "Flask with bubbles"

     

    FLASC_Murtazin_S.A..mw

    In as much as the embedded component suite is a brilliant tool for the custom design of online educational programs, student tests, etc, my purposes are orientated around encouraging and assisting of self directed investigation, with the utilization of the packages of maple, but in a manner that allows the user to neglect the requirement to have any knowledge of maple code itself, allowing them to focus entirely on their discipline of choice. 

    So because the content the user will enter into the interface I am designing is naturally going to be quite variant from individual to individual, one of the  necessary properties that does not exist is for the math containers to have the option of being resizeable at the discretion of the user.

    At the moment, I have added buttons that allow the user to resize the window by pressing one of four buttons entitled "increase height". "decrease height", "increase width" and "decrease height". This will suffice for my first working prototype but i just feel that it would be much neater if it were possible to resize the math component directly, and some option of the neighbouring embedded components to either shift their position accordingly, or maintain rectilinear alignment with the greater proportion of other components by all embedded components shifting accordingly when one math container is resized.

     

    I just feel that if at least one person less experienced than me reads this it will be a worth while post, because it will help them avoid things that eluded me when I was younger.


     

    The omitted function definitions are not relevant to the reason for which I decided to post about this. I would like the maple user to simply observe how many variables are involved in the relation's (R) three equalities in the consideration of the output.

     

    The reason I believe this is important, is that it is sometimes very easy to believe induction is sufficient proof of the truth value of a relation over the superset of a subset that has been enumerated, much like the example of the coefficients of the
    "105^(th) cyclotomic polynomial if one were to inductively reason statements about the coeffiecents of the previous 104 polynomials."

     

     

    A[n, k, M] = abs(C[0](n, k, M))/abs(C[1](n, k, M)); B[n, k, M] = abs(C[0](n, k, M))/abs(C[2](n, k, M)); E[n, k, M] = abs(C[1](n, k, M))/abs(C[2](n, k, M))

    R

    "`𝓃`(A[n,k,M])=`𝓃`(B[n,k,M]), `𝓃`(E[n,k,M])=`𝒹`(A[n,k,M]),`𝒹`(B[n,k,M])=`𝒹`(E[n,k,M])]"

    for t to 7 do R(t, 2, 30) end do

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 1, 1 = 1, 1 = 1]

     

    [1 = 11^(1/2)*7^(1/2), 11^(1/2)*7^(1/2) = 1, 7 = 7]

    (1)


     

    Download INDUCTION_IS_NOT_YOUR_FREN.mw

    Up to swMATH   Maple is referenced in 4183 articles   in zbMATH   and

    up to swMATH Mathematica is referenced in 4654 articles  in zbMATH.

    These numbers are sure unexpected to me. I think the ratio of the prices of academic editions MMA/Maple (which approximately equals 2 ) truly reflects their capabilities.

     

    At a recent undegraduate competition the students had to compute the following limit

     

    Limit( n * Diff( (exp(x)-1)/x, x$n), n=infinity ) assuming x<>0;

    Limit(n*(Diff((exp(x)-1)/x, `$`(x, n))), n = infinity)

    (1)

     

    Maple is able to compute the symbolic n-fold derivative and I hoped that the limit will be computed at once.

    Unfortunately it is not so easy.
    Maybe someone finds a more more straightforward way.

     

    restart;

    f := n * diff( (exp(x)-1)/x, x$n );

    n*(-1/x)^n*(-GAMMA(n+1)+GAMMA(n+1, -x))/x

    (2)

    limit(%, n=infinity);

    limit(n*(-1/x)^n*(-GAMMA(n+1)+GAMMA(n+1, -x))/x, n = infinity)

    (3)

    simplify(%) assuming x>0;

    limit(-(-1)^n*x^(-n-1)*n*(GAMMA(n+1)-GAMMA(n+1, -x)), n = infinity)

    (4)

     

    So, Maple cannot compute directly the limit.

     

    convert(f, Int) assuming n::posint;

    -n*(-1/x)^n*(-x)^(n+1)*GAMMA(2+n)*(Int(exp(_t1*x)*_t1^n, _t1 = 0 .. 1))/((n+1)*(Int(_k1^n*exp(-_k1), _k1 = 0 .. infinity))*x)

    (5)

    J:=simplify(%)  assuming n::posint;

    n*(Int(exp(x*_k1)*_k1^n, _k1 = 0 .. 1))*GAMMA(n+1)/(Int(_k1^n*exp(-_k1), _k1 = 0 .. infinity))

    (6)

    L:=convert(J, Int) assuming n::posint;

    n*(Int(exp(x*_k1)*_k1^n, _k1 = 0 .. 1))

    (7)

    L:=subs(_k1=u, L);

    n*(Int(exp(x*u)*u^n, u = 0 .. 1))

    (8)

     

    Now it should be easy, but Maple needs help.

     

    with(IntegrationTools):

    L1:=Change(L, u^n = t, t) assuming n::posint;

    Int(exp((x*t^(1/n)*n+ln(t))/n), t = 0 .. 1)

    (9)

    limit(L1, n=infinity);  # OK

    exp(x)

    (10)

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

    Note that the limit can also be computed using an integration by parts, but Maple refuses to finalize:

    Parts(L, exp(u*x)) assuming n::posint;

    n*(exp(x)/(n+1)-(Int(u^(n+1)*x*exp(x*u)/(n+1), u = 0 .. 1)))

    (11)

    simplify(%);

    n*(-x*(Int(u^(n+1)*exp(x*u), u = 0 .. 1))+exp(x))/(n+1)

    (12)

    limit(%, n=infinity);

    limit(n*(-x*(Int(u^(n+1)*exp(x*u), u = 0 .. 1))+exp(x))/(n+1), n = infinity)

    (13)

    value(%);  # we are almost back!

    limit(n*((-x)^(-n)*(-(n+1)*n*GAMMA(n)/x-(-x)^n*(x-n-1)*exp(x)/x+(n+1)*n*GAMMA(n, -x)/x)+exp(x))/(n+1), n = infinity)

    (14)

     

    Typically, we publish a “Meet Your Developers” profile, where you can get an inside look at the lives of our developers. Today, we’re excited to bring you something a little different, a glimpse into the life of Maple Product Manager, Samir Khan.

    Let's get right to it.

    1. What do you do at Maplesoft?

    I’m 50% of the product management team for Maple. I act as an interface between our developers, mathematicians, marketing, sales, and users.

    I spend a lot of time speaking to current and potential customers – this is the most important part of my job.

    At the beginning of each development cycle, I work with the developers to put together a list of proposed features. Then, during the year, I try to keep development on track to meet the proposed goals and provide continual feedback.

    I also develop applications that demonstrate Maple’s functionality in new and different ways (most are on the Application Center).

    2. What did you study in school?

    I studied Chemical Engineering.

    3. What area(s) of Maple are you currently focusing on in your development?

    While I don’t do any direct development of Maple features, I sometimes prototype code as a proof of concept. The developers then look at me with a sense of disdain, tear my prototype apart, and rewrite my code from the ground up.

    4. What’s the coolest feature of Maple that you’ve had a hand in developing?

    While I generally don’t develop any production code, I’ve been responsible for driving the ThermophysicalData package forward

    5. What do you like most about working at Maplesoft? How long have you worked here?

    I’ve worked at Maplesoft since 2008. It’s a cliché, but I like the people first and foremost.

    I also like the flexibility of my role. Within reason, I can devote part of my time doing things that I think will benefit the company. For example, I get to write lots of applications about subjects that interest me (usually thermodynamics or chemistry).

    6. Favourite hobby?

    I gave up all my hobbies when kids appeared on the scene. Before that, I wrote spreadsheets for financial modeling

    Now, I like to do home science experiments with my son. Yesterday, I mixed yeast with hydrogen peroxide to demonstrate an exothermic reaction.

    7. What do you like on your pizza?

    Pineapple and mushrooms.

    8. What’s your favourite movie?

    I don’t really have a single favourite movie, but these movies that have the greatest impact on me over the last few years

    • Interstellar
    • Annihilation
    • Dunkirk
    • The Witch
    • Frozen (yes, really)

    9. What skill would you love to learn? (That you haven’t already) Why?

    I want to learn how to juggle to amuse my kids. However, I don’t have the hand-eye coordination to be any good

    10. Who’s your favourite mathematician?

    That’s a really dreary question.

    Instead, I’ll answer two completely different questions.

    • My favorite kids TV show is Ben and Holly’s Little Kingdom
    • I usually listen to Slayer on the drive into work

     

    Thanks Samir!

    It post can be called a continuation of the theme “Determination of the angles of the manipulator with the help of its mathematical model. Inverse  problem”.
    Consider  the use of manipulators as multi-axis CNC machines.
    Three-link manipulator with 5 degrees of freedom. In these examples  one of the restrictions on the movement of the manipulator links is that the position of the last link coincides with the normal to the surface along the entire trajectory of the working point movement.
    That is, we, as it were, mathematically transform a system with many degrees of freedom to an analog of a lever mechanism with one degree of freedom, so that we can do the necessary work in a convenient to us way.
    It seems that this approach is fully applicable directly to multi-axis CNC machines.

    (In the texts of the programs, the normalization is carried out with respect to the coordinates of the last point, in order that the lengths of the integration interval coincide with the path length.)
    MAN_3_5_for_MP.mw

    MAN_3_5_for_MP_TR.mw

    First 44 45 46 47 48 49 50 Last Page 46 of 304