[R] Save values from an expression that is created from deriv command

dimitris kapetanakis gamitor at gmail.com
Sat May 23 18:46:03 CEST 2009

Dear all,

I want to save a value from an expression that I created by using the deriv
function. So for example the output from an expression using the deriv
command is:

    .expr7 <- 4 * b.nox.2^2 - 12 * b.nox.3 * b.nox.1
    .expr9 <- -2 * b.nox.2 - sqrt(.expr7)
    .expr10 <- 6 * b.nox.3
    .value <- .expr9/.expr10
    .grad <- array(0, c(length(.value), 1L), list(NULL, c("b.nox.3")))
    .grad[, "b.nox.3"] <- 0.5 * (12 * b.nox.1 * .expr7^-0.5)/.expr10 - 
        .expr9 * 6/.expr10^2
    attr(.value, "gradient") <- .grad

The problem is that I do not know how to store the:

.grad[, "b.nox.3"] <- 0.5 * (12 * b.nox.1 * .expr7^-0.5)/.expr10 - 
        .expr9 * 6/.expr10^2

and then use its numerical value in my code.

How can I store the above value or any output from the expression from deriv
command so I can use it later in the code?

Any help would be highly appreciated


View this message in context: http://www.nabble.com/Save-values-from-an-expression-that-is-created-from-deriv-command-tp23686186p23686186.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list