Skip to content
Prev 326214 / 398503 Next

functions and matrices

Basically R does things *numerically* and what you want to do really
amounts to symbolic manipulation.  Of course R could be cajoled into
doing it --- see fortune("Yoda") --- but probably only with a great deal of
effort and code-writing.

OTOH you could quite easily write a function that would calculate
det(u%*%v)(x) for any given numerical value of x:

foo <- function(a,b,x){
     a1 <- apply(a,c(1,2),function(m,x){m[[1]](x)},x=x)
     b1 <- apply(b,c(1,2),function(m,x){m[[1]](x)},x=x)
     det(a1%*%b1)
}

Then doing

     foo(u,v,2)

gives 0.  (In fact foo(u,v,anything) gives 0 for your collection of 
functions;
the matrix "u(x)" is singular for any x --- the second row is x^2 times the
first row.)

Perhaps this is good enough for your purposes?  If not, you should probably
be looking at a symbolic manipulation package.  The R package "Ryacas" has
some capabilities in this regard, but I have no experience with it and 
cannot
advise.

     cheers,

         Rolf Turner
On 02/07/13 05:37, Naser Jamil wrote: