I've been trying to run a simple triple-loop in R to populate a 3-D array with elements defined as a function that involves a double integral (integral2 in package pracma). Here's a shortened version:
ArrA<-array(0:0, c(3,3,length(b))) for(k in 1:length(b)) for(i in 1:3) for(j in 1:3) { ArrA[i,j,k]<-func1(i,j,b[k]) } where func1 has been defined before and is fully functional (and involves integral2 as mentioned).
When running this triple-loop, I get the error
Error in if (adjerr[1] > localtol) { : missing value where TRUE/FALSE needed Now the strange thing is that if I manually fill the array thusly:
ArrA[1,1,1]<-func1(1,1,b[1]) ArrA[1,1,2]<-func1(1,1,b[2]) ... ArrA[3,3,7]<-func1(3,3,b[7]) everything works just fine. No problem with tolerance whatsoever. It's only when I try to set a loop to work this out that the error pops up.
What does that error mean exactly and how do I work around it?
https://stackoverflow.com/questions/66666879/trouble-running-simple-loops March 17, 2021 at 12:09PM
没有评论:
发表评论