Karl-Ranz

80 Reputation

2 Badges

17 years, 185 days

MaplePrimes Activity


These are answers submitted by Karl-Ranz

Hi Acer

Thank you very much for your sufficient help. I  tried  a newer version of my program by now, but was not yet able to see improvements. Yet, I now understand a whole lot more of how to effienctly write a program and implement the routines. I'll try some more and if I get results, I'll post them.

Have a good evening

 

Karl

Hi Axel, Joe and John

thanks for the quick help. I didn't figure in the beginning that adding a plain converted i to string entry could help, but now it sounds reasonable.

Well, congratulations to MaplePrime award and have a nice evening

 

Karl

Hi John

 

Thank you for your approach. I tried yours as well and it works just fine. Yet, it is not as fast as the above routine, also considering that later on magnitude and argument still have to be calculated with the "sort3" procedure. The advantage of yours is, that it can handle integers.

I am using this sorting procedure at the end of a loop, which circles a few thousand times, so a few milliseconds can make a large additional coffeebreak ;)

But thank you very much for the quick answer and have nice evening

 

Karl

Hi

I found help on your pages after a bit more research: http://www.mapleprimes.com/blog/joe-riel/sorting-with-attributes

Using

sort3 := proc(L)
local l;
    return map(attributes,sort([seq](setattribute(abs(l),l), l=L),`<`));
end proc:

should work. I am sorry about the new forum topic.

 

Karl

Thanks a lot.

The smaller one of my programs does run now and there is no sign of a memory overrun (although it was quite fun seeing, how  the RAM bar slowly filled up at my sidebar gadget :) ).

One last question. If I have a large matrix M, filled with non-float values, where Maple is obviously unable to determine the eigenvalues and eigenvectors, is the following command valid, or do I produce an hidden error, when I convert into numerical calculation this way:

(EW,EV):=Eigenvectors(evalf(M)):

 

 

Hi everyone

I would like to reopen this topic as the solution of storing the data in matrix to export it as whole after loop has some flaws, which appear if the program grows in size.

If the loop is repeated about 1000 times and during each cycle a vector of 17 elements has to be stored my memory (2GB) overflows and Maple crashes :)  I do not want to reduce the number of Digits, so there has to be another way.

How can I program the loop, so that my eigenvalues are stored horizontally and exported to the end of a file after every cycle. Because during the next cycle all former calculations and values can then be overwritten, I can increase the Digits value and make my calculation more accurate.

If this is possible with ExportVector, then I would like to know, how you can prevent, that Maple always overwrites everything what has already been inside the file instead of adding it at the end of the file.

Thank you again and I hope that the solution to this problem is of much use for others as well

Karl

 

 

The example is indeed very useful. Thank you very much. I will try to suit it to my sheet. It looks like, it will do the trick. Thanks
Thank you for your quick answer, but I also had the idea of storing each vector as row in a matrix and then export it as a whole using ExportMatrix after the loop has finished :) Unfortunately, I was not yet able to achieve this, as I do not know, how Maple handles recursive assignments. I tried something like this: A:=Matrix([ A,Transpose(eigenvaluevector) ]); and of course it did not work, as it is a recursive assignment. If you know a better way than recursion please tell me. In addition, the loop can have a different amount with each start, so a static matrix, which should store the values does not help. It should be built dynamically.
Page 1 of 1