Applications, Examples and Libraries

Share your work here

I would like to pay attention to an article " Sums and Integrals: The Swiss analysis knife " by Bill Casselman, where the Euler-Maclaurin formula is discussed.  It should be noted all that matter is implemented in Maple through the commands bernoulli and eulermac. For example,

bernoulli(666);


eulermac(1/x, x);

,

eulermac(sin(x), x, 6);

BTW, as far as I know it, this boring stuff is substantially used in modern physics. The one is considered in

Ronald Graham, Donald E. Knuth, and Oren Patashnik, Concrete mathematics, Addison-Wesley, 1989.

The last chapter is concerned with the Euler-MacLaurin formula.


           

You are teaching linear algebra, or perhaps a differential equations course that contains a unit on first-order linear systems. You need to get across the notion of the eigenpair of a matrix, that is, eigenvalues and eigenvectors, what they mean, how are they found, for what are they useful.

Of course, Maple's Context Menu can, with a click or two of the mouse, return both eigenvalues and eigenvectors. But that does not satisfy the needs of the student: an answer has been given but nothing has been learned. So, of what use is Maple in this pedagogical task? How can Maple enhance the lessons devoted to finding and using eigenpairs of a matrix?

In this webinar I am going to demonstrate how Maple can be used to get across the concept of the eigenpair, to show its meaning, to relate this concept to the by-hand algorithms taught in textbooks.

Ah, but it's not enough just to do the calculations - they also have to be easy to implement so that the implementation does not cloud the pedagogic goal. So, an essential element of this webinar will be its Clickable format, free of the encumbrance of commands and their related syntax. I'll use a syntax-free paradigm to keep the technology as simple as possible while achieving the didactic goal.

Notes added on July 7, 2015:

A small piece of code for fun before the weekend, inspired by some recent posts:

http://www.johndcook.com/blog/2015/06/03/mystery-curve/

http://mathlesstraveled.com/2015/06/04/random-cyclic-curves-5/

http://www.walkingrandomly.com/?p=5677

 

cycler := proc(t, k, p, m, n, T) local expr, u, v;
  u := exp(k*I*t);
  expr := exp(I*t) * (1 - u/m + I*(u^(-p))/n);
  v := 1 + abs(1/n) + abs(1/m);
  plots:-complexplot( expr, t = 0 .. T, axes = none,
                      view = [-v .. v, -v .. v] );
end proc:

cycler(t, 5, 3, 2, 3, 2*Pi);

And that can be made into a small application (needs Maple 18 or 2015),

Explore( cycler(t, k, p, m, n, T),
         parameters = [ k = -10 .. 10, p = -10 .. 10,
                        m = -10.0 .. 10.0, n = -10.0 .. 10.0,
                        [ T = 0 .. 2*Pi, animate ] ],
         initialvalues = [ k = 5, p = 3, m = 2, n = 3, T = 2*Pi ],
         placement = left, animate = false, numframes = 100 );

cyclerapp.mw

The animation of parameter T from 0 to 2*Pi can also be fun if the view option is removed/disabled in the call to complexplot. (That could even be made a choice, by adding an additional argument for calling procedure cycler and an accompanying checkbox parameter on the exploration.)

acer

This post is related to the this thread

The recursive procedure  PosIntSolve  finds the number of non-negative or positive solutions of any linear Diophantine equation

a1*x1+a2*x2+ ... +aN*xN = n  with positive coefficients a1, a2, ... aN .  

Formal parameters: L is the list of coefficients of the left part, n  is the right part,  s (optional) is nonneg (by default) for nonnegint solutions and  pos  for positive solutions.

The basic ideas:

1) If you make shifts of the all unknowns by the formulas  x1'=x1-1,  x2'=x2-1, ... , xN'=xN-1  then  the number of positive solutions of the first equation equals the number of non-negative solutions of the second equation.

2) The recurrence formula (penultimate line of the procedure) can easily be proved by induction.

 

The code of the procedure:

restart;

PosIntSolve:=proc(L::list(posint), n::nonnegint, s::symbol:=nonneg)

