主題
Search

分段函式


分段函式是在一系列區間上定義的函式。一個常見的例子是絕對值

 |x|={-x   for x<0; 0   for x=0; x   for x>0.
(1)

分段函式在 Wolfram 語言 中實現為Piecewise[{{val1, cond1}, {val2, cond2}, ...}].

其他分段函式包括 Heaviside 階躍函式矩形函式三角形函式

分號和逗號有時用於左列或右列的末尾,具體的用法顯然取決於作者。“if”和“for”這兩個詞有時用於右列,而“otherwise”用於最後的(預設)情況。

例如,Knuth(1996,第 175 頁和 180 頁)使用了以下符號

|x|={x, if x>=0;; -x, otherwise;
(2)
f(x)={1/3 if 0<=x<=1;; 2/3 if 3<=x<=4;; 0 elsewhere
(3)
x_(2m)={Q(X_m^2-P_2W_m^2)-2S^2 (m odd); P_2^2(X_m^2-P_2W_m^2)-2S^2 (m even)
(4)

左列帶逗號和不帶逗號的都有。同樣,Arfken(1985,第 488-489 頁)使用了

 delta_n(x)={0,   x<-1/(2n); n,   -1/(2n)<x<1/(2n),; 0,   1/(2n)<x 
delta_n(x)={0,   x<0; ne^(-nx),   x>0 
lim_(a->infty)2/piint_(x_1)^(x_2)f(u+x)(sin(ax))/xdx 
 ={f(u+0)+f(u-0),   x_1<0<x_2; f(u+0),   x_1=0<x_2; f(u-0),   x_1<0=x_2; 0   x_1<x_2<0 or 0<x_1<x_2,
(5)

其中缺少分號,但有時也缺少右列逗號。

在這項工作中,使用逗號和分號。


另請參閱

Heaviside 階躍函式, Iverson 括號, 分段常數函式, 分段線性函式

使用 探索

參考文獻

Arfken, G. Mathematical Methods for Physicists, 3rd ed. Orlando, FL: Academic Press, 1985.Knuth, D. E. The TEXBook. Boston, MA: Addison-Wesley, 1996. Rytin, M. "Integration of Piecewise Functions with Applications." http://library/infocenter/MathSource/5117.

在 上被引用

分段函式

請引用為

Weisstein, Eric W. "Piecewise Function." 來自 —— 資源。 https://mathworld.tw/PiecewiseFunction.html

主題分類