Forgive me. I had a legitimate problem that I found resolvable using "**" instead of "^". I can't seem to recreate the problem to obtain the error message that I was receiving. "Incomplete information" is perhaps more appropriate than "*mis*information."
Here is the exact code I used (still not correct to my original question, but a step along the way): > J <- 3 > r_ <- 1.959 > q_ <- 1.45 > scale_ <- 0.3 > N <- 4 > fq <- seq(0, N-1, 1) > fq [1] 0 1 2 3 > center_frequencies <- function(J = 3, r_ = 1.959, q_ = 1.45, scale_ = 0.3){ + j <- seq(0,J-1,1) + fc <- (q_ + j)^r_/scale_ + } > fc <- center_frequencies(3,r_,q_,scale_) > fc [1] 6.902377 19.286575 37.710853 > cf <- t(fc) > cf [,1] [,2] [,3] [1,] 6.902377 19.28657 37.71085 > lambda <- function(cf, J = 3, scale_ = 0.3){ + B <- cf*scale_ + } > B <- lambda(cf, 3, 0.3) > B [,1] [,2] [,3] [1,] 2.070713 5.785972 11.31326 > Fc <- 1/cf > Fc [,1] [,2] [,3] [1,] 0.1448776 0.05184954 0.02651757 > dummy <- fq%*%Fc > dummy [,1] [,2] [,3] [1,] 0.0000000 0.00000000 0.00000000 [2,] 0.1448776 0.05184954 0.02651757 [3,] 0.2897553 0.10369908 0.05303513 [4,] 0.4346329 0.15554862 0.07955270 > U <- -dummy+1 > for(j in 1:J) + { + Z <- dummy**B[j] + U <- (-dummy+1)**B[j] + } > Z [,1] [,2] [,3] [1,] 0.000000e+00 0.000000e+00 0.000000e+00 [2,] 3.222504e-10 2.881245e-15 1.462288e-18 [3,] 8.200170e-07 7.331782e-12 3.721022e-15 [4,] 8.053568e-05 7.200705e-10 3.654498e-13 > U [,1] [,2] [,3] [1,] 1.000000000 1.0000000 1.0000000 [2,] 0.170223061 0.5475283 0.7378244 [3,] 0.020842075 0.2897999 0.5398325 [4,] 0.001577800 0.1476795 0.3914810 > for(i in 1:4) + { + for(j in 1:3){ + U[i,j]<-ifelse( U[i,j]>30,30,U[i,j]) + } + U <- exp(U) > W <- Z*U > U [,1] [,2] [,3] [1,] 2.718282 2.718282 2.718282 [2,] 1.185569 1.728974 2.091381 [3,] 1.021061 1.336160 1.715719 [4,] 1.001579 1.159141 1.479170 > W [,1] [,2] [,3] [1,] 0.000000e+00 0.000000e+00 0.000000e+00 [2,] 3.820502e-10 4.981599e-15 3.058201e-18 [3,] 8.372872e-07 9.796435e-12 6.384229e-15 [4,] 8.066285e-05 8.346635e-10 5.405623e-13 > I can now get W using: W <- as.complex(((fq/cf[j])^B[j])*(exp(-(fq/cf[j])+1)^B[j])) where j is the index for cf (i.e., each center frequency is run individually and written to a table). Still not the most efficient way to accomplish this step, but it is working for me. Jeff On Fri, Jul 15, 2011 at 5:34 AM, peter dalgaard <pda...@gmail.com> wrote: > > On Jul 14, 2011, at 20:19 , Duncan Murdoch wrote: > > > On 14/07/2011 12:46 PM, warmstron1 wrote: > >> I resolved this issue. It appears that "^" won't work for this case, > but > >> "**" worked. I can't find any reference to this, but where "^" seems to > be > >> used to raise a value to a numerical function, "**" is used for a y > raised > >> to the power of x where x it a computation. > > > > Those should be equivalent. Can you post the code that wasn't working, > and describe what "not working" meant? > > More easily, demonstrate that code that _is_ working stops working if you > replace "**" with "^". Or stop spreading misinformation! > > -- > Peter Dalgaard > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Email: pd....@cbs.dk Priv: pda...@gmail.com > > -- *W. Jeffrey Armstrong, Ph.D. *Assistant Professor Exercise Science *Managing Editor Clinical Kinesiology* Official Journal of the American Kinesiotherapy Association [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.