Showing posts with label STEM. Show all posts
Showing posts with label STEM. Show all posts

Wednesday, April 13, 2016

copula

I heard of copula-bivariate statistics many times, but rarely understood what people are calculating when they talked about "fitting a copula". Hopefully I've already got some basic understanding on empirical distribution before I finished the copula homework. Now I've done the "quantiles" part (see the last log), which I assumed would be enough, maybe... My goal is to understand how copula works, by that I mean the principles, and then apply it to the precipitation-temperature case, which I've read some articles about.

First thing first, what do we use copula for, and what is copula function?
Copula describes how the two marginal distributions are linked together to form the joint distribution, and the dependency structure between marginal variables. The idea is to separate the copula fitting from the univariate probability distributions fitting. In other words, copula is used for constructing multivariate probability distribution from univariate probability distributions.
According to Sklar's theorem, there exists a "copula" function C(u, v) such that
Fxy(X,Y) = C[Fx(x), Fy(Y)] = C(u, v)
1. C(u, v) is a 2D function defined on [0, 1]^2, given Fx(X) and Fy(Y) are CDFs.
2. C(u, v) doesn't depend on the marginal distributions
3. C(u, v) is a joint CDF with marginal distributions rescaled to uniform distributions, u=Fx(X), v=Fy(Y).

What are the procedures of fitting a copula distribution? (Gao et al., 2007)
1. fit marginal distributions to each variable using some type of parametric univariate distributions: Fx(X), Fy(Y)
2. fit the copula: C(Fx(X), Fy(Y))
3. sample from the copula using Monte Carlo simulations
3.1 unconditional
      (1) generate random samples of u uniformly from [0, 1]
      (2) generate v|u using the inverse conditional CDF Cv|u^(-1)
      (3) generate x,y
3.2 conditional:








Monday, December 7, 2015

Time Series: Fundamental Concepts

Before we talking about the ARMA models (frequently seen in economic literatures), let's begin with the basic concepts where all these time series models are built. Things being reviewed include autocovariance, autocorrelation, partial autocorrelation, moving average, and autoregressive representations of time series. I will also give brief introduction on stationarity and ergodicity.

A stochastic process is a family of random variables that describes the evolution through time of some process. We can see stochastic process as a process described by statistical properties, opposed to a deterministic process such as sin(t). A stochastic time series is a realization from a certain stochastic process.

completely stationarity: any time series distribution function is time-invariant. Why should we worry about stationarity? We need to remove stationarity before we do most of the time series analysis, so we have a lot of preprocessing.

Tuesday, November 3, 2015

Standard deviation vs. standard error of the mean

When I calculated STD using software for two different samples, I got confused as I got a higher STD for smaller-size sample. I expect the STD will become greater for larger sample, because you will have a larger spread.

Then I realized I've mixed up the population and sample again.

1. The standard deviation is a measurement of the "spread" of your data. 
The standard deviation does not become lower when the number of measurements grows.
Note that both mean and standard deviation are population properties. 

2. The standard error of the mean is the standard deviation of your estimate of the mean. 
The standard error of the mean (i.e., the precision of your estimate of the mean) does get smaller as sample size increases.
If you take more measurements, you are getting a more accurate picture of the spread, which means the as you increase your number of observations you will on average get more precise estimates from your sample for both the population mean and standard deviation.

Sunday, October 25, 2015

Quantile

