0
$\begingroup$

I admit I’m a bit desperate for a solution here, I have defined in Mathematica:

  1. A basis newBasis (built from a function f[c[i],c[j],c[k]]).
  2. A set of rewrite rules reorderIndices and adjRepr to put those f[…] into a canonical form.
  3. A set of “product‐to‐**” rules
matrixProduct := {
  A_[a_][i_, j_] B_[b_][j_, k_] -> A[a] ** B[b][i, k],
  A_[a_] ** B_[b_][i_, j_]  C_[c_][j_, k_] -> 
   A[a] ** B[b] ** C[c][i, k],
  A_[a_] ** B_[b_][j_, i_]  C_[c_][k_, j_] -> 
   C[c] ** A[a] ** B[b][k, i],
  resta___ ** a___[i_, j_] restb___ ** b___[j_, k_] -> 
   resta ** a ** restb ** b[i, k]
  }

When I do

basis = newBasis /. reorderIndices[5] //. adjRepr;
basis = basis //. matrixProduct;
cBasis = complexConjugate[basis];
cBasis = cBasis //. matrixProduct;

everything converges fine. But as soon as I compute

c = Table[If[i <= j, basis[[i]] cBasis[[j]], 0], {i, 1, 6}, {j, 1, 6}]

I get

$RecursionLimit::reclim: Recursion depth of 1024 exceeded.

How can I multiply basis[[i]] and basis[[j]] in a Table without triggering infinite rewrites? Any pointers to how to avoid the infinite recursion inside Table?

Thanks in advance for any insight!

$\endgroup$
4
  • $\begingroup$ Hello, welcome to MMA.SE, then, please show us a self-contained (minimal) working example reproducing your problem, otherwise it'll be hard to diagnose. $\endgroup$ Commented Jun 15 at 14:18
  • 1
    $\begingroup$ Yeah, we're going to need to see more of your code, but in the meantime, I'm suspicious of how many times c appears in your code. I wouldn't be surprised if a c turned up inside the Table expression that you're using to define c. $\endgroup$ Commented Jun 15 at 15:05
  • 1
    $\begingroup$ And side note, C (uppercase) is a reserved symbol. It's probably not a problem in this specific case, but in general it's best to avoid name clashes with built-in symbols. If C had evaluation rules, then your replacement rules could be doing something very different. $\endgroup$ Commented Jun 15 at 15:08
  • $\begingroup$ The last rule inside matrixProduct looks dangerous. Because of the use of lots of BlankNullSequences (triple underscores like ___) it looks like that pattern might match the right-hand side of that same rule, leading to an infinite recursion. You might want to replace ___ with __ (double underscores, i.e. BlankSequence. $\endgroup$ Commented Jun 15 at 20:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.