# Notation for implicit derivative

Consider the following line of code:

D[x == y^3 + x y, x, NonConstants -> y]


The output would be:

1 == y + x D[y, x, NonConstants -> {y}] + 3 y^2 D[y, x, NonConstants -> {y}]


This is a confusing and cumbersome notation for the more natural:

1 == y + x y' + 3y^2 y'


I am trying to use the Notation package to help me replace the messy, default, output with the more natural one.
I have not succeeded.

Of-course I have read this Q. The answer, if relevant, seems inaccessible to me, unfortunately.
Any help would be appreciated.

-
Related or a duplicate: How to make traditional output for derivatives. Otherwise you should improve your question to make it clearer. – Artes Oct 8 '13 at 20:03
@artes: I don't see how I can change the display/notation of an implicit derivative using the answers supplied. Can you? – Trevor Oct 8 '13 at 21:20
expr /. D[y, x, NonConstants -> {y}] :> y'[x] yields 1 == y + x y'[x] + 3 y^2 y'[x]. – Artes Oct 11 '13 at 21:55
@Artes, thanks for the reply. Is there a way to make such a change permanent? As it is, it seems I need to post-fix each expression with your addition. – Trevor Oct 11 '13 at 22:10
I'm not sure what you are asking but I guess if you have more equations you can do it once e.g. { l1==r1, l2==r2,..., ln==rn} /. D[y, x, NonConstants -> {y}] :> y'[x]. – Artes Oct 11 '13 at 22:29

Based on the comments above I believe you are merely looking for a way to automate Artes' replacement. Using $PrePrint: $PrePrint = # /. {D[y_, x_, NonConstants -> {y_}] :> y'[x]} &;


Now:

D[x == y^3 + x y, x, NonConstants -> y]

1 == y + x y'[x] + 3 y^2 y'[x]


You could also use $Post or Format or MakeBoxes depending on your specific needs. Using MakeBoxes is usually robust and does not tie up $Post or \$PrePrint.

MakeBoxes[D[y_, x_, NonConstants -> {y_}], fmt_] := ToBoxes[y'[x], fmt]

-
@Wizard Thanks. Just what I was looking for :) – Trevor Oct 18 '13 at 10:37

I would consider using Dt:

Dt[x == y^3 + x y, x]
(* 1 == y + x Dt[y, x] + 3 y^2 Dt[y, x] *)


You can specify literal constants with SetAttributes:

ClearAll[a];
SetAttributes[a, Constant];
Dt[(x^2 + y^2)^2 == a^2 x y, x]
(* 2 (x^2 + y^2) (2 x + 2 y Dt[y, x]) == a^2 y + a^2 x Dt[y, x] *)


If x and y might become dependent variables, then omit the second argument and you get:

de = Dt[(x^2 + y^2)^2 == a^2 x y]
(* 2 (x^2 + y^2) (2 x Dt[x] + 2 y Dt[y]) == a^2 y Dt[x] + a^2 x Dt[y] *)


You can turn y into an explicit function of x:

de /. y -> y[x]
(* 2 (x^2 + y[x]^2) (2 x Dt[x] + 2 Dt[x] y[x] y'[x]) == a^2 Dt[x] y[x] + a^2 x Dt[x] y'[x] *)


If you want to turn x into the dependent variable, you can replace Dt[x] by 1:

de /. y -> y[x] /. Dt[x] -> 1
(* 2 (x^2 + y[x]^2) (2 x + 2 y[x] y'[x]) == a^2 y[x] + a^2 x y'[x] *)

-