Many measures of the empirical distribution rely on quantiles. According to Wiki, quantiles are cut points dividing the distributions of the observations into equal sized groups. We can understand this concept easily by depicting the cut points on the probability distribution of the data. A sample quantile Qp is a value having a same unit as the data, which exceeds p (0<p<1) proportion of the data, or can be regarded as the p*100% percentile of the data. For example, median is also expressed as Q0.5, meaning the data point which exceeds 50% of the data.
The determination of quantiles requires the order statistics of the data. One of the definition is copied from order statistics:
Our goal is to find the value that is the fraction p of the way through the (ordered) data set. We define the rank of the value that we are looking for as (n1)p+1. Note that the rank is a linear function of p, and that the rank is 1 when p=0 and n when p=1. But of course, the rank will not be an integer in general, so we let k=(n1)p+1, the integer part of the desired rank, and we let t=[(n1)p+1]k, the fractional part of the desired rank. Thus, (n1)p+1=k+t where k{1,2,,n} and t[0,1). So, using linear interpolation, we define the sample quantile of order p to be
x[p]=x(k)+t[x(k+1)−x(k)]=(1−t)x(k)+tx(k+1)
However, this is only one of the nine ways to compute quantiles and not even the best one, R7 in Wikipedia. This is the result of computational load in the past (see this article). This article also discussed the best estimate method, R8 in Wikipedia. This is connected to Tukey plotting position formula through CDF, discussed later.
Sometime we want to compare two distributions, for example, we want to see if two empirical distributions have the common features, or would like to know if one empirical distribution can be fitted by a theoretical distribution. Histogram and ECDF have been widely used for fitting a theoretical distribution, while the results heavily rely on the bin width. Quantile-quantile plot is a more robust way to do the comparison. qq-plot is a scatterplot, with each coordinate pair defining the location of a point consists of a data value, and the corresponding estimate for that data value derived from the quantile function of the fitted distribution. Note that quantile function is the inverse of the cumulative distribution function, therefore the methods for plotting position for CDF is the inverse methods for quantiles estimation. This article about qq_plot is a very detailed and clear online material for understanding the basis of CDF matching.

Wednesday, April 29, 2015

Sampling methods - MC & LHS

拉丁超立方体抽样

协方差矩阵

摘自马斯特博客
为什么需要协方差?标准差和方差一般是用来描述一维数据的,但现实生活我们常常遇到含有多维数据的数据集,因此需要协方差,用来度量两个随机变量关系。

协方差多了就是协方差矩阵协方差也只能处理二维问题,维数多了自然就需要计算多个协方差,比如n维的数据集就需要计算n!/(n−2)!∗2个协方差,那自然而然的我们会想到使用矩阵来组织这些数据。可见,协方差矩阵是一个对称的矩阵,而且对角线是各个维度上的方差。

Sunday, March 8, 2015

[Review] Surface energy fluxes

Surface energy fluxes are the exchanges of energy, water and other atmospheric constituents on the surface, such as water molecule.
Surface energy fluxes mainly occur in the form of radiant energy, latent heat, sensible heat, and soil heat. The residue term of the heat fluxes is the heat that diffuses into the ground and be stored. The heat storage include physical energy storage, biochemical energy storage (2% of the incoming solar energy, which is amazingly small) , and the advected energy (which is important at the heterogeneous surface, such as oasis).

Some typical numbers (w/m2),
Downward shortwave radiation, 350
Longwave net radiation, Nighttime net radiation, -75

Terrestrial surfaces with different land cover types substantially alter the amount of the solar radiation. And the partitioning into latent and sensible heat changes from day to night.
(1) From albedo perspective:
dark color and rougher surface reflects less solar radiation, so therefore higher net radiation. Forest, wet soil have higher incoming energy.

(2) From partitioning in latent and sensible heat perspective: 
(a) For soil, wet soil is latent heat dominant, while dry soil is sensible heat dominant. 
(b) For forest, latent heat is slightly greater than sensible heat.
(c) For crop, latent heat is dominant. Why no sensible heat?


(3) From daytime and nighttime perspective: 
Wet soil have better thermal conductivity and store more heat at night.

Monday, October 13, 2014

反演方法

Inversion and Assimilation
反演、同化总是被同时提起,那么这两者到底分别指的是什么?
以碳循环为例。
反演一般即是通过大气二氧化碳浓度的观测数据来估算陆地生态系统碳源碳汇的分布信息。
同化则是指通过各种直接、间接的测量方式来获得观测数据。

Forward model

Sunday, May 4, 2014

Boundary Layer

对于这一门课,我不能褒奖更多!
除了对流体力学有所涉猎,我居然通过雷诺平均对统计有了更深刻的认识!

Saturday, May 3, 2014

The relationship between Penman Equation, Bulk transfer model, and profile method

There are tons of ways to measure evaporation, and most of these approaches are some sort of interconnected. And it is always confusing to term evaporation in different contexts.

Before you know more about Penman, you need to understand what is turbulent flux <q'w'>(angle quotation means average, same as bar) and how people parameterize them.

