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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

limitations for-loops and nested arrays in mathcad 14?

ptc-4788437
1-Newbie

limitations for-loops and nested arrays in mathcad 14?

Good Morning,

I'm currently writing my graduate-thesis using Mathcad 14. It is working pretty good so far, but the professor and I came across certain problems yesterday neitherone of us could find answers for.

Our code contains quite a few for-loops generating nested arrays and matrix operations. I set up the entire document as a parametric calculation so only the starting parameters need to be entered and the code automatically generates modells, meshes surfaces and so on. The quality of the results relies heavy on the degree of discretisation we are able to use. For low discretizations (<10000 elements and therefore entries in our matrices and arrays) the calculation works perfectly and results are quickly displayed. But for a much higher number of elements calculation the for-loops fail while matrix-operations still run strong.

Here is the command that fails first. It is basically the rotation of coordinates in 3D:

First the command

ROTATION(M,phistart,phiend,delta-phi):=for phi element of phistart, phistart + delta-phi,.....,phi-end

for j element 0...number of collums

X0,j <- (M0)0,j

Y0,j <- (M1)0,j * cos(phi) - (M2)0,j * sin(phi)

Z0,j <- (M1)0,j * sin(phi) + (M2)0,j * cos(phi)

(X,Y,Z)T (merely for export)

explanation: M is an array containing three matrices with my coordinates for x, y und z. phistart and phiend represent the start and finish of my rotation and delta-phi the step. This is only the command I need to use later on...

Now the use of the command on an Array:

Name(Array,starting-angle,finishing-angle,step)=my results...

This works perfectly with a small number of points, but fails to work with approximately 10000 points or more. The displayed error says merely "eng-exeption"

This raises the question: What are the limitations on a nested array and calculations with mathcad 14 in general? Since it is a 32-bit-programm I expected at least 2^16 as a limitation...Do you guys have any idea why the generation of nested arrays fails with such a low number of elements?

Thanks in advance, Jon

1 ACCEPTED SOLUTION

Accepted Solutions

Stuart, Jon

I took the liberty of converting your worksheet to Prime 2.0 M010.

I changed the program so that the vectors x,y & z are created in the program. (defining vectors directly in the worksheet uses up more memory)

Instead of N = 10^5

I used N = 9.99 * 10^7

100milliion_prime2.png

The result was returned in a couple minutes.

For problems with larger arrays/iterations I would suggest, take a look at Prime 2.

Prime 2.0 is a 64 -bit native environment and you should have much more available memory (all things taken into consideration)

View solution in original post

5 REPLIES 5

You might have run out of memory. I can run a similar function up to 3x100,000 elements (depending upon what else is going on, I also got 3x250,000 elements at one point).

collab+-+12+10+24+nested+array+limitation+01.jpg

BTW, you might be able to use the automatic vectorization in this case to avoid the loop and the memory consumed by the internal arrays X,Y&Z (suitably re-written for your particular form) ...

collab+-+12+10+24+nested+array+limitation+02.jpg

Stuart

This is a good idea...Than I'll define phi like this: phi=phistart...phiend...

This could actually work...

Thank you very much

Kein Problem, Jonathan .. although you might have change your row vectors into Mathcad-standard column vectors.

Stuart

I wrote it into my document as a comment and change it when I find the time...but I'll figure that one out 😉

Stuart, Jon

I took the liberty of converting your worksheet to Prime 2.0 M010.

I changed the program so that the vectors x,y & z are created in the program. (defining vectors directly in the worksheet uses up more memory)

Instead of N = 10^5

I used N = 9.99 * 10^7

100milliion_prime2.png

The result was returned in a couple minutes.

For problems with larger arrays/iterations I would suggest, take a look at Prime 2.

Prime 2.0 is a 64 -bit native environment and you should have much more available memory (all things taken into consideration)

Top Tags