Displaying 1 result from an estimated 1 matches for "20behave".
2007 Sep 11
1
what am I missing
x<-seq(-1,1,length=10)
y<-seq(-1,1,length=10)
a<-matrix(c(1,2,2,1),2,2)
b<-matrix(c(2,1,1,2),2,2)
fv<-function(x,y) {
m<-x*a+y*b
t<-m[1,1]+m[2,2]; d<-m[1,1]*m[2,2]-m[1,2]^2
return((t-sqrt(t^2-4*d))/2)
}
gv<-function(x,y) {
t<-x*(a[1,1]+a[2,2])+y*(b[1,1]+b[2,2])
d<-(x*a[1,1]+y*b[1,1])*(x*a[2,2]+y*b[2,2])-(x*a[1,2]+y*b[1,2])^2
return((t-sqrt(t^2-4*d))/2)
}