Differences
✖
Differences
Details

- Differences[list] is equivalent to ListConvolve[{1,-1},list].
- If list has length l, Differences[list,n] has length l-n. »
- If list has length l, Differences[list,n,s] has length l-ns.
- Differences[m,{1,0}] or Differences[m,1] finds the successive differences of rows in a 2D array or matrix m. Differences[m,{0,1}] finds the differences of columns.
- Differences[list,{n1,n2}] is equivalent to Differences[Differences[list,n1],{0,n2}].
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (3)Survey of the scope of standard use cases
Differences of rows, within each column:

https://wolfram.com/xid/0wgnmae-ioa


https://wolfram.com/xid/0wgnmae-iqt

Differences of columns, within each row:

https://wolfram.com/xid/0wgnmae-wkr

Differences of a regularly sampled TimeSeries:

https://wolfram.com/xid/0wgnmae-dpzqd7


https://wolfram.com/xid/0wgnmae-u5aaho


https://wolfram.com/xid/0wgnmae-ei2yz9


https://wolfram.com/xid/0wgnmae-dzr1nz

Compare to differencing the values:

https://wolfram.com/xid/0wgnmae-bzdxai

Applications (3)Sample problems that can be solved with this function
Deduce the degree of a sequence by seeing when successive differences become constant:

https://wolfram.com/xid/0wgnmae-ktn


https://wolfram.com/xid/0wgnmae-mb1

Finite difference approximation to the Laplacian of a Gaussian:

https://wolfram.com/xid/0wgnmae-ktb

https://wolfram.com/xid/0wgnmae-rlv


https://wolfram.com/xid/0wgnmae-kp47u3


https://wolfram.com/xid/0wgnmae-yoz18c

Find the daily differences between stock values at close:

https://wolfram.com/xid/0wgnmae-5n9yxs


https://wolfram.com/xid/0wgnmae-fmmk82

Find the proportion of days with increase in price at close:

https://wolfram.com/xid/0wgnmae-ueg4y3


https://wolfram.com/xid/0wgnmae-or46di

Properties & Relations (4)Properties of the function, and connections to other functions
First differences are constant for a linear function:

https://wolfram.com/xid/0wgnmae-efw


https://wolfram.com/xid/0wgnmae-iyi

Second differences are constant for a quadratic function:

https://wolfram.com/xid/0wgnmae-ffn


https://wolfram.com/xid/0wgnmae-cfu


https://wolfram.com/xid/0wgnmae-rj5

Successive differences are progressively shorter:

https://wolfram.com/xid/0wgnmae-ps2

FoldList acts as an inverse of Differences:

https://wolfram.com/xid/0wgnmae-hz4


https://wolfram.com/xid/0wgnmae-wk1

Possible Issues (1)Common pitfalls and unexpected behavior
Differences of an irregularly sampled TimeSeries may differ from differences of the values:

https://wolfram.com/xid/0wgnmae-8sxf1b


https://wolfram.com/xid/0wgnmae-o8ont5


https://wolfram.com/xid/0wgnmae-my7jth


https://wolfram.com/xid/0wgnmae-9fmzv3

Compare with Differences of the values:

https://wolfram.com/xid/0wgnmae-b8ayt4

Set TemporalRegularity to True and compute differences of the new time series:

https://wolfram.com/xid/0wgnmae-4g7lf0

https://wolfram.com/xid/0wgnmae-75nm6o
Now the value differences agree:

https://wolfram.com/xid/0wgnmae-nvoyti

Wolfram Research (2007), Differences, Wolfram Language function, https://reference.wolfram.com/language/ref/Differences.html (updated 2012).
Text
Wolfram Research (2007), Differences, Wolfram Language function, https://reference.wolfram.com/language/ref/Differences.html (updated 2012).
Wolfram Research (2007), Differences, Wolfram Language function, https://reference.wolfram.com/language/ref/Differences.html (updated 2012).
CMS
Wolfram Language. 2007. "Differences." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/Differences.html.
Wolfram Language. 2007. "Differences." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/Differences.html.
APA
Wolfram Language. (2007). Differences. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Differences.html
Wolfram Language. (2007). Differences. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Differences.html
BibTeX
@misc{reference.wolfram_2025_differences, author="Wolfram Research", title="{Differences}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/Differences.html}", note=[Accessed: 19-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_differences, organization={Wolfram Research}, title={Differences}, year={2012}, url={https://reference.wolfram.com/language/ref/Differences.html}, note=[Accessed: 19-May-2025
]}