First, regard turbulence as the deviation of mean in temporal statistical sense, so as the transfer of momentum, heat, and moisture. Second, we are using a zero-order closure method similarity theory to parameterize the mean qualities needed.(see turbulence closure problem) Similarity theory can be interpreted as parameterizing the mean qualities, but in fact it doesn't mean using any simulation or calculation to retrieve those values. It is based on the similarity between the connected dimensionless groups, which is profound and powerful. Here, one thing that confusing me before was the K theory. K theory is an one-order closure method, by that it means the second order flux term is parameterized by one order variables, such as the mean profiles.

By applying Taylor Hypothesis, one can replace the temporal fluctuations in flux by the spatial changes of mean qualities. (mean: averaging over time)
Bulk transfer model is based on this simplified idea so that the product of the flux <q'w'>  can be rewritten as the product of bulk difference in wind speed and humidity.

(to be continued)

Friday, April 11, 2014

[大气物理]大气物理基础小结


有话要说:一把年纪了才开始温故知新……都是些粗浅的大白话理解……

一、基本定律
1. Ideal gas law 理想气体状态方程。
由微观的压力与分子动能(kinetic energy)即温度的关系可以导出(费曼讲义分子运动论),或者可以由
(1)玻意耳定律:常温下压强与体积成正比
(2)查理-盖·吕萨克定律:常压或等积,体积或压力与温度成正比
导出 PV = nRT  最普遍的形式,涉及摩尔数和摩尔体积,阿伏伽德罗常数的关系在此不进赘述。而大气物理中更常使用 P = rou·RT值得注意前者的R是universal gas constant,而后者的R是specific gas constant。可怜我刚开始看的时候并没有注意两者的区别,生生耽误了不少功夫。。。

2. Dalton's law 道尔顿分压定律。
P = e + P_d  
可以理解为气体状态下,分子间的距离过于遥远,以至于相互之间的分子作用力完全可以忽略不计,因此是independent的作用,故每个气体分子对整个气块的压力可以分离可以加和。
思考点在于分子作用力、独立性(概率事件、泊松随机过程)

3. First law of thermodynamics 热力学第一定律。
dU = dQ + dW 
内能的变化等于外界对气体的加热(辐射加热R、潜热加热LE、传导加热conduction==感热H?、湍流TKE(convective?)、摩擦生热,不一而足)与外界对气块做功的总和。
这里W是外界对气体做功,则气体压缩,W是正值。假设等压,气体压缩,估计是因为位移是负的(位移向-x轴方向),所以PdV是负值,则W=-PdV。
这个非常好理解,内能的变化等于外界能量的进出。
 或写成dQ = dU + PdV理解为传递给一个系统的热量,既对气体做功,气体膨胀(-dW = PdV),又改变了系统的内能。或方便假设系统中熵的变化(热与温度的关系)是dS 。


有时候,W是气体对外做功,(比如《大气物理基础》)即系统对外做功,如果气体压缩,气体对外做负功,W是负值,则-dW是正值写成dU = dQ - dW,写成dQ = dU - PdV的形式,
我觉得这个符号特别乱……
辨别: W1为外界对系统做功,W2为系统对外做功,W1=-PdV(压缩), W2=PdV(膨胀)

焦耳定律是指U只与温度有关dU=CvdT。Cv为定容热容量,定容比热C_v还要再除以质量m

终于明白可逆过程是神马意思了,这还真不是想当然。。。之所以要在很慢很慢的速度中推进,是因为要让系统压力与环境压力时时相等,功可逆就是说环境对系统做功与系统对环境做功是正负号关系。

4. Hydrostatic equation 静力平衡方程。 
dP = -rou·g dz  
个人理解是浮力与重力的平衡,就是上下压力差等于重力推导出来的,用到微元法。思考点在于压力是一个法向于受力面的力,而且各个方向都有,只是因为大气密度有垂直梯度,向上递减,所以净余的是下对上的力。 热力学的推导则用到了重力势能和内能的关系……能量转换什么的高洋上不明觉厉。。。

5. Clausius-Clapeyron equation: e_sat = 6.11·exp(17.3·T/(237.3+T)) (mb/hpa) 水汽量与温度的关系。这个太重要了!


二、基本物理量、常量
  1. 温度 temperature (T)
  2. 湿度:绝对湿度 absolute humidity (rou_v),比湿 specific humidity (q_v),水汽混合比 water vapor mixing ratio (r),相对湿度relative humidity (RH), 气压差VPD
  3. 虚温 virtual temperature (T_v)
  4. 位温 potential temperature (theta)
  5. 虚位温 virtual potential temperature (theta_v)
  6. 蒸汽压 water vapor pressure (e)
  7. 饱和蒸汽压 (e_sat)
  8. 气体常数 gas constant (R)
  9. 比热:等压比热(C_p) ,等容比热(C_v)
  10. 水气分子量比 ε=0.622=18/29

