Help me to solve Do-loop for large matrices (Mathematica)

  • Context: Mathematica 
  • Thread starter Thread starter kaizen.moto
  • Start date Start date
  • Tags Tags
    Mathematica Matrices
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 4K views
kaizen.moto
Messages
94
Reaction score
0
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
 

Attachments

Physics news on Phys.org
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.
 
Did you test this code in short segments to see if it even works?
Break it down section by section?
 
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 don't 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 don't 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.