alec's blog

alec's picture

Sage Facebook Group

Sage has a group on Facebook now. I've just became a fan.

Alec

alec's picture

Wolfram Alpha

Wolfram Alpha is launching in May - that looks interesting.

Alec

alec's picture

Producing music in Maple

Following the midi crash course written by Daniel White, and using a table of midi note numbers, it is rather easy to write a Maple procedure producing midi files. Here is an example that I posted in Simple Sounds thread, slightly modified by adding an instrument as a 3rd parameter:

alec's picture

Maple 12.02 is now available

Maple 12.02 is now available. The Maple 12.02 update includes enhancements in a variety of areas, including:

alec's picture

Reduce became free

Reduce became free and is available for download.

Alec

alec's picture

Lexical Table

In the recent discussion about patching, a question about patching a function f including local variables of a module or another function was discussed. For example, let it be defined as

A:=proc() global f,t; local x,y,z;
f:=()->x+y();
y:=()->z;
t:=()->x+z;
x,z:=0,1;
NULL end:
A();

Now,

op(f);
                            () -> x + y()
f();
                                  1

How to change it so that it would return 2 instead of 1, without reassigning it?

alec's picture

Maple Wiki

Everybody is invited to Maple Wiki .

It is hosted on Maple Advisor, a Maple community site independent of Maplesoft and/or Mapleprimes.

The site has started just a couple of days ago and doesn't have much of a content yet.

alec's picture

Bernoulli Distribution with Serial Correlation

A random sample of length n drawn from Bernoulli distribution with probability of success prob, that has a correlation c with itself shifted back lag steps, can be generated using following procedure,

SampleWithCorr:=proc(prob::And(numeric,satisfies(c->c>=0 and c<=1)),
lag::posint,c::And(numeric,satisfies(c->c<=1 and c>=-1)),n::posint)
local X,B,S,C,s,i;
uses Statistics;
X:=RandomVariable(Bernoulli(prob));
S:=Sample(X,n);
if n<=lag or s=0 then S else
s:=signum(c);
B:=RandomVariable(Bernoulli(abs(c)));
C:=Sample(B,n-lag);
if s=1 then 
for i from lag+1 to n do
if C[i-lag]=1 then S[i]:=S[i-lag] fi od;
else for i from lag+1 to n do
if C[i-lag]=1 then S[i]:=1-S[i-lag] fi od
fi fi; S end:
alec's picture

Discontinuous antiderivatives

Maple, Mathematica, and many other CAS define indefinite integral up to piecewise constants. That means, in particular, that the integral of a continuous function can be discontinuous.

In many cases that can be easily fixed, such as for integrals involving floor(x) and frac(x). However, it has not been done neither in Maple nor in Mathematica. Here is another example, suggested by David W. Cantrell

int(1/(2+cos(x)),x);

               2/3*3^(1/2)*arctan(1/3*tan(1/2*x)*3^(1/2))
alec's picture

A125033

Sequence A125033 in the OEIS submitted by Paul D. Hanna and Richard J. Mathar, is defined as

Number of labeled nodes in generation n of a rooted tree where a node with label k has k child nodes with distinct labels, such that each child node is assigned the least unused label in the path that leads back to the root node with label '1'.

Syndicate content
}