R/eBellPol.R

Defines functions eBellPol

Documented in eBellPol

eBellPol <-
  function(n=1,m=0) {
    v<-MFB(n,1);                              # Call the MFB Function
    v<-MFB2Set( v );                          # Expression to vector
    for (j in 1:length(v)) {
      # ----- read -----------[ fix block ]---#---------------#
      c <- as.character(v[[j]][2]);           # coefficient
      x <-              v[[j]][3] ;           # variable
      i <-              v[[j]][4] ;           # subscript
      k <-       strtoi(v[[j]][5]);           # power
      # ----- change -------------------------#---------------#
      if (x=="f") {
        if ((m>0) && (i!=as.character(m))) c<-"0";
        x<-""; 
        i<-""; 
      } 
      else if (x=="g") {
        x<-paste0("(y",i,ifelse(k>1,paste0("^",k),""),")");
        i<-"";k<-1;
      }
      # ----- write ---------[ fix block ]----#---------------#
      v[[j]][2] <- c;
      v[[j]][3] <- x;
      v[[j]][4] <- i;
      v[[j]][5] <- k;
      # --------------------------------------#---------------#
    }
    Set2expr(v);
}

Try the kStatistics package in your browser

Any scripts or data that you put into this service are public.

kStatistics documentation built on June 8, 2022, 5:05 p.m.