Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hey everyone,
I am performing some numerical integrations in MathCAD 13 and I was wondering, since it takes some time to compute, is it possible to split up the integration and assign seperate cores to evaluate each part in MathCAD 13?
In other words, is multithreading possible in MathCAD 13 and how is this done?
thx,
rubseveni
Solved! Go to Solution.
I notice a couple of things about your aMatrix.
1. Your integrals seem to be of the form:
which could be written as:
But since X is independent of x, this just becomes 2aX.
2. You repeat the calculation of many terms like NyMatrix, NxMatrix etc at the innermost level of three loops, only to pick off a single value each time. You could speed things up by precalculating them outside of the loops and assigning them to fixed vectors, then just picking off the appropriate component of the vectors inside the loops.
aMatrix is too large and my patience is too limited for me to test if these changes would make any difference myself.
Alan
Ruben Sevenois wrote:
Hey everyone,
...
In other words, is multithreading possible in MathCAD 13 and how is this done?
thx,
rubseveni
Unfortunately, not in M13. You need Mathcad Prime if you want to multithread. However, there might (or might not) be other ways to speed up your program. If you upload it someone might be able to suggest something.
Alan
Since you requested, in attachment the worksheet.
My main problem is the calculation of "aMatrix". I must warn you though, since this sheet is already quite extensive, trying to improve it might take quite some time. With the current settings, it takes about 2h on my machine solely due to this integration (2.2GHz CPU speed) and my goal is to reduce this to a max of 2 minutes.
Why the two minutes? Well, I have a Mathematica notebook which does the same calculation in 2 minutes. However, due to software limitations at the university I need the program to be written in MathCAD.
Good luck,
rubseveni
I notice a couple of things about your aMatrix.
1. Your integrals seem to be of the form:
which could be written as:
But since X is independent of x, this just becomes 2aX.
2. You repeat the calculation of many terms like NyMatrix, NxMatrix etc at the innermost level of three loops, only to pick off a single value each time. You could speed things up by precalculating them outside of the loops and assigning them to fixed vectors, then just picking off the appropriate component of the vectors inside the loops.
aMatrix is too large and my patience is too limited for me to test if these changes would make any difference myself.
Alan
Indeed Alan, you were right,
After many thoughts I noticed that, during the evaluation of the integral, MathCAD was evaluating a rather large matrix with every descritization which took a lot of time.
Now, I constructed a workaround eliminating the evaluation of the entire matrix and now my average calculation speed is about 2 min.
Thanks for the tips!