local N, n0;

option remember;

if s=pos then n0:=n-`+`(op(L)) else n0:=n fi;

N:=nops(L);

if N=1 then if irem(n0,L[1])=0 then return 1 else return 0 fi; fi;

add(PosIntSolve(subsop(1=NULL,L),n0-k*L[1]), k=0..floor(n0/L[1]));

end proc:

 

Examples of use.

 

Finding of the all positive solutions of equation 30*a+75*b+110*c+85*d+255*e+160*f+15*g+12*h+120*i=8000:

st:=time():

PosIntSolve([30,75,110,85,255,160,15,12,120], 8000, pos);

time()-st;

                                       13971409380

                                             2.125

 

To test the procedure, solve (separately for non-negative and positive solutions) the simple equation  2*x1+7*x2+3*x3=2000  in two ways (by the  procedure and brute force method):

ts:=time():

PosIntSolve([2,7,3], 2000);

PosIntSolve([2,7,3], 2000, pos);

time()-ts;

                47905

                47334

                 0.281

 

ts:=time():

k:=0:

for x from 0 to 2000/2 do

for y from 0 to floor((2000-2*x)/7) do

for z from 0 to floor((2000-2*x-7*y)/3) do

if 2*x+7*y+3*z=2000 then k:=k+1 fi;

od: od: od:

k; 

k:=0:

for x from 1 to 2000/2 do

for y from 1 to floor((2000-2*x)/7) do

for z from 1 to floor((2000-2*x-7*y)/3) do

if 2*x+7*y+3*z=2000 then k:=k+1 fi;

od: od: od:

k;

time()-ts; 

                   47905

                   47334

                   50.063

 

Another example - the solution of the famous problem: how many ways can be exchanged $ 1 using the coins of smaller denomination.

PosIntSolve([1,5,10,25,50],100);

                        292

 

 Number-of-solutions.mw

 

 Edit.  The code has been slightly edited 

The question of colorbars for plots comes up now and then.

One particular theme involves creating an associated 2D plot as the colorbar, using the data within the given 3D plot. But the issue arises of how to easily display the pair together. I'll mention that Maple 2015.1 (the point-release update) provides quite a simple way to accomplish the display of a 3D plot and an associated 2D colorbar side-by-side.

I'm just going to use the example of the latest Question on this topic. There are two parts to here. The first part involves creating a suitable colorbar as a 2D plot, based on the data in the given 3D plot. The second part involves displaying both together.

Here's the 3D plot used for motivating example, for which in this initial experiment I'll apply shading by using the z-value for hue shading. There are a few ways to do that, and a more complete treatment of the first part below would be to detect the shading scheme and compute the colorbar appropriately.

Some of the code below requires update release Maple 2015.1 in order to work. The colors look much better in the actual Maple Standard GUI than they do in this mapleprimes post (rendered by MapleNet).

f := 1.7+1.3*r^2-7.9*r^4+16*r^6:

P := plot3d([r, theta, f],
            r=0..1, theta=0..2*Pi, coords=cylindrical,
            color=[f,1,1,colortype=HSV]):

P;

 

Now for the first part. I'll construct two variants, one for a vertical colorbar and one for a horizontal colorbar.

I'll use the minimal and maximal z-values in the data of 3D plot P. This is one of several aspects that needs to be handled according to what's actually inside the 3D plot's data structure.

zmin,zmax := [min,max](op([1,1],P)[..,..,3])[]:

verthuebar := plots:-densityplot(z, dummy=0..1, z=zmin..zmax, grid=[2,49],
                                 size=[90,260], colorstyle=HUE,
                                 style=surface, axes=frame, labels=[``,``],
                                 axis[1]=[tickmarks=[]]):

horizhuebar := plots:-densityplot(z, z=zmin..zmax, dummy=0..1, grid=[49,2],
                                  size=[300,90], colorstyle=HUE,
                                  style=surface, axes=frame, labels=[``,``],
                                  axis[2]=[tickmarks=[]]):

Now we can approach the second part, to display the 3D plot and its colorbar together.

