Frequently-used Mathematica Build-in Functions

本文主要记录一下在使用 Mathematica 过程中常用的 build-in functions.


Numeric

LogLog[$z$]
gives the natural logarithm of $z$ (logarithm to base $e$).
Log[$b,z$]
gives the logarithm to base $b$.

Log[E^2] -> 2
Log[10.] -> 2.30259
Log[2, 4] -> 2
NN[$expr$]
gives the numerical value of $expr$.
N[$expr, n$]
attempts to give a result with $n$‐digit precision.

N[1/7] -> 0.142857
N[Gamma[3.3], 50] -> 2.68344
(Machine presicion input will lead to only machine precision output)
N[Gamma[33/10], 50] -> 2.6834373819557687935963273147667112586281870043548

Calculus

DD[$f,x$]
gives the partial derivative $\partial f/ \partial x$.
D[$f, \{x, n\}$]
gives the multiple derivative $\partial^n f/ \partial x^n$.
D[$f, x, y, \dots$]
gives the partial derivative $\cdots (\partial / \partial y) (\partial / \partial x) f$.
D[$f, \{x, n\}, \{y, m\}, \dots$]
gives the multiple partial derivative $\cdots (\partial^m / \partial y^m) (\partial^n / \partial x^n) f$.
D[$f, \{\{x_1, x_2, \dots\}\}$]
for a scalar $f$ gives the vector derivative $(\partial f/ \partial x_1, \partial f/ \partial x_2, \cdots)$.
DSolve

Series

GeneratingFunctionGeneratingFunction[$expr, n, x$]
gives the generating function in $x$ for the sequence whose $n$-th series coefficient is given by the expression $expr$.
GeneratingFunction[$expr, \{n_1, n_2, \dots\}, \{x_1, x_2, \dots\}$]
gives the multidimensional generating function in $x_1, x_2, \dots$ whose $n_1, n_2, \dots$ coefficient is given by $expr$.

GeneratingFunction[$\frac{1}{(n+1)!m!}, \{n, m\}, \{x, y\}$] -> $\frac{e^y(-1+e^x)}{x}$
SeriesSeries[$f, \{x, x_0, n\}$]
generates a power series expansion for $f$ about the point $x=x_0$ to order $(x-x_0)^n$, where $n$ is an explicit integer.
Series[$f, x\to x_0$]
generates the leading term of a power series expansion for $f$ about the point $x=x_0$.
Series[$f, \{x, x_0, n_x\}, \{y, y_0, n_y\}, \dots$]
successively finds series expansions with respect to $x$, then $y$, etc.
SeriesCoefficientSeriesCoefficient[$series, n$]
finds the coefficient of the $n$-th-order term in a power series in the form generated by Series.
SeriesCoefficient[$f, \{x, x_0, n\}$]
finds the coefficient of $(x-x_0)^n$ in the expansion of $f$ about the point $x=x_0$.
SeriesCoefficient[$f, \{x, x_0, n_x\}, \{y, y_0, n_y\}, \dots$]
finds a coefficient in a multivariate series.

例子

找 OBGF 的一个系数:

$f(z,u)$ 是关于计数 不出现00的长度为$n$的01序列中 0 的出现次数 的 OBGF,下面计算的是 0 的期望次数趋近 $\frac{n}{\sqrt{5}\phi}$,其中 $\phi=\frac{1+\sqrt{5}}{2}$。


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *