v1 =
first order PDE , verification of one solution
Show older comments
Hello
the solution of the PDE:
df(x,y)/dx + df(x,y)/dy =0
should be f= f(x-y) , with f an arbitrary function of the argument which is the compound variable (x-y).
Wanting to verify this symbolic solution I would like to execute these commands
1) syms x y real
2) syms f(x-y)
and then do the calculation
3) ver=diff(f(x-y),x)+diff(f(x-y),y)
and simplifying it should give
ver=zero
but unfortunately on the second line it
gives me an error :
---------------------------------------------------------------------
Error using symfun.parseString (line 101)
Invalid variable name.
Error in syms (line 276)
[name, vars] = symfun.parseString(x,'allowPercent');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-----------------------------------------------------------------------
I was kindly asking
how to proceed and be able to do this
symbolic verification
thankyou very much !
Valerio
Answers (3)
syms x y real
syms f(x_minus_y)
v1 = diff(f(x-y),x)
v2 = diff(f(x-y),y)
ver = v1 + v2
simplify(ver)
Which is not zero.
I do not understand why you think it should be 0. Surely df(x,y)/dx + df(x,y)/dy = 0 is a condition, rather than a truism.
5 Comments
Val
on 23 Jun 2025
Val
on 23 Jun 2025
It looks like diff() is happening to create two different notations that are not immediately compatible. But substitute in any actual function and you can see that the two parts are negatives of each other.
syms x y real
syms f(x_minus_y)
F(x_minus_y) = tan(x_minus_y)^3 + exp(-x_minus_y)
v1 = diff(f(x-y),x); char(v1)
v2 = diff(f(x-y),y); char(v2)
simplify(v1 == -v2)
V1 = subs(v1, f, F)
V2 = subs(v2, f, F)
simplify(V1 == -V2)
Val
on 24 Jun 2025
Val
on 25 Jun 2025
You shouldn't waste your time here with symbolic manipulations.
What is important is that solutions f(x,y) of the PDE
df/dx + df/dy = 0
are constant on lines in the x-y-plane with slope equal to 1.
That means that f is not really a function of two variables, but it is already given by its values on e.g. the x- or the y-axis:
f(x,y) = f(x-y,0) = f(0,y-x)
More generally, f(x,y) as a function on IR^2 is fixed by its values on any line in the x-y-plane that has not a slope equal to 1.
The lines with slope equal to 1 are called the characteristics of the partial differential equation.
Val
on 24 Jun 2025
0 votes
1 Comment
Torsten
on 24 Jun 2025
I don't understand why you work with f(x-y). The solution of the differential equation
df/dx + df/dy = 0
is a function of two variables: f(x,y).
As I wrote in my answer, the thing you have to show is that f(x,y) = f(x-y,0) holds if f satisfies the partial differential equation.
Categories
Find more on Special Values in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

