165 Reputation

8 Badges

8 years, 348 days

MaplePrimes Activity

These are replies submitted by AmusingYeti

@Thomas Richard Thank you, kernelopts is a fantastic suggestion.

@dharr That does the trick! Thank you.

With a little RegMatch magic I have a flag to use now:




Personally I believe that optimisation is not one of Maple's strong points. I do a lot of non-linear optimisation and mainly use C++, Python and some C/Fortran, all of which are far better suited for these sorts of problems.

- Yeti


Thank you for the link and also for the useful Maple command which I missed when looking through the documentation. I was thinking it may fall under matrix balancing but the scaling part makes more sense.



Without the matrix transformation it nearly always fails as Matrix B ends up being negative definite when using Cholesky. or it cannot seem to find Schur forms when using QZ. When the transformation is applied, both methods are able to calculate the eigenvalues. One other method I could try is the generalised singular value decomposition which I believe is the gold standard for ill-conditioned generalised eigenvalue problems. Many thanks.


@Markiyan Hirnyk 

"Your question is pure math. Ask that in math forums."

Please refer to the MaplePrimes "About" page:

"A Web community dedicated to sharing experiences, techniques, and opinions about Maple, MapleSim and related products, as well as general interest topics in math and computing."


How about supplying more information about the quantities? What are alpha, beta, j, K, T, R[m]? By giving Maple information about your quantities it is better able to solve the problem.

From a quick look it seems like a basic substitution will yield the answer. Have you tried this?



See my edited answer.

- Yeti

@Markiyan Hirnyk 

In terms of system resources only, both methods will produce the exact same answer to any level of precision. I submitted the answer on my phone, so apologies for not being rigorous with my Maple syntax... like a solid person would do.


Three points:

1) What working precision do you want for this calculation? The coefficients are ~ 50 digits, do you want 50 digits of accuracy? That will cause a bottleneck. Not to mention that the coefficients you end up with have over 3000 digits; this problem may need reformulating.

If you only require say double precision, then set Digits:=16: or if a lower target accuracy is required then set the digits lower.

2) If Maple is bottlenecking or runs out of memory, you need to make the input it receives as simple as possible. Try adding:


which will simplify the size of the input.

With these two changes, the first part of the calculation takes ~ 8 minutes with only 1GB of ram required on my old ThinkPad laptop. I am however using Maple 2015 as do not currently have access to Maple 18 on my home machine. (See attached, modified worksheet containing the first part of your code. N.B remove the convert(..,rational) command as further testing shows it lengthens the calculation time).

Another point is worth considering, but I did not use as it did not appear to work for your example, but may work for others.

3) In the Maple help page for invlaplace the following is printed:
"If the option opt is set to 'NO_INT', then the program will not resort to integration of the original problem if all other methods fail.  This will increase the speed at which the transform will run."

I have spent some time testing this and I am unsure if this option is currently working in Maple, as I cannot find an example where it offers any speed increase over not using it. This could be worth considering though.

I do not currently have time to look at the second part of the code, but will see if I can revisit it later. You may want to look into the gc() and unassign() Maple commands in order to free up memory.


@Carl Love 

Interesting, I have not seen this behaviour before. Has this always been the case?



To my knowledge Maple will import a matrix into RAM without memory mapping when using the ImportMatrix command. Loading a 28GB matrix ine one go with 8GB of RAM will not be feasible using this technique. You would need to process smaller parts of the matrix at one time and be smarter about memory allocation and reallocation. I have a lot of experience doing this in C++ and Python but not in Maple.

In terms of why the 700MB file will not load could be a different matter.  700MB is not a large file, but when being processed (and potentially serialised) by Maple the required memory will be much higher than one might think.

I regularly use 30GB size matrix files and C++ and Python can process these trivially with reading directly from disk without loading into RAM or using memory mapping techniques. I would advise looking at this route.



How much RAM does your system have?

Have you made sure that the matrix can be interpreted by Maple? Do a minimal working example with a smaller size matrix (try a 10 x 10) using the same format in your matrix file, run the same command and see what it gives you.

I would expect Maple to just cut connection to the kernel if memory allocation was an issue.


1 2 3 4 5 Page 1 of 5