[Yuima-commits] r580 - in pkg/yuima: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 24 19:04:37 CET 2017


Author: iacus
Date: 2017-01-24 19:04:37 +0100 (Tue, 24 Jan 2017)
New Revision: 580

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/toLatex.R
Log:
fixed tolatex for 1 dim case

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2017-01-23 13:39:42 UTC (rev 579)
+++ pkg/yuima/DESCRIPTION	2017-01-24 18:04:37 UTC (rev 580)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.5.4
+Version: 1.5.5
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature, mvtnorm
 Imports: Rcpp (>= 0.12.1)
 Author: YUIMA Project Team

Modified: pkg/yuima/R/toLatex.R
===================================================================
--- pkg/yuima/R/toLatex.R	2017-01-23 13:39:42 UTC (rev 579)
+++ pkg/yuima/R/toLatex.R	2017-01-24 18:04:37 UTC (rev 580)
@@ -339,39 +339,79 @@
         
     } else{ 
     n.eq <- mod at equation.number
-    dr <- paste("\\left(\\begin{array}{c}\n")
+    dr <- NULL
+    if(n.eq>1)
+     dr <- paste("\\left(\\begin{array}{c}\n")
     for (i in 1:n.eq) {
-            dr <- paste(dr, substr(mod at drift[i], 2, nchar(mod at drift[i]) -1), "\\\\ \n")
-        #      dr <- paste(dr, substr(mod at drift[i], 3, nchar(mod at drift[i]) - 2), "\\\\ \n")
+            dr <- paste(dr, substr(mod at drift[i], 2, nchar(mod at drift[i]) -1))
+            if(n.eq>1)
+             dr <- paste(dr, "\\\\ \n")
+            #      dr <- paste(dr, substr(mod at drift[i], 3, nchar(mod at drift[i]) - 2), "\\\\ \n")
     }
     #
-    dr <- paste(dr, "\\end{array}\\right)", sprintf("d%s", mod at time.variable))
+    if(n.eq>1)
+     dr <- paste(dr, "\\end{array}\\right)")
+    
+    dr <- paste(dr,  sprintf("d%s", mod at time.variable))
     n.n <- mod at noise.number
-    df <- paste(sprintf("\\left[\\begin{array}{%s}\n",paste(rep("c",n.n),sep="",collapse="")))
+    
+    df <- NULL
+    if(n.eq>1 & n.n>1)
+     df <- paste(sprintf("\\left[\\begin{array}{%s}\n",paste(rep("c",n.n),sep="",collapse="")))
     for (i in 1:n.eq) {
         #df <- paste(df, paste(mod at diffusion[[i]], collapse = "&"))
-                df <- paste(df, paste(substr(mod at diffusion[[i]], 2, nchar(mod at diffusion[[i]]) - 1)  , collapse = "&"))
-        df <- paste(df, "\\\\ \n")
+        if( n.eq>1 & n.n>1){
+            df <- paste(df, paste(substr(mod at diffusion[[i]], 2, nchar(mod at diffusion[[i]]) - 1)  , collapse = "&"))
+            df <- paste(df, "\\\\ \n")
+        } else {
+            df <- paste(df, paste(substr(mod at diffusion[[i]], 2, nchar(mod at diffusion[[i]]) - 1)  , collapse = ""))
+        }
     }
-    df <- paste(df, "\\end{array}\\right]")
+    
+    if(n.eq>1 & n.n>1)
+     df <- paste(df, "\\end{array}\\right]")
+     
+     
 # We consider the Jump 6/11
+    dj <- NULL
     if (length(mod at jump.coeff)>=1){
-      dj<-paste("\\left(\\begin{array}{c}\n")
+      if(n.eq>1)
+       dj<-paste("\\left(\\begin{array}{c}\n")
       for (i in 1:n.eq) {
-        dj <- paste(dj, substr(mod at jump.coeff[i], 2, nchar(mod at jump.coeff[i]) - 1), "\\\\ \n")
+          if(n.eq>1){
+         dj <- paste(dj, substr(mod at jump.coeff[[i]], 2, nchar(mod at jump.coeff[[i]]) - 1), "\\\\ \n")
+          } else {
+              dj <- paste(dj, substr(mod at jump.coeff[[i]], 2, nchar(mod at jump.coeff[[i]]) - 1))
+          }
         #dj <- paste(dj, mod at jump.coeff[i], "\\\\ \n")
         
       }
+      if(n.eq>1)
       dj <- paste(dj, "\\end{array}\\right)", sprintf("d %s", mod at jump.variable))
     }
+    wn <- NULL
+    if( n.n>1){
+     wn <- paste("\\left(\\begin{array}{c}\n")
+    }
+    if(n.n>1){
+     wn <- paste(wn, paste(sprintf("dW%s", 1:n.n), sep = "", collapse = "\\\\ "))
+    } else {
+     wn <- paste(wn, "dW1")
+    }
+    if( n.n>1){
+        wn <- paste(wn, "\n \\end{array}\\right)")
+    }
     
-    wn <- paste("\\left(\\begin{array}{c}\n")
-    wn <- paste(wn, paste(sprintf("dW%s", 1:n.n), sep = "", collapse = "\\\\ "))
-    wn <- paste(wn, "\n \\end{array}\\right)")
-    st <- paste("\\left(\\begin{array}{c}\n")
-    st <- paste(st, paste(sprintf("d%s", mod at solve.variable), 
-						  sep = "", collapse = "\\\\ "))
-    st <- paste(st, "\n \\end{array}\\right)")
+    st <- NULL
+    if(n.eq>1)
+     st <- paste("\\left(\\begin{array}{c}\n")
+     for(i in 1:n.eq){
+      st <- paste(st, sprintf("d%s", mod at solve.variable[i]))
+      if(n.eq>1)
+       st <- paste(st,  " \\\\ ")
+     }
+     if(n.eq>1)
+      st <- paste(st, "\n \\end{array}\\right)")
     mysymb <- c("*", "alpha", "beta", "gamma", "delta", "rho", 
 				"theta","sigma","mu", "sqrt")
 #     myrepl <- c(" \\cdot ", "\\alpha ", "\\beta ", "\\gamma ", 
@@ -394,27 +434,41 @@
     body <- c(body, paste(dr))
     body <- c(body, paste(" +"))
     body <- c(body, paste(df))
-    body <- c(body, paste("'"))
+    #    body <- c(body, paste(""))
     body <- c(body, paste(wn))
     # For Jump 6/11
     if (length(mod at jump.coeff)>=1){
       body <- c(body, paste(" +"))
       body <- c(body, paste(dj))
+      body <- c(body, "dZ")
+      
     }
     
+    
+ 
     body <- c(body, paste("$$"))
 
     body <- c(body, paste("$$"))
 # For Initial Conditions     
     numb.solve.var <- length(mod at solve.variable)
-    bodyaus <-c( paste("\\left(\\begin{array}{c}\n"))
+    
+    bodyaus <- NULL
+    if(numb.solve.var >1){
+     bodyaus <- "\\left(\\begin{array}{c}\n"
+    }
+    
     for (i in 1:numb.solve.var) {
-      bodyaus <-paste(bodyaus, paste(paste(mod at solve.variable[i],"(0)",sep=""),substr(mod at xinit[i], 2, nchar(mod at xinit[i]) - 1),sep="="), "\\\\ \n")
+        bodyaus <-  paste(bodyaus, paste(paste(mod at solve.variable[i],"(0)",sep=""),substr(mod at xinit[i], 2, nchar(mod at xinit[i]) - 1),sep="="))
+        if(numb.solve.var>1)
+          bodyaus <-paste(bodyaus, "\\\\ \n")
       # paste(bodyaus, paste(paste(mod at solve.variable[i],"(0)",sep=""),substr(mod at xinit[i], 3, nchar(mod at xinit[i]) - 2),sep="="), "\\\\ \n")
       #     paste(bodyaus, paste(paste(mod at solve.variable[i],"(0)",sep=""),substr(mod at xinit[i], 2, nchar(mod at xinit[i]) - 1),sep="="), "\\\\ \n")
     }
     
-    bodyaus <- paste(bodyaus, "\\end{array}\\right)")
+    if(numb.solve.var >1){
+     bodyaus <- paste(bodyaus, "\\end{array}\\right)")
+    }
+    
     for (i in 1:ns) {
       bodyaus <- gsub(mysymb[i], myrepl[i], bodyaus, fixed = "TRUE")
     }



More information about the Yuima-commits mailing list