An idea which is quite old is to use a GUI Table for this. Before Maple 2015 that could be done by calling plots:-display on an Array containing the plots. But that involves manual interation to fix it up to look nice: the Table occupies the full width of the worksheet's window and must be resized with the mouse cursor, the relative widths of the columns are not right and must be manually adjusted, the Table borders are all visible and (if unwanted) must be hidden using context-menu changes on the Table, etc. And also the rendering of 2D plots in the display of the generated _PLOTARRAY doesn't respect the size option if applied when creating 2D plots.

I initially thought that I'd have to use several of the commands for programmatic content generation (new in Maple 2015) to build the GUI Table. But in the point-release Maple 2015.1 the size option on 2D plots is respected when using the DocumentTools:-Tabulate command (also new to Maple 2015). So the insertion and display is now possible with that single command.

DocumentTools:-Tabulate([P,verthuebar],
                        exterior=none, interior=none,
                        weights=[100,25], widthmode=pixels, width=420);

 

 

 

DocumentTools:-Tabulate([[P],[horizhuebar]],
                        exterior=none, interior=none);

 

 

 

We may also with to restrict the view, vertically, and have the colorbar match the shades that are displayed.

DocumentTools:-Tabulate([plots:-display(P,view=2..5),
                         plots:-display(verthuebar,view=2..5)],
                        exterior=none, interior=none,
                        weights=[100,25], widthmode=pixels, width=420);

 

 

 

DocumentTools:-Tabulate([[plots:-display(P,view=2..5)],
                         [plots:-display(horizhuebar,view=[2..5,default])]],
                        exterior=none, interior=none);

 

 

 

I'd like to wrap both parts into either one or two procedures, and hopefully I'd find time to do that and post here as a followup comment.

Apart from considerations such as handling various kinds of 3D plot data (GRID vs MESH, etc, in the data structure) there are also the matters of detecting a view (VIEW) if specified when creating the 3D plot, handling custom shading schemes, and so on. And then there's the matter of what to do when multiple 3D surfaces (plots) have been merged together.

It's also possible that the construction of the 2D plot colorbar is the only part which requires decent programming as a procedure with special options. The Tabulate command already offers options to specify the placement, column weighting, Table borders, etc. Perhaps it's not necessary to roll both parts into a single command.

3dhuecolorbarA.mw

acer

This post is related to the question. There were  proposed two ways of finding the volume of the cutted part of a sphere in the form of a wedge.  Here the procedure is presented that shows the rest of the sphere. Parameters procedure: R - radius of the sphere, H1 - the distance the first cutting plane to the plane  xOy,  H2 -  the distance the second cutting plane to the plane  zOy. Necessary conditions:  R>0,  H1>=0,  H2>=0,  H1^2+H2^2<R^2 . For clarity, different surfaces are painted in different colors.

restart;

Pic := proc (R::positive, H1::nonnegative, H2::nonnegative)

local A, B, C, E, F;

if R^2 <= H1^2+H2^2 then error "Should be H1^(2)+H2^(2)<R^(2)" end if;

A := plot3d([R*sin(theta)*cos(phi), R*sin(theta)*sin(phi), R*cos(theta)], phi = arctan(sqrt(-H1^2-H2^2+R^2), H2) .. 2*Pi-arctan(sqrt(-H1^2-H2^2+R^2), H2), theta = 0 .. Pi, color = green);

B := plot3d([R*sin(theta)*cos(phi), R*sin(theta)*sin(phi), R*cos(theta)], phi = -arctan(sqrt(-H1^2-H2^2+R^2), H2) .. arctan(sqrt(-H1^2-H2^2+R^2), H2), theta = 0 .. arccos(sqrt(R^2-H2^2-H2^2*tan(phi)^2)/R), color = green);

C := plot3d([R*sin(theta)*cos(phi), R*sin(theta)*sin(phi), R*cos(theta)], phi = -arctan(sqrt(-H1^2-H2^2+R^2), H2) .. arctan(sqrt(-H1^2-H2^2+R^2), H2), theta = arccos(H1/R) .. Pi, color = green);

