roman_pearce

Mr. Roman Pearce

1688 Reputation

19 Badges

20 years, 17 days
CECM/SFU
Research Associate
Abbotsford, British Columbia, Canada

I am a research associate at Simon Fraser University and a member of the Computer Algebra Group at the CECM.

MaplePrimes Activity


These are answers submitted by roman_pearce

Maple must be hitting some sort of internal limit, possibly a recursion limit. Can we possibly get an example ? I tried generating some random expressions with the program below:
randbool := proc(vars, n)
  local r;   
   if n=0 then
     vars[rand(1..nops(vars))()];
   else
     r := rand(1..6)();
     if r=1 then
       `&and`(procname(vars,n-1),procname(vars,n-1));
     elif r=2 then
       `&or`(procname(vars,n-1),procname(vars,n-1));
     elif r=3 then
       `&xor`(procname(vars,n-1),procname(vars,n-1)); 
     elif r=4 then
       `&nor`(procname(vars,n-1),procname(vars,n-1));
     elif r=5 then
       `&nand`(procname(vars,n-1),procname(vars,n-1));
     else
       `¬`(procname(vars,n-1));
     end if;
   end if;  
end proc: 

expr := randbool([seq(cat(x,i),i=1..10)], 8);
TIMER := time(): res := Logic:-BooleanSimplify(expr): time()-TIMER;
It looks like this problem can get quite bad quickly.
Try the following flags: -Wl,--kill-at,--enable-stdcall-fixup -mrtd -shared If you do this you should not need any _stdcall declarations for your functions, however things get messy if you need you need to call other functions in other DLLs.
1/7 mod 27;
Here is an example matrix:
A := LinearAlgebra:-RandomMatrix(15,20,density=4./10) mod 2;
p := 2;  # prime
The first thing to do is to pick a hardware datatype and convert A into a matrix of hardware integers or floats. I will use the integer[4] datatype, but on a 64-bit machine you will need to use integer[8] or float[8]. Unfortunately there is no support for binary matrices or sparse matrices, so for large sparse matrices you can waste a lot of space and time.
dtype := integer[4];
A := LinearAlgebra:-Modular:-Mod(p, A, dtype);
The syntax of RowReduce assumes an augmented matrix: RowReduce(prime, matrix, rows, columns, variables, 'determinant', 'pseudo-determinant', 'rank', 'signature', 'inconsistent row count', RREF); variables = the number of columns that are variables, and the arguments in quotes should be names which are assigned the rank, determinant, etc, or 0, if those things are not wanted. In our example we have 15 rows and 20 columns. Let's first reduce the matrix to row echelon form and then to reduced row echelon form.
LinearAlgebra:-Modular:-RowReduce(p, A, 15, 20, 20, 0, 0, 0, 0, 0, false);
A;
LinearAlgebra:-Modular:-RowReduce(p, A, 15, 20, 20, 0, 0, 0, 0, 0, true);
A;
Now if we were solving a system with 5 right hand side (ie: 15 x 15 matrix = 15 x 5 matrix), the syntax would be the following:
LinearAlgebra:-Modular:-RowReduce(p, A, 15, 20, 15, 0, 0, 0, 0, 0, false);
A;
You will get an error if the system is inconsistent (no solution), which is likely in this case.
This was a bug in the inter-reduce code that was fixed for either Maple 10.04 or 10.06 - I forget which one. Maple 11 uses totally different Groebner basis code.
Generally speaking, the Core 2 Duo is the fastest chip around. It has a generous L2 cache, which is important if your code processes a lot of data quickly. For notebooks it is the obvious choice. Maple's performance on the Core 2 Duo is good, but the 64-bit version is required to get the best performance (especially with large integers). Currently this requires Linux, although 64-bit Windows support is planned. In any case, that is probably not what you have in mind for a laptop. Make sure you get at least 2GB of RAM. There have been some complaints that the Core 2 Duo is buggy. See http://hardware.slashdot.org/article.pl?sid=07/06/28/1124256 Many of these problems have been fixed with microcode patches, and I have yet to hear of any "real world" impact. I've used the chip for Maple and C programs and I would recommend it generally. On the server side an Opteron is still faster for some scientific workloads. For notebooks the Core 2 Duo has no real competition. The 2.0-2.4 GHz chips are fast, the 1.2-1.6 GHz are quite a bit slower but extremely power efficient. See: http://www.notebookcheck.net/Mobile-Processors-Benchmarklist.2436.0.html http://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors http://en.wikipedia.org/wiki/List_of_AMD_Turion_microprocessors
When Maple starts working with very large polynomials (which is what I suspect you will have) it goes into external C code, some of which can not be interrupted. This is a problem we would all like to fix, however there is an issue here. The OpenMaple command MapleCheckInterrupt generates an untrappable exception, so if you call it your code can not do any "clean up" before returning to Maple. This makes it hard to interrupt algorithms that dynamically allocate storage.
Also (just for reference) on Mac OS X: /Library/Frameworks/Maple.framework/Versions/Current/bin/maple You can replace "Current" with 10 or 11.
Try running Maple in Windows 2000 compatibility mode, by right clicking its icon and using the options in the compatibility tab.
In general, most high level symbolic commands such as simplify or solve do not want to work with floats, so they convert floating point numbers to exact rationals and then convert the result back to floats. Sometimes these conversions are done in a haphazard way (ie: only when necessary) so you may be better off doing the conversion yourself:
f := .5*x^3 + .33*x + .2;
f := convert(f,rational);
 ...