三、各物理量间基本关系
  1. q_v = rou_v/rou_a; r = rou_v/rou_d
  2. 空气密度rou_a = rou_v + rou_d
  3. 比湿与水汽混合比在数值上相近,因为水汽密度(绝对湿度rou_v)实在过于微小。
  4. 用露点温度Td 和 C-C equation可以算出实际蒸汽压e,露点温度可以看成是在同样的水汽量、蒸汽压e下,由原有温度降温到令该水汽饱和的温度,这个就是降雨的第一个条件。简而言之,温度决定了饱和需要多少水汽 demand,而露点温度就是现有水气的衡量 actual content。
  5. T_v = T(1+0.61q) 虚温是对理想气体方程应用在湿空气中的一个校正,因为密度、specific gas constant 都是会随着空气湿度变化的,因此简单运用理想气体方程的话要考虑R的变化,在保持R为干空气气体常数的情况下,虚温就变成绝对温度和比湿的函数。注意,虚温是对理想气体方程的校正,加入了水汽量的信息,我理解这不涉及物理过程,但如果按照物理模型理解则是:虚温是干空气为了具有与湿空气相同的压强和密度所具有的温度,由于湿空气密度小于干空气(注意,湿空气的水分子量小于空气平均分子量),根据理想气体方程,等压密度变小,则温度变大。另外还要注意的是,当上升气团中的水汽饱和之后,假设水汽量不变,即rou_w不变,原式子 rou_d = rou_a - rou_v 要变成 rou_d = rou_a - rou_w = rou_d = rou_a - (rou_v + rou_l) 所以结果是 T_v = T(1+0.61q_sat - q_liquid) 
  6. theta = T(P_0/P)^(R_a/C_p) 位温某种程度上容易理解一些,但是涉及的热力学知识更加复杂。这里常见的物理模型是假设理想气体绝热条件adiabatic下,未饱和的湿空气下降到标准气压P_0处时的温度。位温考虑了空气的可压缩性,被用来除去气团与绝热膨胀、压缩带来的cooling or warming effect,用来比较不同高度层中空气气团的温度。
I. (热力学第一定律) rouC_p·dT = dP
II. (理想气体方程) P = rouRT
III. (静力平衡方程) dP = -rougdz

由I,II 可得到位温,泊松方程
I. 推导可有三种思路:
(A)根据热力学第一定律 dU = dQ + dW / dQ = dU + PdV
(1)内能变化受温度变化调控,dU = dT×等容比热×质量m,定容热容量C_v = dU/dT
(2)外界对气体做功dW = -PdV,等压绝热过程中,气块与周围环境气压的调整是相当迅速的,每一时刻,做功的气压P是已经调整后的气压,由于气块气压在下降、上升过程中会不断变化,所谓等压,其实是微元后的等压,并不是恒压(气块在整个上下移动过程中压力不变)。。。
(3)绝热令dQ=0,
针对每一时刻每单位变化的体积气体列以下方程,C_v·dT = -PdV, 
(4)对理想气体公式两边求导, PdV + VdP = RdT,得到C_v·dT + RdT = VdP,
C_p·dT = (C_v+R) dT = VdP,可得rouC_p·dT = dP
气块上升根本不是等压或等容过程,两者都在变化,所以用焓的状态来想也挺好的,
绝热,焓没有发生变化,所以温度的变化就来自于体积和压力的共同变化。
等容过程,需要等价于体积变化的热能,而等压过程,需要等价于压力变化的热能,
由于等容过程难以计算和接近,所以通过等压过程,实际上要求的就是压力变化下的热能,再引入压力的垂直梯度,就可以得到温度如何随高度变化的压力变化而变化。

(B)如果引入焓的定义,关于等压比热,定压热容量C_p = dH/dT
C_pdT = dU + dPV = dQ + VdP
焓是状态描述量:H = U + PV,dH = dU + PdV + VdP = dQ + VdP
在等压过程中,VdP = 0, 所以等压过程中焓变就是热量变化。如果是等压绝热,dQ = 0,则是等焓过程。

