roman_pearce's blog

roman_pearce's picture

Interrupting External Code in Maple

If you're writing an external library to be called from Maple, then you have the following problem. The user wants to interrupt your code. They are valiantly pressing control-C or the stop button in the Maple GUI, as your code grinds their machine to a halt. What do you do ?

Suppose you want to solve a large dense linear system AX=B over the rationals - what should you do? Well, one thing you should probably not do is directly apply Gaussian elimination. It does O(n^3) arithmetic operations, but the size of the numbers blow up, leading to an exponential bit complexity. Don't believe me? Try it:

roman_pearce's picture

Sparse Polynomial Arithmetic

I am pleased (and terrified) to announce the first public release of a Maple library for high performance sparse polynomial arithmetic. This C library and Maple interface is under development at Simon Fraser University in Vancouver, Canada. We are releasing this interim version so that Maple enthusiasts and researchers can try it. Maple 11 is required.

When working with large sparse linear systems you often want to look at their non-zero structure, however Maple's existing tools are all designed for dense matrices. I wrote a little tool to produce images like this in reasonable time. You can download the code here, and the rest of this post is a quick tutorial on how to use the included command. Maple 11 is required.

What is the largest linear system that Maple can solve? You might be surprised to find out. In this article we present strategies for solving sparse linear systems over the rationals. An example implementation is provided, but first we present a bit of background.

Sparse linear systems arise naturally from problems in mathematics, science, and engineering. Typically many quantities are related, but because of an underlying structure only a small subset of the elements appear in most equations. Consider networks, finite element models, structural analysis problems, and linear programming problems.

roman_pearce's picture

Improvements to Maple 11 Groebner

Maple 11 has been out for a while now so hopefully people have it. I thought I would write a short post detailing some of what was done in the area of Groebner bases. If you run the examples in Maple 10 and Maple 11, I would appreciate it if you could post the times and the specifications of your computer.

roman_pearce's picture

Sparse Transpose

This is a quick programming exercise to correct the following problem in Maple:

for n from 8 to 12 do 
  A := Matrix(2^n, 2^n, storage='sparse'):  # zero matrix
  print( 2^n, time(LinearAlgebra:-Transpose(A)) );
end do:

The problem is that the LinearAlgebra:-Transpose command is not sparse. That is, the time it takes is proportional to the overall size of the matrix and not to the number of non-zero entries - even when your matrix uses sparse storage. In this post we will look at what is required to program a new Transpose command which can handle much larger matrices.

Lately I have been experimenting with structured Gaussian elimination. This is a technique for reducing large sparse systems of linear equations to much smaller dense ones, which can then be solved using a modular method. Needless to say, I had to generate some large sparse linear systems.

I wanted the equations to be written as polynomials, because that is the natural sparse representation in Maple and it makes programming structured Gaussian elimination easier (you can use has and indets, for example). So I tried my favorite randpoly command. This was me trying to generate one linear equation:

I'm just curious - and I don't work for Maplesoft :) - but what do people here actually use Maple for ? What sorts of problems are you tackling, and what commands/packages do you typically use ? I'm also interested to hear about how people use Maple in teaching (for those that do).

Myself I use Maple for research in computer algebra - mostly topics related to polynomial systems. For example, I may be trying to find algorithms to compute in new domains. I like Maple because it is very easy to program mathematical algorithms. It is not quite so easy to get them to run fast, but that gives me something to work on :) I mostly use my own software (PolynomialIdeals + recent code), but I also use the Groebner package and now the RegularChains package (new in Maple 10). I make a point of trying all the other packages every once in a while, since you never know when something is going to be useful. I use the plot commands a lot as well.

I've posted a worksheet and some code for simplification with side relations. What makes this code interesting is that it properly handles rational expressions, using an algorithm is from my M.Sc. thesis. You can download the code from the Maple Application Center here, or from my personal webpage here. The code requires Maple 10.

Syndicate content
}