Product Tips & Techniques

Tips and Tricks on how to get the most about Maple and MapleSim

Ever wondered how you can create filenames by cycle.

Well, I did, because I needed it. And I came up with something that works and because once i forgot it, I decided this time to put it here. At least, I won't forget again :) If you have a better way to do it, please, say so.

The idea:

>A:=`/home/Data/file_`; B:=`.txt`;

>for i from 1 to 3 do C:=cat(A,i,B); writedata(`C`,[i],integer);od;

solve used to be one of Maple's strongest commands -- it even subsumed simplify in power.  But, over the years, dsolve slowly took over as the most powerful comand.  At the same time, people started realizing that within the framework of differential equations, the toolbox was actually larger than the one for algebraic equations (and most algebraic tools are still available).  So many tasks that one thinks of doing purely algebraically can also be done using differential equations, with perhaps the most surprising one is to factor multivariate polynomials via partial differential equations.

For t := x^(1-I), f := arcsin(t) + arcsin(1/t) i have problems with

  dd:= PDEtools[dpolyform](y(z)=f,no_Fn);

                           d
                    dd := [-- y(x) = 0] &where []
                           dx

I want to put in the plus or minus symbol (+/- in ASCII) into a text region (standard math), as in the quadratic formula.  I am using the classic interface in version 9.5.  Can this be done?

Alla

We are going to show a roundabout but rather effective method of solving some rather complicated (definite) integrals in closed-form via a rather unusual method: a special factorization of linear ODEs.  The example we will use is a 2 week old question that has yet to get an answer.

First, the problem: compute the integral

So, after many years in the making, version 1.0 of wine is released.

Can anyone say, whether it'll run Maple 12?

acer

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?

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.

This is one sort of Maple inconsistency that interests me. Why should the first example behave like evalf(Int(...)) and call `evalf/int` while the second example does not?

I was looking at the timelimit command in Maple, and wonder about whether it might be improved .

The help-page ?timelimit says that it suspends its checks while within builtin functions. It says that, inside builtins, the time limit is "ignored".

But Maple has a lot of builtins. And significant portions of the work may go on within them. Does this make the timelimit() function not useful, from a practical point of view?

What if timelimit were to make checks whenever garbage collection (gc) ocurred? That's a safe point, no? And gc can happen within some builtins? Or what if time checks were made at the same frequency that interrupt requests were checked? Those can happen within some builtins, at safe points.

Those were my thoughts, until I tried it. The command anames(builtin) shows that rtable() is a builtin. But I have found that timelimit will function within at least some rtable() calls.

I was reminded of this by another thread.

It is faster to add in-place a large size storage=sparse float[8] Matrix into a new empty storage=rectangular float[8] Matrix than it is to convert it that way using the Matrix() or rtable() constructors.

Here's an example. First I'll do it with in-place Matrix addition. And then after that with a call to Matrix(). I measure the time to execute as well as the increase in bytes-allocated and bytes-used.

> with(LinearAlgebra):

> N := 500:
> A := RandomMatrix(N,'density'=0.1,
>                   'outputoptions'=['storage'='sparse',
>                                    'datatype'=float[8]]):

> st,ba,bu := time(),kernelopts(bytesalloc),kernelopts(bytesused):

> B := Matrix(N,'datatype'=float[8]):
> MatrixAdd(B,A,'inplace'=true):

> time()-st,kernelopts(bytesalloc)-ba,kernelopts(bytesused)-bu;
                            0.022, 2489912, 357907

In a recent post, a Maple user misunderstood what an assignment to f(x) meant. Since this is a common source of confusion, I thought it would be worthwhile to say more about this subject.

What is f(x)?
First, f(x) is a "function application" in Maple. It is f applied to the argument x. It is not really the same as what one thinks of as a function in mathematics. Consider a mathematical function such as sin(x+y). In Maple, this can be represented by an expression sin(x+y) or a procedure proc(x, y) sin(x+y) end proc (which can also be written in "operator form" as (x, y)->sin(x+y)). The expression or the procedure can then be assigned to a name such as g. The mathematical function is then represented by g in Maple, and not by g(x, y). Instead, if g is a procedure, then g(x, y) means "the procedure g called with arguments x and y". The "function" help page explains these concepts in more detail.

What is f(x):=x^2 in 1-d math?
Now let's move on to what f(x) := x^2 means. In 1-d math, this means, "Create a remember table entry for procedure f." This stores the expression x^2 so that when you enter f(x), that expression is automatically retrieved, and you avoid the expense of executing the body of the procedure . Similarly, if you enter f(1) := 5, then the value 5 is automatically returned when you enter f(1). Note that if you subsequently enter f(y), you won't get y^2 returned, unless f was already defined to return y^2 with input y. Remember tables are very useful and are heavily used by some Maple library procedures. However, the majority of Maple users do not need to worry about this feature and can do very useful things in Maple without ever knowing about it.

Maple is missing the 'standard' notation for the cumulative normal distribution and uses the error function instead (for historical reasons I guess).

However that would be quite convenient to read and formulae in a common notation.

A recent post asks how to create a Maple permutation iterator, that is, a procedure that, on successive calls, iterates through each permutation of a given input.  I suggested a routine that solved the problem, however, I wasn't satisfied with it.  It was slower than it should be.  Later I suggested an improvement.  Here is another improvement.  It uses the same algorithm (algorithm L, from The Art of Computer Programming, vol. 4, fasicle 2, by Donald E. Knuth) if the input has repeated elements, but uses a different method, algorithm T, ibid., if the input consists of distinct elements.  The sequences of permutations for the two algorithms differ, the second algorithm uses the initial order for the first element and consecutive outputs differ by one transposition.

Some time ago, I confronted the usefullness of the Table element of Maplets, and found out it was something marely to show data that was known on design time, no posibility to dinamicly inject data on it for example on a result table after a process, but in the past days I met MatrixBuilder, on the Student, LinearAlbegra package, and I wonder first if that is a maplet, and second, if that is a table element, I tried to crack on the source code of it, but no info came out.

Someone knows what is this window? or if someone is able to crack the source can show me the table part?

First 41 42 43 44 45 46 47 Last Page 43 of 64