(C)如果要引入熵的定义,那就是s=Q/T,温度是分子热动能,是布朗运动、随机过程,而熵是有序程度,突然觉得好神奇的热统计学!热量由动能和秩序共同决定,比如同样温度的气体和固体,当然是气体的热量大……,这个和比热的关系是什么?很好奇!!
那么等压绝热地把气体从一个高度放到海平面的过程就是一个等熵过程,令ds = 0。
因为dQ = Tds,
所以dQ = dH - VdP = Tds => dH = Tds + VdP 
=> ds = dH/T - V/TdP =  C_pdT/T - V/TdP
加入理想气体方程,
ds = C_pdT/T - RdP/P。
ds = 0, 则C_pdT/T = RdP/P


由I,III可得到气温与高度的关系,即干绝热直减率,dT/dz = -g/Cp
由I,II,III联立,还是得到气压与温度的关系。
要得到气压与海拔的关系,假设温度不变,则有P = P_0·exp(-z/H),其中标高H = RT_0/g0。


(2)另外,这个泊松方程只是针对理想气体,对于湿空气又要另外处理,这就是为什么有假相对位温。。。静力平衡方程




四、重要概念
  1. 静力稳定性:以前不知道这个词那么奇怪,干嘛起那么长
  2. 绝热递减率:大气大部分过程都是绝热过程,这意味着没有热量进出。干绝热递减率,发生原因是因为气压的变化,体积的膨胀,
    位温描述了绝热过程下保持大气标准压强时的温度,位温是一个守恒的量


Sunday, March 30, 2014

Kolmogorov——伟大的数学家计算学家教育家思想家

自修哲双走哪都是康德的节奏后,现在又出现了走哪儿都是Kolmogorov的新节奏。这位苏联数学巨匠,所涉领域包括概率论、算法信息论、拓扑学、直觉主义逻辑、湍流、经典力学和计算复杂性理论。
他的数学观也颇具独创性,认为数学是现实中数量关系与抽象空间关系的桥梁。
数学运用到物理学过程中出现的困难往往在于为运用数学所作的假设的选择,和由数学手段所得结果的解释。
而他对人掌握数学的适应性有如下评述:(1)算法能力,对于方程式有高超的解决能力,变形的能力(说明死记硬背公式是不行的)这个我真心太缺乏了呜呜呜。(2)几何学直观,对于抽象的东西能够清晰描绘想象,并能够深入思考其联系。(3)逻辑性推理能力,包括数学归纳法。

Tuesday, March 25, 2014

turbulence&ET

1. turbulence 对于latent heat 的作用
2. u star 如何影响彭满方程

Monday, March 10, 2014

Important Points & Reading List

知识点
(一)基本概念
流体力学、湍流、大气物理基础、下渗过程、质量输送、水量平衡、地球能量平衡、温室气体与能量平衡
已掌握:emissivity, virtual potential temperature, index notation, 拉格朗日欧拉描述,continuity, mass, momentum, energy budget equation

(二)数学工具
线性代数、张量分析、统计方法
已掌握:张量初步

阅读清单
1. Physical hydrology
(1) Dingman: hydrological processes, hydrologic modelling
Todo: 6
Done:
(2) Shuttleworth: energy budget, precipitation, ABL, resistence
Todo: 4, 6  surface energy fluxes
          11-14 precipitation
          15-19 ABL
Done: 2-3 virtual potential temperature
           8 GCM

(3) Hornberger: hydrology basic physical concepts
Todo: 8 unsaturated water
Done:
(4) Bonan:
Todo: surface energy fluxes

2. Boundary layer
(1) Stull:
Todo: 2,3,5
Done: 1
(2) Lumley:
Todo: 1
Done:

3. Fluid Dynamics
(1) 305 Note
(2) Lumley : video
(3) Hornberger:
Todo: 3 fluid dynamics

4. Atmosphere

Wednesday, March 5, 2014

[流体力学](一)连续性方程

一、拉格朗日、欧拉描述
拉格朗日:经典力学应用在每一个物质点上的描述,对每一个物质点的时间、速度、位移进行描述。
欧拉:参照系的替换,把跟踪物质点换成在特定点观察物质点的运动速度。衍生场理论,把时间依赖性去掉,把速度变成场。


质量守恒定律(mass conservation law)
=>同一流体的质量在运动过程中不生不灭