E := plot3d([r*cos(phi), r*sin(phi), H1], phi = -arccos(H2/sqrt(R^2-H1^2)) .. arccos(H2/sqrt(R^2-H1^2)), r = H2/cos(phi) .. sqrt(R^2-H1^2), color = blue);

F := plot3d([H2, r*cos(phi), r*sin(phi)], phi = arccos(sqrt(-H1^2-H2^2+R^2)/sqrt(R^2-H2^2)) .. Pi-arccos(sqrt(-H1^2-H2^2+R^2)/sqrt(R^2-H2^2)), r = H1/sin(phi) .. sqrt(R^2-H2^2), color = gold);

plots[display](A, B, C, E, F, axes = none, view = [-1.5 .. 1.5, -1.5 .. 1.5, -1.5 .. 1.5], scaling = constrained, lightmodel = light4, orientation = [60, 80]);

end proc:

 

Example of use:

Pic(1,  0.5,  0.3);

                             

 

 

In case anyone is interested, we recently posted a new application on the Application Center,

Time Series Analysis: Forecasting Average Global Temperatures

While interesting in itself (well, I think so, anyway), this application also provides tips and techniques for analyzing time series data in Maple, and shows how to access online data sets through the new data sets functionality in Maple 2015.

eithne

The trailers for the new Star Wars movie (Star Wars: The Force Awakens) introduced a new Droid called BB-8. This curious little guy features a spherical body and a controlled instrumented head. More recently, the BB-8 droid was showcased in a Star Wars celebration event and to many peoples' surprise it is real and not a CGI effect!

We have a Sphero robot from Orbotix here at the office, and there was an immediate connection between BB-8 and the Sphero. All that remains is to add the head!

Many have already put together their version of the BB-8, but I wanted to have a physical model that I can play with in a virtual environment and explore some design options.


 

Preparation:

