Cleve Moler is the author of the first MATLAB, one of the founders of MathWorks, and is currently Chief Mathematician at the company. He is the author of two books about MATLAB that are available online. He writes here about MATLAB, scientific computing and interesting mathematics.
The Wikipedia article on Pascal's Triangle has hundreds of properties of the triangle and there are dozens of other Web pages devoted to it. Here are a few facts that I find most interesting.
Blaise Pascal (1623-1662) was a 17th century French mathematician, physicist, inventor and theologian. His Traité du triangle arithmétique (Treatise on Arithmetical Triangle) was published posthumously in 1665. But this was not the first publication about the triangle. Various versions appear in Indian, Chinese, Persian, Italian and other manuscripts centuries before Pascal.
Binomial Coefficients
The binomial coefficient usually denoted by ${n} \choose {k}$ is the number of ways of picking $k$ unordered outcomes from $n$ possibilities. These coefficients appear in the expansion of the binomial $(x+1)^n$. For example, when $n = 7$
Formally, the binomial coefficients are given by
$${{n} \choose {k}} = \frac {n!} {k! (n-k)!}$$
But premature floating point overflow of the factorials makes this an unsatisfactory basis for computation. A better way employs the recursion
$$ {{n} \choose {k}} = {{n-1} \choose {k}} + {{n-1} \choose {k-1}}$$
This is used by the MATLAB function nchoosek(n,k).
Pascal Matrices
MATLAB offers two Pascal matrices. One is symmetric, positive definite and has the binomial coefficients on the antidiagonals.
The traditional Pascal triangle is obtained by rotating P clockwise 45 degrees, or by sliding the rows of L to the right in half increments. Each element of the resulting triangle is the sum of the two above it.
The elements in the third column of lower triangular Pascal matrix are the triangle numbers. The n-th triangle number is the number of bowling pins in the n-th row of an array of bowling pins.
$$t_n = {{n+1} \choose {2}}$$
L = pascal(12,1);
t = L(3:end,3)'
t =
1 3 6 10 15 21 28 36 45 55
Here's an unusual series relating the triangle numbers to $\pi$. The signs go + + - - + + - - .
function pie = pi_pascal(n)
tk = 1;
s = 1;
for k = 2:n
tk = tk + k;
if mod(k+1,4) > 1
s = s + 1/tk;
else
s = s - 1/tk;
end
end
pie = 2 + s;
Ten million terms gives $\pi$ to 14 decimal places.
format long
pie = pi_pascal(10000000)
err = pi - pie
pie =
3.141592653589817
err =
-2.398081733190338e-14
Matrix Exponential
Finally, I love this one. The solution to the (potentially infinite) set of ordinary differential equations
$\dot{x_1} = x_1$
$\dot{x_j} = x_j + (j-1) x_{j-1}$
is
$x_j = e^t (t + 1)^{j-1}$
This means that the matrix exponential of the simple diagonal matrix
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。