Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my program, there are many functions relying on spatial coordinates: x, y, and z, which are also functions of time t, i.e., composite function. I need to differentiate some functions for example f:

    D[f[x[t], y[t], z[t]], t]

But because those coordinates appear so frequently, when I write x[t] instead of x my program becomes lengthy and lacks readability. So, how can I declare those coordinates as functions of time t at the start to tell Mathematica that the differentiation is relative to t, so I can use x, y , and z, afterwards as an abbreviation.

share|improve this question
You can use Dt as in Dt[f[x, y, z], t]. – b.gatessucks Feb 17 '13 at 9:59
Thanks, I tried Dt[x^2, t], and Mma returns 2xDt[x, t]. whereas I need 2xx' – novice Feb 17 '13 at 12:08
The difference between Dt[x, t] and x' is : I can assign value to x', but I cannot assign value to Dt[x, t]. – novice Feb 17 '13 at 12:39
@user5463 No, you cannot assign a value to x'. It only seems you do it. Please read this answer of mine where I explain the details. – halirutan Feb 17 '13 at 12:47
Thanks halirutan, I have a little problem with the result of differentiation when i'm using Runge–Kutta method. For example, D[x[t]^2, t] returns 2x[t]*x'[t], i have to replace x'[t] with dx by hand so that I can assign value to dx, is there a convenient way to handle it automatically? – novice Feb 17 '13 at 14:41

No one stops you from creating a variable holding your Sequence of x[t], y[t] and z[t]! So an easy short cut is

vars = Sequence[x[t], y[t], z[t]];
D[f[vars], t]

When you need to access the single variables, you could go another way and use the formal characters which have some advantages as described in this answer

x = \[FormalX][t];
y = \[FormalY][t];
z = \[FormalZ][t];
D[f[x, y, z], t]
share|improve this answer

Your added comment suggest you want to replace the derivatives with symbols like dx etc. Maybe this does what you want:

ClearAll[x, y, z]

SetOptions[D, NonConstants -> {x, y, z}];

x /: D[x, t, NonConstants -> {x, y, z}] := dx;
y /: D[y, t, NonConstants -> {x, y, z}] := dy;
z /: D[z, t, NonConstants -> {x, y, z}] := dz;

D[f[x, y, z], t]

dz*Derivative[0, 0, 1][f][x, y, z] + dy*Derivative[0, 1, 0][f][ x, y, z] + dx*Derivative[1, 0, 0][f][x, y, z]

To check that this does exactly what you said in the comments to your question:

D[x^2, t]

2 dx x

share|improve this answer
Thanks Jens! That's what i want. – novice Feb 18 '13 at 1:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.