二、直角坐标系+拉格朗日推导
直角坐标系中,密度由四维变量(t,x,y,z)时间、三个方向决定,
假设在无限小的流体质点,由于距离太短,时间变化为0,
假设在dx,dy,dz这几个微小的变化里,密度在不同方向上发生了变化导致了质量的变化
对这个dx微小变化进行泰勒展开(偏微分多阶之和),去掉二阶以上展开。
最终得到有限体积内的质量变化为0:
drou/dt + d(rouu)/dx + d(rouv)/dx + d(rouw)/dz = 0

物理意义:相对密度变化率等于负的相对体积变化率,从而体积内的质量不会发生改变。

三、欧拉推导
CS控制面, CV控制体积
drou/dt代表单位体积内不定常性(非定常场 non constant)引起的质量变化,右侧-d(rouui)/dxi代表了单位体积表面流出的流体质量。

四、不可压缩流体
drou/dt=0,
因此,
d(rouu)/dx + d(rouv)/dx + d(rouw)/dz = d(rouui)/dxi = divergence of rouu = 0
即是流体微小质团的密度、质量在流动过程中不发生变化,因此体积也不发生变化。


Saturday, March 1, 2014

线性代数3-方程组=>矩阵

一、方程组的几何解释

线性方程组的矩阵形式AX=B
系数矩阵(matrix of coefficients)A,
未知向量(vectors of unknown)X,
右侧向量B.

二维平面:
一个二元一次方程的解是一条直线。
行图像:每个完整方程用直线表现出来,两直线的交点是两个二元一次方程的解。
列图像:系数矩阵变成多个列向量,把未知向量分解成列向量的系数,然后找到正确的未知向量系数(线性组合)得到右侧向量B。列向量是vector,转换成向量的加法。
*如果是三个方程,则是三维向量的加法。
*列向量的个数,就是线性方程组的维度。

三维空间:
三点组成一个平面,一个三元一次方程的解是一个平面。
两个方程的解是两个二元一次方程组,还是两个平面,解是直线,两个平面之间有交线
三个方程的解是三个平面相交,想象成两个平面相交在一条直线上,再来一个平面,直线与平面相交于一个点上。
一个含有3个未知数的方程组在三维空间中确定一个平面,两个方程组确定一条直线,三个方程组确定一个点,这个点就是方程组的解,当然前提是这三个方程组所确定的平面两两不平行。而三维空间的行图像很难画出。
列图像:还是用向量加法。

列的线性组合是否能覆盖整个三维空间?或者说所有B是否都有对应的解?
非奇异矩阵(non-singular matrix)
可逆矩阵(invertible matrix)

如果是奇异矩阵,不可逆矩阵
行图像中看即至少有两个方程组所表示的平面是平行的,
列图像中看即至少有两个列向量是指向同一方向的(即不相互独立,共线向量)
此时,只有b处在这个向量和另一个非共线向量所表示的平面内时,方程组才有解。


二、消元法(elimination)解方程组
矩阵与向量相乘:
[2 5] [1]       [1]       [5]   [12]
[1 3] [2] = 1 [2] + 2[3] = [7 ]

上三角矩阵
增广矩阵 augment

将主对角线上的主元固定(0不能做主元),把主元下面的元素消为0。
右侧向量回代过程:A中加入b列向量变成增广矩阵,增广就是增加的意思,增加了新列,左侧矩阵消元时,右侧向量也会跟着变化
将U和c代入原式子可得解
消元法失效的情况(指不能得到三个主元):当主元上为0时,就通过交换行将主元位置变为非0,当通过交换行还不能解决0主元的时候,消元法就失效了。(不能解决0主元的矩阵是不可逆矩阵)


三、矩阵运算一个3×3矩阵 乘以 一个列向量 =  列向量
等于列向量每个元素乘以一列 之和
一个行向量 乘以 一个3×3矩阵 = 行向量
等于行向量每个元素乘以一行 之和

矩阵相乘如何取行、列向量?
得到每一行如a(1,:)
要取左侧矩阵的第一行,右侧矩阵的三列(即整个矩阵)
得到每一个元素,如a(2,3)
则要取左侧矩阵的第二行,右侧矩阵的第三列进行行列相乘


相乘的法则:如何计算?
所谓相乘,是行a或列b同一序号的元素乘积之和
即ab = sum(aibi)
左侧矩阵取出的行向量/整个矩阵,每次相乘时取列元素/列向量
右侧矩阵取出的列向量/整个矩阵,每次相乘时取行元素/行向量
取出来的列向量、行向量序号要对应,比如第一列乘第一行

