({{, (RefLink[Constant, paclet:ref/Constant])
is an attribute that indicates zero derivative of a symbol with respect to all parameters. }})

OpenersNotesSection(Spacer1)Details

(RefLink[Constant, paclet:ref/Constant]) is used by (RefLink[Dt, paclet:ref/Dt]).

Functions f[…] are taken to have zero total derivative if f has attribute (RefLink[Constant, paclet:ref/Constant]).

Mathematical constants such as (RefLink[Pi, paclet:ref/Pi]) have attribute (RefLink[Constant, paclet:ref/Constant]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

π is a mathematical constant representing a number:

Attributes[π]

π is not explicitly a number:

NumberQ[π]

π is numeric and evaluates to a number with (RefLink[N, paclet:ref/N]):

NumericQ[π]

N[π,32]

Define f to be a constant function for total derivatives computed with (RefLink[Dt, paclet:ref/Dt]):

SetAttributes[f,Constant]

Dt[g[x,y] f[x,y]]

OpenersExampleSection1(Spacer1)Scope  (2)

The built-in system mathematical constants:

constants=Map[ToExpression,Select[Names["System`*"],MemberQ[Attributes[#],Constant]&]]

They are all (RefLink[NumericQ, paclet:ref/NumericQ]):

Map[NumericQ,constants]

They all represent exact values that can be evaluated to numbers of any precision with (RefLink[N, paclet:ref/N]):

TableForm[Table[{c,N[c],N[c,24]},{c,constants}]]

Define f locally to be a constant function:

Block[{f},SetAttributes[f,Constant];Dt[g[f[x,y],x,y]]]

This does not affect subsequent computations with (RefLink[Dt, paclet:ref/Dt]):

Dt[g[f[x,y],x,y]]

Using the (RefLink[Constants, paclet:ref/Constants]) option in (RefLink[Dt, paclet:ref/Dt]) is similar, but has completely unambiguous output:

Dt[g[f[x,y],x,y],Constants->f]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Constants, paclet:ref/Constants])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Attributes, paclet:tutorial/Attributes])}, {▪(RefLinkPlain[Total Derivatives, paclet:tutorial/TotalDerivatives])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Attributes, paclet:guide/Attributes])}})}})