Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Attached is a little example of a problem I'm seeing - in simplified format only to demonstrate the issue. Background - I'm doing a 2D finite difference problem and during setup mathcad slows down an unacceptable amount and I can't see why it should.
I tried it in 5.0 with no change. On my machine the 'slow' program here takes about 5 seconds, while the 'fast' examples are instantaneous - as expected since there's no real calculation ongoing.
I don't see why it should slow down like this. I suspect it's recalculating the 'node' matrix over and over. Or possibly a bug. Anything I'm doing wrong?
4.0 and pdf attached.
Thanks,
Solved! Go to Solution.
Your three routines create differently sized matrices ans so the time difference is understandable.
I renamed them and turned them into functions of a dummy argument for timing purposes:
Its always a good idea to let Mathcad preallocate the memory for the full matrix first and dont't let the matrix "grow slowly". A simple modification to your slow routine makes it as fast as the others:
Why would you index A with a column number from the node matrix?
Have you seen what the values in the node matrix are.
They run up to (Mdiv-1)*Ndiv+Ndiv, that is, the mximum number is 39*70+70=40*70=2800.
So all of a sudden you could be creating an element for A in its 2800th column.
Mathcad slows down when you change size of a matrix, I guess Prime is no exception.
I'm not surprised that Prime 5 shows the same behaviour. There's NO difference between Prime4 and Prime5, other than that Prime5 includes a 3rd party plotting tool.
Success!
Luc
Your three routines create differently sized matrices ans so the time difference is understandable.
I renamed them and turned them into functions of a dummy argument for timing purposes:
Its always a good idea to let Mathcad preallocate the memory for the full matrix first and dont't let the matrix "grow slowly". A simple modification to your slow routine makes it as fast as the others:
Thanks Werner, the preallocation does the trick. I realize there are size differences between the examples, but a 2800x2800 matrix should be (and is) lightning fast, as I've played with much bigger ones without issue many times. Lesson learned - although i actually always kinda liked how Mathcad doesn't require matrix definition. First time it's ever gotten me in trouble, to my knowledge.