f := evalf(f);
The problem is, this conversion can be numerically unstable and may produce unreliable results. You can not expect small quantities to be rounded off to zero, etc, so use this at your own risk. When the floating point numbers all have representations as small rational numbers it should be safe however.
Use the cat command to concatenate strings and a loop to go through the files. Don't forget the extra separator "\\" between the path and the file. You can optionally sort the files as well.
path := "D:\\MapleVariables\\Data":
files := FileTools[ListDirectory](path):
files := sort(files, lexorder):
for f in files do 
  read cat(path, "\\", f);
end do:
I tried but I wasn't able to knock this thing down to anything simple. The best I was able to do was the following, which wasn't very good.
t22 := Re((1/2*(a^2+2*sigma2*(c+g*(ee+i*v)))^(1/2)*exp(.5*a*t)/
(1/2*(a^2+2*sigma2*(c+g*(ee+i*v)))^(1/2)*cosh(1/2*(a^2+2*sigma2*(c
+g*(ee+i*v)))^(1/2)*t)+.5*a*sinh(1/2*(a^2+2*sigma2*(c+g*(ee
+i*v)))^(1/2)*t)))^(2*a*xbar/sigma2)):

t22 := subs(i=I, .5=1/2, t22);
T := convert(t22, exp);
T2 := simplify(T, symbolic);
T3 := combine(T2);
T4 := evalc(T3);
This does not look any easier than actually doing the complex arithmetic. Also, the csgn function is tests whether a value x has Re(x) >= 0. It returns either 1 or -1. Without values for the variables, there is no way for Maple to know, for example, whether -a^2*I-2*I*sigma2*c-2*I*sigma2*g*ee+2*sigma2*g*v has positive or negative real part.
It is very likely that you can use hardware arrays and option autocompile to get performance on par with C for computing the points, however Maple's 3d plot will not be able to render it. It is too slow by many orders of magnitude, and this is one of the most glaring limitations of the interface.
I ran your worksheet and I consistently get a 28 x 28 linear system with rank 27 and no right hand side. The output of solve has a bunch of vi=0 and something like v23=250/819*v27. Maybe you want one of the vi variables to be 1 ? Otherwise you are likely to get solutions like this.
By default, Windows XP will allow each application to allocate at most 2GB of memory, with 2GB reserved for the OS. See this article for how to change it to 3GB/1GB. By 64-bit, do you mean you are running the 64-bit version of Maple ? Execute kernelopts(wordsize) to see. If it's the 32-bit version you can not access more than 4GB of RAM due to lack of address space, but in reality on any modern OS the limit will be 3GB.
First 9 10 11 12 13 14 15 Last Page 11 of 19