练习
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/8db8a3f96b4d209c7c2c1624475bf8c1.png)
解
- (1)
ar1<-function(x,y){0.5**(abs(x-y))}
n<-5
x<-1:n
y<-1:n
R<-outer(x,y,ar1)
sigma<-2*R - (2)
outer函数的general form: outer(X,Y,Function)
a<-1:3
b<-2:5
z=outer(a,b)
# z=a' * b
#z的维数dim(d) = c( dim(a) , dim(b) )
[,1] [,2] [,3] [,4]
[1,] 2 3 4 5
[2,] 4 6 8 10
[3,] 6 9 12 15