To build a model of BB-8 like robotic system in MapleSim (Maplesoft's physical modeling software environment), I first needed a couple things in place before going forward:

  1. A few simple CAD shapes (half-sphere, wheels)

  2. A component to represent the contact between two spheres (both outside contact and inside contact)

I used Maple’s plottools package to build the CAD files I needed. First a half-spherical shape:

Then a wheel:

 

The next step was to create the contact component in MapleSim. I used a Modelica custom component to bring together vector calculations of normal and tangential forces with a variety of options for convenience into one component:

 

 

Build the model:

We start with a spherical shape contacting the ground:

 

Then we add two wheels inside it, and a hanging mass to keep the reference axis vertical when the wheels turn:

 

Learning from published diagrams showing the internal mechanism of a Sphero, another set of free wheels improves the overall stability when motion commands are given to the two active wheels:

 

Now this model can be used to move around the surface by giving speed commands to the individual motors that drive to the two bottom wheels. What is needed next is the head and the mechanism to move it around.

Since the head can move almost freely, independent of body rotation, it has to be controlled via magnetic contacts and a controlled arm.

First, we add the control arm:

 

Now we need to build the head.

The head has an identical triangle to the one at the end of the control arm. At each vertex there is a ball bearing that would slide on the surface of the main spherical body without friction. The magnetic force between the corresponding vertices of the two triangles is modeled via the available point-to-point force element in MapleSim.

 

 

Once assembled, the MapleSim model diagram looks like this:

 

...and our BB-8 droid looks like this:

 

 

Seeing the BB-8 in action:

Now that we have constructed our droid in MapleSim, we can animate and see it in action!

 

 

     Maple is seriously used in my article Approximation of subharmonic functions in the half-plane by the logarithm of the modulus of an analytic function. Math. Notes 78, No 4, 447-455 in two places. The purpose of this post is to present these applications.                                                                                                 First, I needed to prove the elementary inequality (related to the properties of the minimal harmonic majorant of the function 1/Im z in a certain strip)                                                                                                    2R+sqrt(R)-R(R+sqrt(R))y - 1/y   1/4                                                                                                  for    y ≥ 1/(R+sqrt(R)) and  y ≤ 1/R, the parameter R is greater than or equal to 1.   The artless attemt                                                                          
restart; `assuming`([maximize(2*R+sqrt(R)-R*(R+sqrt(R))*y-1/y, y = 1/(R+sqrt(R)) .. 1/R)], [R >= 1])

maximize(2*R+R^(1/2)-R*(R+R^(1/2))*y-1/y, y = 1/(R+R^(1/2)) .. 1/R)

(1)

fails. The second (and successful) try consists in the use of optimizers:

F := proc (R) options operator, arrow; evalf(maximize(2*R+sqrt(R)-R*(R+sqrt(R))*y-1/y, y = 1/(R+sqrt(R)) .. 1/R)) end proc:

F(1)

.171572876

(2)

 

Optimization:-Minimize('F(R)', {R >= 1})

[.171572875253809986, [R = HFloat(1.0)]]

(3)

To be sure ,
DirectSearch:-Search(proc (R) options operator, arrow; F(R) end proc, {R >= 1})
;

[.171572875745665, Vector(1, {(1) = 1.0000000195752754}, datatype = float[8]), 11]

(4)

Because 0.17
"158 < 0.25, the inequality is  proved.   "
Now we establish this  by the use of the derivative. 

solve(diff(2*R+sqrt(R)-R*(R+sqrt(R))*y-1/y, y) = 0, y, explicit)

1/(R^(3/2)+R^2)^(1/2), -1/(R^(3/2)+R^2)^(1/2)

(5)

maximize(1/sqrt(R^(3/2)+R^2)-1/(R+sqrt(R)), R = 1 .. infinity, location)

(1/2)*2^(1/2)-1/2, {[{R = 1}, (1/2)*2^(1/2)-1/2]}

(6)

minimize(eval(2*R+sqrt(R)-R*(R+sqrt(R))*y-1/y, y = 1/sqrt(R^(3/2)+R^2)), R = 1 .. infinity, location)

3-2*2^(1/2), {[{R = 1}, 3-2*2^(1/2)]}

(7)

evalf(3-2*sqrt(2))

.171572876

(8)

The second use of Maple was the calculation of the asymptotics of the following integral (This is the double integral of the Laplacian of 1/Im z over the domain {z: |z-iR/2| < R/2} \ {z: |z| ≤ 1}.). That place is the key point of the proof. Its direct calculation in the polar coordinates fails.

`assuming`([(int(int(2/(r^2*sin(phi)^3), r = 1 .. R*sin(phi)), phi = arcsin(1/R) .. Pi-arcsin(1/R)))/(2*Pi)], [R >= 1])

(1/2)*(int(int(2/(r^2*sin(phi)^3), r = 1 .. R*sin(phi)), phi = arcsin(1/R) .. Pi-arcsin(1/R)))/Pi

(9)

In order to overcome the difficulty, we find the inner integral

`assuming`([(int(2/(r^2*sin(phi)^3), r = 1 .. R*sin(phi)))/(2*Pi)], [R*sin(phi) >= 1])

(R*sin(phi)-1)/(sin(phi)^4*R*Pi)

(10)

and then we find the outer integral. Because
`assuming`([int((R*sin(phi)-1)/(sin(phi)^4*R*Pi), phi = arcsin(1/R) .. Pi-arcsin(1/R))], [R >= 1])

int((R*sin(phi)-1)/(sin(phi)^4*R*Pi), phi = arcsin(1/R) .. Pi-arcsin(1/R))

(11)

is not successful, we find the indefinite integral  

J := int((R*sin(phi)-1)/(sin(phi)^4*R*Pi), phi)

-(1/2)*cos(phi)/(Pi*sin(phi)^2)+(1/2)*ln(csc(phi)-cot(phi))/Pi+(1/3)*cos(phi)/(R*Pi*sin(phi)^3)+(2/3)*cos(phi)/(R*Pi*sin(phi))

(12)

We verify that  the domain of the antiderivative includes the range of the integration.
plot(-cos(phi)/sin(phi)^2+ln(csc(phi)-cot(phi)), phi = 0 .. Pi)

 

plot((2/3)*cos(phi)/sin(phi)^3+(4/3)*cos(phi)/sin(phi), phi = 0 .. Pi)

 

    That's all right. By the Newton-Leibnitz formula,

``
eval(J, phi = Pi-arcsin(1/R))-(eval(J, phi = arcsin(1/R)));

(1/3)*(1-1/R^2)^(1/2)*R^2/Pi+(1/2)*ln((1-1/R^2)^(1/2)*R+R)/Pi-(4/3)*(1-1/R^2)^(1/2)/Pi-(1/2)*ln(R-(1-1/R^2)^(1/2)*R)/Pi

(13)

Finally, the*asymptotics*is found by

asympt(eval(J, phi = Pi-arcsin(1/R))-(eval(J, phi = arcsin(1/R))), R, 3)

(1/3)*R^2/Pi-(3/2)/Pi+(1/2)*(ln(2)+ln(R))/Pi-(1/2)*(-ln(2)-ln(R))/Pi+O(1/R^2)

(14)

      It should be noted that a somewhat different expression is written in the article. My inaccuracy, as far as I remember it, consisted in the integration over the whole disk {z: |z-iR/2| < R/2} instead of {z: |z-iR/2| < R/2} \ {z: |z| ≤ 1}. Because only the form of the asymptotics const*R^2 + remainder is used in the article, the exact value of this non-zero constant is of no importance.

       It would be nice if somebody else presents similar examples here or elsewhere.

 

Download Discovery_with_Maple.mw

I'd like to pay attention to an application "Interaural Time Delay" by Samir Khan. His applications are interesting, based on  real data, and  mathematically accurate. Here is its introduction:

"Humans locate the origin of a sound with several cues. One technique employs the small difference in the time taken for the sound to reach either ear; this is known as the interaural time delay (ITD). This application modifies a single-channel audio file so that the sound appears to originate at an angle from the observer. It does this by introducing an extra channel of sound. Despite both channels having the same amplitude, the sound appears to come from an angle simply by delaying one channel".

As you saw in the Maple 2015 What’s New, the MapleCloud is now online at maplecloud.maplesoft.com.  In addition to accessing MapleCloud content from within Maple, you can now use a web browser to view and interact with MapleCloud documents. The new online MapleCloud is based on HTML5 and works across a broad range of browsers. No plugins. No Java.

The MapleCloud was first introduced about five years ago, in Maple 14, and has allowed Maple users around the globe to share worksheets and Math Apps with fellow users. The Maple Cloud allows you to create groups in order to share content with specific people, as well as sharing them publicly.  Today we count over 1400 such groups that have been created for a class, a project or a workgroup, hosting tens of thousands of Maple worksheets, with thousands of worksheets being up- and down-loaded every month. Feedback has been tremendous, and clearly, this feature has hit a nerve with our user community and has attracted a strong following.

A common use case is to set up a MapleCloud group for a class in order to exchange Maple material among students and instructors. Some teachers are using this as the primary mechanism for submitting and marking assignments. Just as common is to use the MapleCloud as a convenient way to exchange and review documents while working on a joint project. Many users also use the Cloud to store their own documents in a private online space so that they can access them from multiple computers and locations. Wherever they have access to Maple, they also have access to all their Maple documents.

Then, there are the public groups in the MapleCloud, where users around the world freely share applications and examples; it’s a treasure trove of material covering all sorts of topics from calculus to fractals.

Now online, the MapleCloud continues to be a great repository for Maple content, but in addition, there are also some new aspects. For starters, it is really easy to share a Maple worksheet or Math App with someone else by simply giving them a URL. Click on it and the Maple worksheet opens in your web browser and all interactive components and plots are live - you can change parameters, calculate new results and update plots. For example, you can try out a Password Security tool or explore the Vertex of a Parabola. Maple is not required for consuming content in this way. But if you do have Maple, another click downloads the document to your local copy of Maple, where you can modify and extend it.

The online MapleCloud is a great way to manage your documents and share Maple content with students and colleagues.  This, of course, is only one more step towards making all of our technology available online and you will see more unfold over the course of this year!

The work contains two procedures called  SetPartition  and  NumbPart .

The first procedure  SetPartition  generates all the partitions of a set  S  into disjoint subsets of specific sizes defined by a list  Q. The third optional parameter is the symbol  `ordered`  or  `nonordered`  (by default) . It determines whether the order of subsets in a partition is significant.

The second procedure  NumbPart  returns the number of all partitions of the sizes indicated by  Q .

 

Codes of these procedures:

SetPartition:=proc(S::set, Q::list(posint), K::symbol:=nonordered)  # Procedure finds all partitions of the set  S  into subsets of the specific size given Q.

local L, P, T, S1, S2, n, i, j, m, k, M;

uses ListTools,combinat;

if `+`(op(Q))<>nops(S) then error "Should be `+`(op(Q))=nops(S)" fi;

L:=convert(Q,set);

T:=[seq([L[i],Occurrences(L[i],Q)], i=1..nops(L))];

P:=`if`(K=ordered,convert(T,list),convert(T,set));

S1:=S;  S2:={`if`(K=ordered,[],{})}; n:=nops(P);

for i to n do

m:=P[i,1]; k:=P[i,2];

for j to k do

S2:={seq(seq(`if`(K=ordered,[op(s),t],{op(s),t}), t=choose(S1 minus `union`(op(s)),m)), s=S2)};

od; od;

if K=ordered then {map(op@permute,S2)[]} else S2 fi;

end proc:

 

NumbPart:=proc(Q::list(posint), K::symbol:=nonordered)  # Procedure finds the number of all partitions of a set into subsets of the specific size given  Q

local L, T, P, n, S, N;

uses ListTools;

L:=convert(Q,set);

T:=[seq([L[i],Occurrences(L[i],Q)], i=1..nops(L))];

P:=`if`(K=ordered,convert(T,list),convert(T,set));

n:=nops(P);  N:=add(P[i,2], i=1..n);

S:=add(P[i,1]*P[i,2],i=1..n)!/mul(P[i,1]!^P[i,2],i=1..n)/mul(P[i,2]!,i=1..n);

if K=nonordered then return S else  S*N! fi;

end proc:

 

Examples of use:

SetPartition({a,b,c,d,e}, [1,1,3]);  nops(%);  # Nonordered partitions and their number

SetPartition({a,b,c,d,e}, [1,1,3], ordered);  nops(%);  # Ordered partitions and their number

 

 

Here's a more interesting example. 5 fruits  {apple, pear, orange, mango, peach}  must be put on three plates so that  on each of two plates there are 2  fruits, and there is one fruit  on one plate. Two variants to solve: 1) plates are indistinguishable and 2) different plates. In how many ways can this be done?

SetPartition({apple,pear,orange,mango,peach}, [1,2,2]);  nops(%);  # plates are indistinguishable

 

NumbPart([1,2,2], ordered);  # Number of ways for  different plates

                                                              90

 

Another example - how many ways can be divided  100 objects into 10 equal parts?

NumbPart([10$10]);

    64954656894649578274066349293466217242333450230560675312538868633528911487364888307200

 

 SetPartition.mws

Maple T.A. 10 introduced two new question types: Sketch and Free Body Diagram. To assist users in learning the new question types, Maplesoft has created a few hundred samples to look at. These sample questions are already featured on the Maple T.A. Cloud, but you can also download the course modules below. 

Sketching Questions - This course module contains 309 sketch questions. Areas covered include: functions, exponential functions, inequalities, linear equations, logarithmic functions, piecewise functions, quadratic equations, systems of equations and transformations of functions.

Free Body Diagram Questions - This course module contains 118 free body diagram questions. Areas covered include: Electricity, Magnetism and Mechanics.

Jonny Zivku
Maplesoft Product Manager, Maple T.A.

Hi everyone,

at the suggestion of Carl I am making my question a post.

History:

Newbies often get fascinated with the power tower: x^x^x^...

The generalized power tower z^z^z^... is a special case of the Euler sequence:

z_{n+1}=c^z_n, for c\in C.

Like the Mandelbrot set: z_{n+1}=z^2-c, the power tower, often called infinite exponential, also has a general periodic map. It is included below and is taken from Daniel Geisler's site:
www.tetration.org

Shel and Thron proved that the infinite exponential conveges whenever c belongs to the red region, called today Shell-Thron region.

Definition of Julia Sets for the iterated exponential map:

Also like the Mandelbrot set, the infinite exponential admits Juila Sets. The Julia Sets of the infinite exponential however, are defined differently from the Julia Sets of the Mandelbrot set. They are defined to be  the closure of the periodic repellers of the Euler sequence . They are Cantor Bouquets.  Geisler's colored map then is a general map of how the corresponding Julia set behaves roughly, with c taken from the map. 

We can then introduce small cuts which go from the interior of the Shell-Thron region to the exterior, crossing at various angles, and this will tells us how the infinite exponential evolves. Generally speaking, each time one crosses the Shell-Thron boundary, one wittnesses what's called a Knaster explosion, wherein the exponential explodes into p subregions, where p is the pre-period of the multiplier.


When the parameter c exits the Shell-Thron region at angles of 2*Pi and Pi from the real axis (cuts right and left, p=1, 2), the infinite exponential either transitions from converging to a single feature to exploding into multiple indecomposable contiua (p=1), or it breaks into a period 2 bifurcation (p=2), which itself, also may explode into continua.

When it exits at angles 2*Pi/p, where p>2 is the preperiod of the multiplier, then the infinite exponential evolves from converging to a single feature, to exploding into  p major regions, called Fatou regions, each one having its own attractor, displaying a p-furcation.


In all cases,  the Knaster explosions may introduce the presence of indecomposable continua, as some Fatou regions end up covering entire parts of the complex plane after each transition. In the animations, Knaster explosions occur whenever the background is red. There may be more than one explosion present in the evolution of the power tower. 

Cantor Bouquets are strange creatures. They are essentially quantum sets, and no point of them is actually visible. The probability a point is visible varies directly with the area of the corresponding bouquet "finger" which is rendered in the area of interest. Devaney uses these "fingers"  to obtain "iteneraries" of the iterated exponential map.

Points "close"  to the fingers-hairs o the Cantor Bouquets escape towards complex infinity at (final) angles 2*Pi/p.

The "hairs" of a Cantor Bouquet are C^\infty curves, hence they can be termed easthetically pretty. Only hairs from the main Cantor bouquet for c=e^{1/e} are globally convex/concave. Every other bouquet may contain hairs which change curvature "unpredictably".

Inlcuded files:

1) Euler.mw

