Description Usage Arguments Value Examples
wxMaxima
does symbolic computation in 'Maxima'
Requires installation of Maxima software.
1 |
obj |
Lines without printed output, that will be evaluated in wxMaxima. |
out |
Lines with printed output, is end results of the function. |
tex |
if |
List of character strings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #components(determinant, Sigma inverse, argument for exponent) for joint normal distribution
eq_c <- c("Tw ~ ((((PH) + (tw)) * (ta - Tc + 2) + (1 + (tw)) * (Ec/w - 2/w) -(1 + (PH))) +
sqrt((((PH) + (tw)) * (ta - Tc + 2) + (1 +(tw)) * (Ec/w - 2/w) - (1 + (PH)))^2 - 4 * (1 + (PH) +
(tw)) *(-(PH) * (ta - Tc + 2) + (1 - (tw) * (ta - Tc + 2)) * (2/w -Ec/w))))/(2 * (1 + (PH) +
(tw)))",
"Tf1 ~ (th1) * (ta - (((((PH) + (tw)) * (ta - Tc + 2) + (1 + (tw)) *(Ec/w - 2/w) - (1 + (PH))) +
sqrt((((PH) + (tw)) * (ta -Tc + 2) + (1 + (tw)) * (Ec/w - 2/w) - (1 + (PH)))^2 - 4 *(1 + (PH) +
(tw)) * (-(PH) * (ta - Tc + 2) + (1 - (tw) *(ta - Tc + 2)) * (2/w - Ec/w))))/(2 * (1 + (PH) +
(tw)))) -Tc + 2) - 1",
"Ef1 ~ (ph1)/(PH) * (w * (((((PH) + (tw)) * (ta - Tc + 2) + (1 +(tw)) * (Ec/w - 2/w) -
(1 + (PH))) + sqrt((((PH) + (tw)) *(ta - Tc + 2) + (1 + (tw)) * (Ec/w - 2/w) - (1 + (PH)))^2 -4 *
(1 + (PH) + (tw)) * (-(PH) * (ta - Tc + 2) + (1 - (tw) *(ta - Tc + 2)) * (2/w - Ec/w))))/(2 *
(1 + (PH) + (tw)))) -Ec + 2) - 1")
parl <- c("tw","PH","th1","ph1")
para_cont <- get_par(parl, eq_c)
cheqs0 <- para_cont$cheqs0
npar <- get_npar(cheqs0)
neq <- length(cheqs0)
sdv <- rep(NA, neq)
mv <- rep(NA, neq)
sigma <- expand.grid(1:neq, 1:neq)%>%apply(., 1, function(x)paste0(x, collapse=','))%>%
paste0('sigma', '[', . ,']')%>%sort
sigma <- matrix(sigma, neq, neq, byrow = TRUE)
sigma[lower.tri(sigma)] <- sort(sigma[upper.tri(sigma)])
#create Y
y <- paste0('eps[', 1:neq,']')
ypy <- paste0('[', y, ']', collapse = ',')
ypy <- paste0('Y : matrix(', ypy, ')')
#sigma
spy <- paste0(sapply(1:neq, function(i) paste0('[', paste0(sigma[i,], collapse = ', '), ']')),
collapse = ',')
spy <- paste0('Sigma : matrix(', spy, ')')
detS <- 'dets : ratsimp(determinant(Sigma))'
invS <- 'invs : ratsimp(invert(Sigma))'
expt <- 'expt : ratsimp(transpose(Y) . invs . Y)'
obj <- c(ypy, spy, detS, invS, expt)
#grind function in Maxima returns an object that can be mathematically evaluated
out <- c('print(new)', 'grind(dets)', 'print(new)', 'grind(invs)', 'print(new)', 'grind(expt)')
## Not run:
rez <- wxMaxima(obj, out)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.