Tuesday, February 18, 2014

重拾线性代数·2

强烈推荐原博客:孟岩:理解矩阵(一)

容纳运动是空间的本质特征。事实上,不管是什么空间,都必须容纳和支持在其中发生的符合规则的运动(变换)。

1. 线性空间是什么样的对象的集合?

线性空间中的任何一个对象,通过选取基和坐标的办法,都可以表达为向量的形式。

2. 线性空间中的运动如何表述的?也就是,线性变换是如何表示的?

从线性空间中的一个点运动到任意的另外一个点,都可以通过一个线性变化来完成。在线性空间中,当你选定一组基之后,不仅可以用一个向量来描述空间中的任何一个对象,而且可以用矩阵来描述该空间中的任何一个运动(变换)。而使某个对象发生对应运动的方法,就是用代表那个运动的矩阵,乘以代表那个对象的向量。

在线性空间中选定基之后,向量刻画对象,矩阵刻画对象的运动,用矩阵与向量的乘法施加运动。

矩阵的本质是运动的描述。== 矩阵是线性空间里的变换的描述。


矩阵是线性空间中的线性变换的一个描述。在一个线性空间中,只要我们选定一组基,那么对于任何一个线性变换,都能够用一个确定的矩阵来加以描述。对于一个线性变换,只要你选定一组基,那么就可以找到一个矩阵来描述这个线性变换。换一组基,就得到一个不同的矩阵。所有这些矩阵都是这同一个线性变换的描述,但又都不是线性变换本身。

什么是基呢?这里只要把基看成是线性空间里的坐标系就可以了。
若矩阵A与B是同一个线性变换的两个不同的描述(之所以会不同,是因为选定了不同的基,也就是选定了不同的坐标系),则一定能找到一个非奇异矩阵P,使得A、B之间满足这样的关系:

A = P-1BP

所谓相似矩阵,就是同一个线性变换的不同的描述矩阵。
什么相似标准型,对角化之类的内容,都要求变换以后得到的那个矩阵与先前的那个矩阵式相似的,为什么这么要求?因为只有这样要求,才能保证变换前后的两个矩阵是描述同一个线性变换的。

重拾线性代数·1

一. 学习动机(exciting questions)

强烈推荐原博客:孟岩:理解矩阵(一)

矩阵究竟是什么东西?
向量可以被认为是具有n个相互独立的性质(维度)的对象的表示,矩阵又是什么呢?
我们如果认为矩阵是一组列(行)向量组成的新的复合向量的展开式,那么为什么这种展开式具有如此广泛的应用?特别是,为什么偏偏二维的展开式如此有用?如果矩阵中每一个元素又是一个向量,那么我们再展开一次,变成三维的立方阵,是不是更有用?

矩阵的乘法规则究竟为什么这样规定?
为什么这样一种怪异的乘法规则却能够在实践中发挥如此巨大的功效?很多看上去似乎是完全不相关的问题,最后竟然都归结到矩阵的乘法,这难道不是很奇妙的事情?难道在矩阵乘法那看上去莫名其妙的规则下面,包含着世界的某些本质规律?

行列式究竟是一个什么东西?
为什么会有如此怪异的计算规则?行列式与其对应方阵本质上是什么关系?为什么只有方阵才有对应的行列式,而一般矩阵就没有。而且,行列式的计算规则,看上去跟矩阵的任何计算规则都没有直观的联系,为什么又在很多方面决定了矩阵的性质?难道这一切仅是巧合?

矩阵为什么可以分块计算?
分块计算这件事情看上去是那么随意,为什么竟是可行的?

对于矩阵转置运算AT,有(AB)T = BTAT,对于矩阵求逆运算A-1,有(AB)-1 = B-1A-1。两个看上去完全没有什么关系的运算,为什么有着类似的性质?这仅仅是巧合吗?

为什么说P-1AP得到的矩阵与A矩阵“相似”?

特征值和特征向量的本质是什么?
它们定义就让人很惊讶,因为Ax =λx,一个诺大的矩阵的效应,竟然不过相当于一个小小的数λ,确实有点奇妙。但何至于用“特征”甚至“本征”来界定?它们刻划的究竟是什么?