Message Boards Message Boards

0
|
16361 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Change of variables in partial derivatives

Dear Mathematica team:

I am trying witout success to make a change of variables in a partial derivative of a function of 2 variables (for example the time coordinate "t" and the lenght coordinate "z"), like

fu:= f[t,z]
dfu:= D[fu,{{t,z}}]

Then I want to rescale the t and z coordinates (something that is useful for example to simplify equations in fluid mechanics), defining the new variables: z0=z/L; t0= t*u/L

z0:=z/L
t0:= t*u/L

Putting all together:

{t0,z0}:={t*u/L,z/L}
fu:= f[t0,z0]
dfu:= D[fu,{{t0,z0}}]

Unfortunately, this substitution does not work because I am actually differentiating with respect to functions of the original t and z variables, so the program send and error message like: "z/L is not a valid variable"

After some reading of calculus textbooks, I found that I need to apply the chain rule. The problem with this is twofold:

1) The formulae are a bit messy, like these in the Wilfred Kaplan (2002) textbook: enter image description here

enter image description here

enter image description here

Those formulae have either explicit sums or products of Jacobian matrices, and while constructing Jacobians from substitution rules (like the reascaling ones above) is rather easy, I still don't undestand how to implement the full formulae in Mathematica.

I would greatly appreciate you help.

Nota bene: maybe someone else posted something similar before (my apologies if it is the case) , I just don't know yet how to seach by keywords in the forum.

5 Replies

Setting up the derivative as an anonymous function might help.

newD = D[#, {{t, z}}] &;
newD@f[t u/L , z/L]
(*{(u*Derivative[1,0][f][(t*u)/L,z/L])/L,Derivative[0,1][f][(t*u)/L,z/\
L]/L}*)
POSTED BY: Tim Laska

It seems that my old code still works so you can do:

DChange[ D[f[t, z], {{t, z}}],  {z0 == z/L, t0 == t u /L}, {t, z}, {z0, t0}, f[t, z]]
{(u (f^(0,1))[z0,t0])/L,(f^(1,0))[z0,t0]/L}

You can read how to install DChange and use it from: Analogue for Maple's dchange - change of variables in differential expressions

POSTED BY: Kuba Podkalicki

Maybe this helps

Regards M.I.

POSTED BY: Mariusz Iwaniuk

Dear users Tim Laska and Kuba Podkalicki:

Thank you for your answers. Now, a few comments:

1) Tim Laska suggestion works very fine for rescaling transformations, but I'm not sure if it is enough for "mixed variables" transformations like:

          t0 = t - x/u ( t0, t = time, x = lenght, u = velocity)

As the new time coordinate (useful for example to simplify some wave equations) mixes the "original" x and t coordinates.

2) The function DChange of Kuba Podkalicki looks just like what I was looking for, but I'm afraid of some software compatibility issues if I download the package. Could it cause some problems/damage to the original Mathematica language, specially for newer versions like Mathematica 12 (not to mention future versions in coming years)?

This package ("MoreCalculus`") is a very simple one, it only introduces DChange function and there is not built-in DChange symbol so you don't need to worry about it.

Will there ever be a built-in DChange symbol? Who knows, maybe, maybe not, I suppose WRI will pick a better name for such a function.

POSTED BY: Kuba Podkalicki
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract