Skip to main content
1-Visitor
Jun 7, 2022 9:13 AM UTC
Solved

Mathcad Prime is Laggy

Hello all, I believe I am suffering from a similar problem to a previous post;

 

Solved: Mathcad Prime worksheet Running Slow Compared to M... - PTC Community

 

I have a legacy calculation converted from Mathcad 15 that is mathematically very simple but approximately 170 pages long and as you will see from the attached is butchering my cpu.  The aforementioned Prime calculation is consequently running painfully laggy and occasionally crashing. 

 

Mathcad Prime 8.png

Does anyone have any recommendations on a sensible procedure for processing such conversions that goes beyond the standard PTC Mathcad Migration guide?

 

For example, is it advantageous to break the calculation up into areas and disable them etc...

 

@VladimirN , @terryhendicott 

terryhendicott
21-Topaz II
Jun 8, 2022 9:22 AM UTC

Hi,

 

Well done to get the size down.  By sections I mean insert the "point###:=time(0)" and "step[0:= etc.." by page 170 steps, or two pages at a time 85 steps,  or reasonable calculation steps.  Keep the file as one item.

 

This way a plot of timing in each step can show where to concentrate some effort in speeding up worksheet..

 

Capture.JPG

Cheers

Terry

8 replies

terryhendicott
21-Topaz II
Jun 7, 2022 9:21 AM UTC

Hi,

If it is possible can the file be uploaded for review?

Cheers

Terry

Translate
1-Visitor
Jun 7, 2022 9:31 AM UTC

Hello Terry, thanks for the quick response.

 

I am unable to upload it for privacy reasons. 

Translate
terryhendicott
21-Topaz II
Jun 7, 2022 10:05 AM UTC

Hi,

Understand the need for privacy.

Can only give general guidance.

 

If you are doing the same thing over and over try and vectorize it or use matrix arithmetic.

For instance the top truth table in matrix comparisons would be faster than the if statement.

Capture2.JPG

 

Matrices - define the last element first as this avoids Prime resizing it. 

Avoid for loops and use indices instead of programming.

For example large matrix first and indexing using range variables instead of for loops in programming.

The Prime below is complex and fast.

Capture.JPG

 

Memory management is smaller if you use programming for intermediate matrix and variable calculations as the local variables inside the function are deleted after program is run.

 

Cheers

Terry

Translate