PDA

View Full Version : Help me to solve Do-loop for large matrices (Mathematica)


kaizen.moto
May4-11, 06:19 AM
Hi all,

I have difficulties about applying the Do-loop command as it takes very long time to run (more than 24 hours and it keeps running).

However, if i do it manually, without Do command, i.e. putting the values of the variables, Mathematica gives me a pretty quick output.

Please see the attached files.

I really appreciate for any comments.


Thanks

Bill Simpson
May4-11, 09:36 PM
When I evaluate the "Do loop" version I see errors

SetDelayed::write: Tag Times in Pi/a[m_] is Protected.
SetDelayed::write: Tag Times in Pi/a[n_] is Protected.
followed by a variety of other SetDelayed and Part errors.

That very likely indicates something is wrong and needs to be tracked down.

But given two notebooks over a hundred kilobytes each with a variety of changes in format and organization makes it very difficult to try to track down what is wrong.

It is unfortunate, but I don't believe there is a "diff" utility that understands Mathematica notebooks and can overlook meaningless differences while pointing out significant differences. I can manually find some of the things you have changed to turn one into the other but I have not been able to track down exactly what was broken in changing from the "manual" to the "do" version.

If this were mine I would track down and figure out and fix what was causing those errors. I would begin at the top of the two files and track down what changes you have made are important, what are not, and where errors have been introduced.

Winzer
May5-11, 01:52 AM
Did you test this code in short segments to see if it even works?
Break it down section by section?

kaizen.moto
May5-11, 10:31 AM
I have run and checked all the codes, segment by segment by breaking them into an indvidual cell, they are all working fine and give me the outputs without any errors or warning.

I dont have such errors displayed when I run the codes using version 7 (both windows and linux machines).

My problem is only that the Do-loop version takes such a very long time to run and still I dont have any output. I need some suggestions if there is any way to improve my codes or any modifications in the syntax/command that need to be replaced.

I welcome any comments and really appreciate it.

Thank you.