Applications, Examples and Libraries

Share your work here

This is the second post in a four-part series that started with this post: Generating...

Maple's Statistics package contains many predefined probability distributions; well-known ones such as the normal distribution and lesser-known ones such as the Gumbel distribution. For these distributions, we ship efficient algorithms that can quickly generate a large number of sample points. To generate a sample of size 106 of both of these distributions, and print the time it took to do this (in seconds), you can run the following:

with(Statistics):

This describes in more detail (with permission and citation) the method posted here of solving problem 2 in the XKCD comic Substitute.

 

Download RaptorMath.mw

 

Today is my birthday, and in fact it is also the birthday of at least one other Maplesoft employee (not surprising since more than 23 people work here - considering the generalized birthday problem, I even know of 3 people here who share the same birthday).  Of course, it turns out that birthdays are not evenly distributed through out the year and so I wanted to know if someone with an August birthday is more likely to share than someone with an April birthday. 

Look at this article (Its loading can take a few minutes: approximately 5 MB.). All those pictures could be created with Maple.

PS. Working link to  the article.

Continuing on in this series of posts, here is a way to test the randomness of a sequence of bits from a PRNG that is the appropriate to the first morning back after the August long weekend.  It is a very fast, and not very formal test done by checking how well a sequence compresses. This is really easy in Maple 14, with the new commands ?StringTools:-Compress and StringTools:-Uncompress which use ...

A while back, someone asked me for a good way to plot a Klein Bottle in Maple. I didn't have a good answer at the time, but I recently stumbled upon the following, which does a pretty good job if you don't mind the use of Heaviside in the parameterization.

plot3d(
[4*(1-1/2*cos(u))*sin(v),
6*cos(u)*(1+sin(u))+4*(1-1/2*cos(u))*(cos(u)*(1-Heaviside(u-Pi))+Heaviside(u-Pi))*cos(v+Pi*Heaviside(u-Pi)),

In a previous post, I promised to write about testing the quality of pseudo-random number sequences.  I'll post later about some of the statistical tests often used, but I first wanted to mention a sort of practical test one can do. One of the many things you might want to do with pseudorandomly generated numbers is Monte Carlo integration/simulatation/etc.  As mentioned by acer in this comment, Monte Carlo integration can be shown to work better with some of the pseudorandom number generators (PRNGs) which are considered inferior in a statistical sense.  In this post, we will play with a simple Monte Carlo approximation of π.

There are two pieces of extended functionality that I quite often want from the Maple Compiler. The first (task A) is to be able to link in and use an arbitrary function from some other external ("3rd party") shared library, within my Compile'd Maple procedure. The second (task B) is to directly call the compiled Maple procedure from within some computational routine in a 3rd party shared library (which I would then access using define_external). This post is about the first of those, task A.

A user recently asked how to find the set of indices corresponding to a given value of a two-dimensional Array.

There are several ways to handle this problem.  For  a single value, a simple scan through the Array suffices:

FindIndices1 := proc(A :: Array, val)
local i,j,irng,jrng;
    (irng,jrng) := rtable_dims(A);
    {seq(seq(`if`(A[i,j]=val, [i,j], NULL), i=irng), j=jrng)};
end proc:

With a multi-core machine, the ...

The hardest and/or most important part of answering a question is making sure the real question is understood. The July 1, 2010 question Using fsolve with a dispersion relation posted to MaplePrimes seemed to be about obtaining a numeric solution of an equation. Turns out it was more a question about the behavior of an implicit function.

Create a maplet or worksheet for the game Blokus. 

On that note, we should have a counter or tally in the post to show how many people want to work on or are attempting to work on the challenge.  That way people can see if there is progress happening behind the scenes.

Jacques' post on the maple.vim project spurred this post.  Vim users cannot have all the fun.

About a year ago I wrote an Emacs front-end for the Maple debugger.  I've used it since---it is now my primary debugging tool for Maple code.  What it does is allow stepping through interpreted Maple code in an Emacs buffer.  That is, rather than being presented with a single line of...

This is a follow-up to a rather old posting about maple.vim.  There is now a maplevim project on google code to helpfully get the community to work on upgrading maple.vim a bit more frequently. 

Right now there is a shipping version of maple.vim checked-in, as well as a set of 'pieces' (in the pieces sub-directory...

While reviewing code the other day, I came across the following snippet (here converted to a procedure).

Ds := proc(V::set, n::posint, t)
local i,v;
    {seq(seq((D@@i)(v)(t), i=1..n), v in V)};
end proc:

The purpose of this is to generate a set of derivatives at a point of a set of unassigned names. For example

 Ds({x,y},2,0);
               ...
First 67 68 69 70 71 72 73 Last Page 69 of 77