# Symbolic PDE manipulation

I'd like to transform a PDE in a way such that I can express a temporal derivative as a spatial derivative using some known relation.

Very simple example:

Assuming[{D[h[x, t], t] - D[h[x, t], x] == 0},
Solve[Integrate[D[h[x, t], t], x] + a[x, t] == 0, a[x, t]]]


This gives me as expected a nice answer: {{a[x, t] -> -h[x, t]}}.

However, if I change the assumtion slightly this does not work any longer:

Assuming[{D[h[x, t], t] + D[h[x, t], x] == 0},
Solve[Integrate[D[h[x, t], t], x] + a[x, t] == 0, a[x, t]]]


yields {{a[x,t]->-\[Integral](h^(0,1))[x,t]\[DifferentialD]x}}.

I have tried any kind of reformulation of the assumption which did not help. This is just a small example, my real assumptions are even more complicated. Any ideas?

• Solve[{D[h[x,t],t]+D[h[x,t],x]==0,Integrate[D[h[x,t],t],x]+a[x,t]==0},{a[x,t],D[h[x,t],t]}] works but I am not sure how helpful.robust this is fore more complicated equations/expressions.
– N0va
Commented May 8, 2022 at 15:57
• It even works for my complicated problem: This answer gave me a better understanding of the solve command. Thank you very much! Commented May 10, 2022 at 7:43
• Here is how it looks for my complicated expressions: consLaw1 = D[h[x, t], t] + D[m[x, t], x] == 0; consLaw2 = D[m[x, t], t] + D[m[x, t]^2/h[x, t] + g/2 h[x, t]^2, x] + g h[x, t] D[hb[x], x] == 0; Etotal[h, m] = 1/2 m[x, t]^2 /h[x, t] + 1/2 g h[x, t]^2 + g h[x, t] hb[x]; Find the energy balance: sol = Solve[{consLaw1, consLaw2, Integrate[D[Etotal[h, m], t], x] + a[x, t] == 0}, {a[x, t], D[h[x, t], t], D[m[x, t], t]}][[1]][[1]]; Answer: a[x, t] -> g (h[x, t] + hb[x]) m[x, t] + m[x, t]^3/(2 h[x, t]^2) Commented May 10, 2022 at 7:52

@N0va s comment answers the question: Solve[{D[h[x,t],t]+D[h[x,t],x]==0,Integrate[D[h[x,t],t],x]+a[x,t]==0},{a[x,t],D[h[x,t],t]}]  gives the expected result.