函数 (数学)
维库,知识与思想的自由文库
在数学领域,函数是一种关系,这种关系使一个集合里的每一个元素对应到另一个(可能相同的)集合里的唯一元素。函数的概念对于数学和数量学的每一个分支来说都是最基础的。
术语函数,映射,对应,变换通常都是同一个意思。
目录 |
[编辑] 概述
简而言之,函数是将唯一的输出值赋予每一输入的“法则”。这一“法则”可以用函数表达式、数学关系,或者一个将输入值与输出值对应列出的简单表格来表示。函数最重要的性质是其决定性,即同一输入总是对应同一输出(注意,反之未必成立)。从这种视角,可以将函数看作“机器”或者“黑盒”,它将有效的输入值变换为唯一的输出值。通常将输入值称作函数的参数,将输出值称作函数的值。
最常见的函数的参数和函数值都是数,其对应关系用函数式表示,函数值可以通过直接将参数值代入函数式得到。如下例, f(x) = x2 数x 的平方即是函数值。
可以将函数很简单的推广到与多个参量相关的情况。例如: g(x,y) = xy 有两个参量x和y,以乘积xy为值。与前面不同,这一“法则”与两个输入相关。其实,可以将这两个输入看作一个有序对(x, y),记g为以这个有序对(x, y)作参数的函数,这个函数的值是xy。
科学研究中经常出现未知或不能给出表达式的函数。例如地球上不同时刻温度的分布,这一函数以地点和时间为参量,以某一地点、某一时刻的温度作为输出。
函数的概念并不局限于数的计算,甚至也不局限于计算。函数的数学概念更为宽泛,而且不仅仅包括数之间的映射关系。函数将“定义域”(输入集)与“对映域”(可能输出集)联系起来,使得定义域的每一个元素都唯一对应对映域中的一个元素。函数,如下文所述,被抽象定义为确定的数学关系。由于函数定义的一般性,函数概念对于几乎所有的数学分支都是很基本的。
[编辑] 历史
函数这个数学名词是莱布尼兹在1694年开始使用的,以描述曲线的一个相关量,如曲线的斜率或者曲线上的某一点。莱布尼兹所指的函数现在被称作可导函数,数学家之外的普通人一般接触到的函数即属此类。对于可导函数可以讨论它的极限和导数。此两者描述了函数输出值的变化同输入值变化的关系,是微积分学的基础。
18世纪中叶,函数一词又被欧拉(Leonhard Euler)用于描述含有多个变量的表达式,例如f(x) = sin(x) + x3。
19世纪的数学家开始对数学的各个分支作规范整理。维尔斯特拉斯(Karl Weierstrass)提出将微积分学建立在算术,而不是几何的基础上,因而更趋向于欧拉的定义。
通过扩展函数的定义,数学家能够对一些“奇怪”的数学对象进行研究,例如不可导的连续函数。这些函数曾经被认为只具有理论价值,迟至20世纪初时它们仍被视作“怪物”。稍后,人们发现这些函数在对如布朗运动之类的物理现象进行建模时有重要的作用。
到19世纪末,数学家开始尝试利用集合论来规范数学。他们试图将每一类数学对象定义为一个集合。狄利赫莱(Johann Peter Gustav Lejeune Dirichlet)给出了现代正式的函数定义(参见下文#正式定义)。
狄利赫莱的定义将函数视作数学关系的特例。然而对于实际应用的情况,现代定义和欧拉定义的区别可以忽略不计。
[编辑] 正式定义
从输入值集合X 到可能的输出值集合Y 的函数f(记作 f : X → Y)是X与Y的关系,满足如下条件:
- f 是完全 的:对X 中任一元素x 都有集合Y 中的元素y 满足x f y (x 与y 是f 相关的)。即,对每一个输入值,Y 中都有至少一个与之对应的输出值。
- f 是多对一 的:若x f y 且x f z ,则y = z 。即,多个输入可以映射到一个输出,但一个输入不能映射到多个输出。
定义域中任一x 在对映域中唯一对应的y 记为f(x)。
比上面定义更简明的表述如下:从X 映射到Y 的函数f 是X 与Y 的直积X × Y 的子集。X 中任一x 都与Y 中的y 唯一对应,且有序对(x, y)属于f 。
X与Y的关系若满足条件(1),则为多值函数。函数都是多值函数,但多值函数不都是函数。X与Y的关系若满足条件(2),则为部分函数。函数都是部分函数,但部分函数不都是函数。除非特别指明,本百科全书中的“函数”总是指同时满足以上两个条件的关系。
考虑如下例子:
![]() |
完全,但非多对一。X中的元素3与Y中的两个元素b 和c 相关。因此这是多值函数,但不是 函数。 | |
![]() |
多对一,但非完全。 X 的元素1未与Y 的任一元素相关。因此这是部分函数,但不是 函数。 | |
![]() |
完全且多对一。因此这是从X到Y的函数。此函数可以表示为f ={(1, a), (2, d), (3, c)},或
|
[编辑] 定义域、对映域和值域
输入值的集合X被称为f 的定义域;可能的输出值的集合Y被称为f 的对映域。函数的值域是指定义域中全部元素通过映射f 得到的实际输出值的集合。注意,把对映域称作值域是不正确的,函数的值域是函数的对映域的子集。
计算机科学中,参数和返回值的数据类型分别确定了子程序的定义域和对映域。因此定义域和对映域是函数一开始就确定的强制约束。另一方面,值域和实际的实现有关。
[编辑] 函数图像
函数f的图像是平面上点对(x,f(x))的集合,其中x取定义域上所有成员的。函数图像可以帮助理解证明一些定理。
如果X和Y都是连续的线,则函数的图像有很直观表示,如右图是立方函数的图像:
Note that since a relation on the two sets X and Y is usually formalized as a subset of X×Y, the formal definition of function actually identifies the function f with its graph.
[编辑] Images and preimages
The image of an element x∈X under f is the output f(x).
The image of a subset A⊂X under f is the subset of Y defined by
- f(A) := {f(x) : x in A}.
Notice that the range of f is the image f(X) of its domain. In our function above, the image of {2,3} under f is f({2, 3}) = {c, d} and the range of f is {a, c, d}.
Note that with this definiton, the direct image f becomes a function whose domain is the set of all subsets of X (also known as the power set of X) and whose codomain is the power set of Y. Note that the same notation is used for the original function f and its direct image. This is a common convention; the intended usage must be inferred by context.
The preimage (or inverse image) of a set B ⊂ Y under f is the subset of X defined by
- f −1(B) := {x in X : f(x)∈B}.
In our function above, the preimage of {a, b} is f −1({a, b}) = {1}.
Note that with this definiton, f −1 becomes a function whose domain is the power set of Y and whose codomain is the power set of X'.
Some consequences that follow immediately from these definitions are:
- f(A1 ∪ A2) = f(A1) ∪ f(A2).
- f(A1 ∩ A2) ⊆ f(A1) ∩ f(A2).
- f −1(B1 ∪ B2) = f −1(B1) ∪ f −1(B2).
- f −1(B1 ∩ B2) = f −1(B1) ∩ f −1(B2).
- f(f −1(B)) ⊆ B.
- f −1(f(A)) ⊇ A.
These are valid for arbitrary subsets A, A1 and A2 of the domain and arbitrary subsets B, B1 and B2 of the codomain. The results relating images and preimages to the algebra of intersection and union work for any collections of subsets, not just for pairs of subsets.
[编辑] 单射、满射与双射函数
- 单射函数,将不同的变量映射到不同的值。即:若x和y属于定义域,则仅当x = y时有f(x) = f(y)。
- 满射函数,其值域即为其对映域。即:对映射f的对映域中之任意y,都存在至少一个x满足f(x) = y。
- 双射函数,既是单射的又是满射的。也叫一一对应。双射函数经常被用于表明集合X和Y是等势的,即有一样的基数。如果在两个集合之间可以建立一个一一对应,则说这两个集合等势。
[编辑] 函数例子
(详见函数列表.)
- 某一特定时刻在中国每一人口与其体重之关系「wght」。
- 每个国家与其首都之关系(若不把多首都国[1]计算在内)。
- 每个自然数 n 与其平方 n² 之关系「sqr」。
- 每个正实数 x 与其自然对数 ln x 之关系「ln」。注意,对于所有实数 x,ln 其实不是一个函数,因为并不是所有实数在 ln 里都有定义,即是 ln 不是完全 (total) 的。
- 每个在
平面上的点与其和原点 (0, 0) 的距离之关系「dist」 - 每个在
有孔平面 (Puntured plane) 上的点与描述该点受到原点发出的引力的矢量。
最常用的数学函数包括加法、减法、乘法、除法、冪、对数、根号、多项式、有理函数、三角函数等。它们统称为「初等函数」-- 但此名的定义会随使用的数学分支而改变。非初等函数(或特殊函数)包括 Bessel函数和伽傌函数。
[编辑] n-ary function: function of several variables
Functions in applications are often functions of several variables: the values they take depend on a number of different factors. From a mathematical point of view all the variables must be made explicit in order to have a functional relationship - no 'hidden' factors are allowed. Then again, from the mathematical point of view, there is no qualitative difference between functions of one and of several variables. A function of three real variables is just a function that applies to triples of real numbers. The following paragraph says this in more formal language.
If the domain of a function is a subset of the Cartesian product of n sets then the function is called an n-ary function. For example, the relation dist has the domain R × R and is therefore a binary function. In that case dist((x,y)) is simply written as dist(x,y).
Another name applied to some types of functions of several variables is operation. In abstract algebra, operators such as "*" are defined as binary functions; when we write a formula such as x*y in this context, we are implicitly invoking the function *(x,y), but writing it in a convenient infix notation.
An important theoretical paradigm, functional programming, takes the function concept as central. In that setting, the handling of functions of several variables becomes an operational matter, for which the lambda calculus provides the basic syntax. The composition of functions (see under composing functions immediately below) becomes a question of explicit forms of substitution, as used in the substitution rule of calculus. In particular, a formalism called currying can be used to reduce n-ary functions to functions of a single variable.
[编辑] 函数的复合
函数 f: X → Y 和g: Y → Z 可以“复合”。 首先演算 f(x),再将其结果f(x)作为g的自变量,最终的结果就是函数复合的结果。 这样得到函数解析失败 (未知错误): g<small>o</small>f:X→Z 。(g < small > o < / small > f)(x) = g(f(x))。 As an example, suppose that an airplane's height at time t is given by the function h(t) and that the oxygen concentration at height x is given by the function c(x). Then (c o h)(t) describes the oxygen concentration around the plane at time t.
If Y⊂X then f may compose with itself; this is sometimes denoted f 2. (Do not confuse it with the notation commonly seen in trigonometry.) The functional powers f of n = f n o f = f n+1 for natural n follow immediately. On their heels comes the idea of functional root; given f and n, find a g such that gn=f. (Feynman illustrated practical use of functional roots in one of his anecdotal books. <which?> Tasked with building an analogue arctan computer and finding its parts overstressed, he instead designed a machine for a functional root <fifth?> of arctan and chained enough copies to make the arctan machine.)
[编辑] Inverse function
If a function f:X→Y is bijective then preimages of any element y in the codomain Y is a singleton. A function taking y∈Y to its preimage f−1(y) is a well-defined function called the inverse of f and is denoted by f−1.
An example of an inverse function, for f(x) = x2, is f(x)−1 = √x. [Arggh!...you have to say what the domain is...if domain = R, this is false] Likewise, the inverse of 2x is x/2. The inverse function is the function that "undoes" its original. See also inverse image.
[编辑] Restrictions and extensions
Suppose that X is a subset of Y and that
is a function. Let
be the inclusion function
- i(x) = x
for
.
The restriction of f to X is then the function
. Intuitively, this is the same function as f except that we restrict the domain of f to X.
An extension of a function
is a function
defined on a superset Y of X such that f | X = g. Provided the domain of g is not the universal set, g always has lots of extensions.
[编辑] Pointwise operations
If f: X → R and g: X → R are functions with common domain X and codomain is a ring R, then one can define the sum function f + g: X → R and the product function f × g: X → R as follows:
- (f + g)(x) := f(x) + g(x);
- (f × g)(x) := f(x) × g(x);
for all x in X.
This turns the set of all such functions into a ring. The binary operations in that ring have as domain ordered pairs of functions, and as codomain functions. This is an example of climbing up in abstraction, to functions of more complex types.
By taking some other algebraic structure A in the place of R, we can turn the set of all functions from X to A into an algebraic structure of the same type in an analogous way.
[编辑] 可计算和不可计算函数
所有从整数到整数的可计算函数的个数是可数的,这是因为所有可能的算法个数是可数的。从整数 到整数的函数个数要更多些-和实数个数一样多,也就是说是等势的。这说明有些从整数到整数的函数是不可计算的。关于不可计算函数,请参看停机问题和莱斯定理。
[编辑] Functions from the category viewpoint
[In the context of category theory, a function is really an ordered triple (X, Y, f), where f is a "function" with domain X and codomain Y, i.e. the domain and codomain matter, if you change the codomain, e.g. it's considered a different function. This interpretation is based on looking at functions as morphisms in the category of sets.]
[编辑] 参见
[编辑] 外部连接
- Wolfram函数网站, 汇集了各数学函数的公式和图像
- xFunctions 一个多功能的Java小程序,可以显示函数的图像,既可以在线使用,也可以下载运行。









