A few additional ways to use ReplaceAll
:
Dt[a x^2 + b y, x, Constants -> {a, b}] /. _Rule -> {}
Dt[a x^2 + b y, x, Constants -> {a, b}] /. HoldPattern[Constants -> _] -> {}
Dt[a x^2 + b y, x, Constants -> {a, b}] /. p : (Constants -> _) -> {}
and Replace
:
Replace[Dt[a x^2 + b y, x, Constants -> {a, b}], _Rule -> {}, All]
Replace[Dt[a x^2 + b y, x, Constants -> {a, b}], (Constants -> _) -> {}, All}]
Replace[Dt[a x^2 + b y, x, Constants -> {a, b}], p:(Constants -> _) -> {}, All}]
Replace[Dt[a x^2 + b y, x, Constants -> {a, b}], HoldPattern[Constants -> _] -> {}, All}]
and DeleteCases
:
DeleteCases[Dt[a x^2 + b y, x, Constants -> {a, b}], _Rule, All]
DeleteCases[Dt[a x^2 + b y, x, Constants -> {a, b}], Constants -> _, All]
DeleteCases[Dt[a x^2 + b y, x, Constants -> {a, b}], HoldPattern[Constants -> _], All]
all give
2 a x + b Dt[y, x]
Dt[a x^2 + b y, x, Constants -> {a, b}] /. HoldPattern[Dt[x__, y_]] :> Dt[x]
. I triedDt[a x^2 + b y, x, Constants -> {a, b}] /. (Constants -> {a, b}) -> Null
first, but strangely enough, if youTrace
the calculation,Dt[x, y, Null]
evaluates toDt[Dt[x, y]]
, which I don't understand. $\endgroup$