2) EulerAnimation.mw

3) EulerAnimation2_noaxes.mw

 

Code for static fractal with given parameters in 1). Parameters can be changed in the constant section (Try p=2,4 or Pi)

Code for morphing animations through cuts in the Shell-Thron region in 2). Parameters d1-d2, N

Code for zooming animations in 3). Parameters M, M1-M2,

Limitations:

Will show attractors of broken Fatou basins only up to pre-period p=5. No big deal though. If you want to increase the preperiod past p=5, you need to add the relavnt tests in procedure ppc(c), otherwise the new attractors are not calculated and the plot ends up red.

Colors are assigned a bit more dispersed, using ln(m). You can also use m in that place. It depends on which area you are in.

Basins of attraction and Fatou regions change appearance under different epsilons. If you want different shapes for the basins, you can try using the Manhattan metric in proc Jhf, instead of |z-lim|.

Included below are the main map of tetration by Daniel Geisler, a short excerpt of the Shell-Thron region which shows pre-periodic cuts and  6 morhing transitions, for p\in {1,2,3,4,5} and one which exits at the angle of 2 radians (p=Pi).

References:

More than 300. To be published with my thesis. Patches, problems and code corrections in the original question page:

http://www.mapleprimes.com/questions/203593-Maple-13-Fast-Maple-18-Crawling

First 39 40 41 42 43 44 45 Last Page 41 of 71