# What is a proper way to express derivatives with respect to a symbol? [duplicate]

Mathematica's default way of representing derivatives is to express them with respect to a function's input slot. But what if I want to use the chain rule? To replace df(x)/dx with df(0.5 y)/dy 0.5, where x=2y. What is the Mathematica way of doing this? Is the proper way using [esc] pd [esc] [Ctrl][-][x]?

I'm following a quantum mechanics lecture and trying to write down the math on the slides to Mathematica. I just can't figure out how to express the steps in Mathematica code. I'm really struggling with the first slide of https://www.youtube.com/watch?v=DDvnybFrVlE&index=21&list=PLoRUNeJAicqZ_qLKTrdbXvvg_WTtFK_Ds

Apparently, the first step in solving a differential equation is often a change of variables, which he proceeds to do on the first slide. He uses the chain rule to change the variable that psi is differentiated with respect to.

## marked as duplicate by xzczd, m_goldberg, Feyre, corey979, MarcoBNov 21 '16 at 14:39

• D[f[y/2], y]? It's not clear to me what code you're starting with and how you want to transform it. Well, that's what I'm assuming you want to do. – Michael E2 Nov 20 '16 at 18:03
• There's also f'[x] /. f -> (f[#/2] &), but it keeps x instead of substituting y. – Michael E2 Nov 20 '16 at 18:05
• Or are you merely asking how to input D via a shortcut, which is described in the first bullet point under "Details and Options" section of the docs for D? – Michael E2 Nov 20 '16 at 20:38

WL provides two basic ways to produce derivations: derivatives of functions w.r.t. slots (uinsg Derivative), and derivatives of expressions with respect to variables (using D). The shorthand you mention is for D, so just use it with an expression you are interested in, and the chain rule will be applied automatically. E.g.,
In[]:= Clear[f, g]; D[g[f[x]], x] /. {x -> x0}