Mathematica: working with Module for 2 variables.

Click For Summary
SUMMARY

The discussion revolves around optimizing a Mathematica code that utilizes the Module function for two variables, m and n, to compute qmatrix[m, n]. The user is struggling with a complex implementation and seeks advice on simplifying the code. Suggestions include exploring alternative methods beyond Module to achieve the desired output of mattop in terms of m and n. The user expresses a commitment to improving their coding skills and simplifying their approach.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of the Module function in Mathematica
  • Basic knowledge of variable manipulation in programming
  • Experience with function definition in Mathematica
NEXT STEPS
  • Research alternative methods to Module in Mathematica
  • Learn about function optimization techniques in Mathematica
  • Explore examples of simplified Mathematica code for similar problems
  • Study best practices for variable management in Mathematica
USEFUL FOR

New programmers, Mathematica users, and anyone looking to optimize code involving multiple variables in Mathematica.

kaizen.moto
Messages
94
Reaction score
0
Dear all,
Iam running a code which has only 2 main variables, i.e. m and n using Module. I have tried to run the code as attached but it is not working.
Please help me to improve the code so that I would be able to get qmatrix[m,n].

Perhaps, is there any other better method to use or other command apart from Module? Please let me know.

Many thanks for any response.
 

Attachments

Last edited:
Physics news on Phys.org
That code is crazy complicated (and surely can't be the best way of doing whatever you're trying to do)... maybe come up with a simple example that displays the point of your question.

I'm not sure that the crux of the question is really about Module[] with two variables (which is what the title of your post says).
 
Thank you for the feedback. Frankly speaking, being a new programmer, I can't find other way to simplify the code. But I will try my best to find one, no matter what ever it takes.

All the expressions in the code are expressed interms of m and n right from the top to the end, i.e. from matd until mattop. The goal of the code is to find the output of mattop, expressed in terms of m and n. Since i have named the code to qmatrix[m_,n_]:= mattop, so Iam expecting that I could determine the result of qmatrix for what ever the values of m and n.

Anyway, I take your comment positively and I endeavour to improve the code to the best I could.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K