Here's a little test double loop
for i from 1 to 2 do
for j from 1 to 2 do
A[i,j]:=Binomial[i+j,i];
end do;
end do;
I would like to get ANYTHING to output. I get NOTHING, no matter WHAT variations I make. I can output when the loop is just a SINGLE nest. But, as soon as I embed that nest inside a second nest - NOTHING outputs.
Comments
printlevel
If you want to see the computations of inner loops, then you have to increase the value of printlevel. In this case,
HELP PAGE
Having TROUBLE with `for` or `do`? Then READ the HELP-PAGE for `for` or `do`.
The HELP-PAGE for `do` is accessible by entering ?do or ?for
It says that the printing from nested loops is controlled via printlevel, in the bullet point titled "Note about Nested Loops". It has a cross-reference to ?printlevel
acer
Searching for the correct command
Thank you for your help. I wouldn't know for which command to look under Help.
Now I have the more difficult problem of including multiple if and then statements within my recursion. My recursion is
with(Physics):
c[i+1,j,k,l] : = (1/((i+1)*d[0]))* sum(iq*d[i+1-iq]*c[iq,j,k,l],iq=1..i) +
sum(c[i-1,j,kq,l]*binomial(i+j-kq-l,k),kq=0..k)
- sum(jq*c[i,jq,k,l]*e[j+1-jq],jq=1..j)
+sum(c[i,j-1,k,l]*binomial(i+j-k-lq,l),lq=0..l)
+KroneckerDelta[i,1]*KroneckerDelta[j,0]*KroneckerDelta[k,0]*KroneckerDelta[l,0]
+KroneckerDelta[i,0]*KroneckerDelta[j,1]*KronckerDelta[k,0]*KroneckerDelta[l,0];
with c[i,j,k,l] = 0 if any of i,j,k,l <0,
c[0,j,k,l] = 0 for all j,k,l if k>0
c[i,0,k,l] = 0 for i,k,l if l>0
and c[0,j,0,l] are assumed known for all j,l and c[i,0,k,0] are assumed known for all i,k and the arrays d[ ] and e[ ] consist of algebraically independent indeterminates.
Hence, I seek to express c[i,j,k,l] in terms of c[0,j',0,l'], c[i',0,k',0], d[0],d[1],...etc e[0],e[1],e[2]...etc
Other Possibilities: print and userinfo
Using printlevel gives you all of the output. If you want to see only selected results you should insert explicit print statements.
Another way to control output is to use the userinfo and infolevel commands. The userinfo command specifies the "level" required to have the output displayed and what to print. The infolevel command controls the setting of the "level" which is used to decide when to print the information in the userinfo. Unfortunately, to the best of my knowledge, userinfo only displays messages, not 2D output. But, you can mimic this functionality with flags that you set and check on your own.
For example,
I hope this is helpful.
Doug