cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Out of Memory Error on Mathcad 15 Worksheet

hello1234
3-Visitor

Out of Memory Error on Mathcad 15 Worksheet

I have a Mathcad 15 Worksheet which uses big matricies, and many "if" statements.

Now that I am trying to edit some of the matricies I had created, I am getting an "Out of Memory" error when I try to save the file. 
Is there a way or update that will allow for more memory? I know my computer is not the issue because I have a lot of space on my computer.

I am using Mathcad 15.0

9 REPLIES 9

More memory in your PC does not help as Mathcad 15, being based on old software fundaments, will not be able to use it.

This is one of the few benefits of Prime that it can use more memory and allows for Multithreading (but there are quite some reports here that this is buggy). But Prime is so far back behind Mathcad 15 in available features, speed and usability workflow, that we hardly can recommend downgrading to Prime.

It's hard to give concrete help without seeing the worksheet (and maybe just as hard if you can see it ;-).

So if you are allowed to do so, you may consider posting the sheet here.

At least you should be more specific as to what "editing some of the matricies I had created" actually means. Are you changing the methods and functions which create those matrices or do you copy the created matrix to a variable and edit specific elements of this copy? You have to be aware that copying a matrix to a new variable doubles the memory needs. Also creating a new matrix with the same name does not free the memory of the older instance (unless its done in a program with a local variable). So there may be ways to avoid memory wasting but its hard to poke around in the dark without seeing how you implemented your calculations.

There are some general tweaks which can be applied like pre-allocating memory for matrices (mainly for speed reasons but it can also be memory relevant as Mathcad needs to allocate contiguous memory chunks for matrices) or, quite important, not to use inline evaluations when dealing with large matrices.

Also avoiding symbolic evaluations may help.

It depends on the specific calculations if it would be possible to split the large matrices into a couple of smaller ones and do some calculations partially using these smaller matrices.

Usually even Mathcad 15 can handle quite large matrices pretty well but unfavorable implemented programs may lead to the "Out of memory" error sooner than others.

You may also consider to search the forum for "Mathcad" "Out of memory" "matrices" to get some hints, but the search function here is quite mediocre and not very helpful.

Here is what I found trying a quick search: click

BTW, which release of MC15 are you using? Current is M050.

There is a bug fix in M045 which according to the docs "Fixes issue with Mathcad 15.0 M040 in handling matrices with 256 or more elements".

I wouldn't call a matrix with just 256 elements "large" and it may not have anything to do with your problem, but if you have pre M045, it might be worth upgrading to M050, if possible.

 

I have many "if" statements as shown attached below. Do these affect the memory? Each "if" statement does different calculations using matrices. Z' can go up to a 14x14 matrix. 

 

a couple of 14 x 14 matrices sure should not lead into a memory problem.

I don't think that the if statements should affect memory usage.

Just by habit and for a small performance improvement I would use explicit "return" statements at the end of each if-branch to avoid unnecessarily  checking the following conditions.

It may also help saving memory during the calculation if you don't assign too many local variables but use the expression directly in your calculations (at the cost of losing readability and clearness). But the matrices you use are so small that memory sure should not be a problem, so I suspect the reason has to be something else.

You may try to turn the calculation into a function by writing

doIt(dummy):=<your program for Z012 here> and then use Z012:=doIt(0)

Instead of dummy you may use some or all of the involved matrices as arguments, but I suspect this could mean increased memory needs.

It may help if you make Z' the function argument - give it a try.

Or leave it as it is and make the first line of the program Z' <- Z', turning Z' to a local variable that way. Just a shot in the dark, though.

I will try that, thank you very much

Werner_E,

 

silly question: You wrote: "...not to use inline assignments when dealing with large matrices"

What is an inline assignment?

Thanks


@JBlackhole wrote:

Werner_E,

 

silly question: You wrote: "...not to use inline assignments when dealing with large matrices"

What is an inline assignment?


No silly question at all, it was my fault. It should have been "inline evaluation"! Thanks for pointing me to that, I just corrected it in my post above.

It means you should avoid something like

M:=<matrix calc program> =

but rather use

M:=<matrix calc program> 
M=

 

Thanks. Glad I asked.

I guess the "program" you are referring to is a Mathcad worksheet!?

 

Which maintanance release of Mathcad 15 are you using? From time to time memory leaks are fixed - to the best of my knowlege the last one in M030 (which was followed by M040 and M045)

You may look at the release notes yourself here:Mathcad 15 M045 release notes ("Read This First" guide)

 

Furthermore you have to be aware that the core routines, the basis of mathcad 15 is rather old and so chances are, that Mathcad 15 will not be able to make use of all the memory you provide. I am not sure where the limit is. This should be (at least in theory) one of the very few advantages Prime has over Mathcad. Prime should be able to take advantage of all memory installed as far as I understood.

Ty to update to the latest Mathcad 15 M050 service release: https://www.ptc.com/-/media/Files/Docs/Mathcad/Mathcad15-EN.zip

Top Tags