首先欢迎读者朋友开始本丛书第三本的阅读。本章和接下来的两章将以数学内容为主,是丛书第一本数学及统计学内容的延续,为后面金融分析及建模提供必需的基础知识。
Mathematics, rightly viewed, possesses not only truth, but supreme beauty—a beauty cold and austere, like that of sculpture, without appeal to any part of our weaker nature, without the gorgeous trappings of painting or music, yet sublimely pure, and capable of a stern perfection such as only the greatest art can show. The true spirit of delight, the exaltation, the sense of being more than Man,which is the touchstone of the highest excellence, is to be found in mathematics as surely as poetry.
——伯特兰·罗素(Bertrand Russell)
本章核心命令代码
△ atan(X) 返回X各元素的反正切,X以弧度为单位
△ bsxfun(fun,A,B) 对数组A和B应用函数句柄fun进行运算。例如以下代码完成两步运算:第一步,从矩阵A的对应列元素中减去列均值;第二步,按标准差进行归一化。C=bsxfun(@minus, A,mean(A)); D=bsxfun(@rdivide, C, std(A))
△ chol(A) 基于矩阵A的对角线和上三角形生成上三角矩阵。L=chol(A,'lower')基于矩阵A的对角线和下三角形生成下三角矩阵L,满足方程L*L'=A
△ detrend() 从向量或矩阵中删除均值或去除线性趋势
△ diag() 创建对角矩阵或获取矩阵的对角元素
△ eig(A) 计算特征值和特征向量。[V,D]=eig(A)返回特征值的对角矩阵D和矩阵V,其列是对应的右特征向量,使得A*V=V*D
△ eye() 产生单位矩阵
△ ldl(A) 进行LDL分解运算。对Hermitian不定矩阵A的分块LDL分解,使得A=L*D*L'
△ lu(A) LU分解命令。[L,U]=lu(A)将满矩阵或稀疏矩阵A分解为一个上三角矩阵U和一个经过置换的下三角矩阵L,满足A=L*U
△ mvnrnd() 产生符合多元正态分布的随机数
△ norm(v) 返回向量v的欧几里得范数。此范数也称为2-范数、向量模或欧几里得长度
△ svd(A) 以降序顺序返回矩阵A的奇异值;[U,S,V]=svd(A)执行矩阵A的奇异值分解,因此A=U*S*V'
△ var() 计算方差