DownValues[f]
gives a list of transformation rules corresponding to all downvalues (values for f[…]) defined for the symbol f.
DownValues["symbol"]
gives a list of transformation rules corresponding to all downvalues defined for the symbol named "symbol" if it exists.
DownValues
DownValues[f]
gives a list of transformation rules corresponding to all downvalues (values for f[…]) defined for the symbol f.
DownValues["symbol"]
gives a list of transformation rules corresponding to all downvalues defined for the symbol named "symbol" if it exists.
Details and Options
- You can specify the downvalues for f by making an assignment of the form DownValues[f]=list.
- The list returned by DownValues has elements of the form HoldPattern[lhs]:>rhs.
Examples
open all close allBasic Examples (1)
Scope (3)
DownValues returns rules corresponding to definitions made for a symbol:
f[x_] := x ^ 2DownValues[f]f[x_] := x
g[x_] := x ^ 2
fg[x_] := f[g[x]]Obtain the downvalues of functions whose names start with f:
DownValues /@ Names["f*"]DownValues can be used to set the values directly:
DownValues[g] = {HoldPattern[g[1]] :> 1, HoldPattern[g[x_]] :> 2g[x - 1]};Definition[g]g[5]Applications (2)
The resulting rules are in the order given:
f[x_ /; x > -2] := g1[x]
f[x_ /; x < 2] := g2[x]DownValues[f]f[0]DownValues[f] = Reverse[DownValues[f]]f[0]Copy a symbol's definitions to another symbol:
f[1] = 1;
f[x_] := 2f[x - 1]DownValues[g] = DownValues[f] /. f -> gg[10]% == f[10]Properties & Relations (5)
Values can be defined by immediate or delayed assignments:
f[1] = 1;
f[n_] := n * f[n - 1]DownValues[f]HoldPattern is used to protect the rules from their own definitions:
f[x_] := x ^ 2DownValues[f]Without the HoldPattern, the left-hand side would have evaluated:
f[x_] :> x ^ 2DownValues["sym"] will issue a message if the specified symbol does not exist:
DownValues["f"]If the symbol exists but has no definitions, an empty list is returned:
f;
DownValues["f"]Definition and Information display downvalues but do not return them as values:
f[x_] := x ^ 3Definition[f]%//FullFormDownValues returns a value that can be used in a program:
DownValues[f]Evaluation of an expression involves applying rules for its head:
f[x_] := x ^ 3Hold[f[2]] /. DownValues[f]See Also
Set SetDelayed SubValues UpValues OwnValues Information ValueQ Clear ClearAll Save DownValuesFunction
Function Repository: DefinedSymbols ExtractDownValues SymbolDependencies WithCachedValues
Tech Notes
Related Guides
History
Introduced in 1991 (2.0) | Updated in 1996 (3.0) ▪ 2022 (13.2)
Text
Wolfram Research (1991), DownValues, Wolfram Language function, https://reference.wolfram.com/language/ref/DownValues.html (updated 2022).
CMS
Wolfram Language. 1991. "DownValues." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/DownValues.html.
APA
Wolfram Language. (1991). DownValues. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DownValues.html
BibTeX
@misc{reference.wolfram_2026_downvalues, author="Wolfram Research", title="{DownValues}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DownValues.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_downvalues, organization={Wolfram Research}, title={DownValues}, year={2022}, url={https://reference.wolfram.com/language/ref/DownValues.html}, note=[Accessed: 13-June-2026]}