first order PDE , verification of one solution

3 views (last 30 days)
Val
Val on 23 Jun 2025
Commented: Val on 25 Jun 2025
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)

Walter Roberson
Walter Roberson on 23 Jun 2025
syms x y real
syms f(x_minus_y)
v1 = diff(f(x-y),x)
v1 = 
v2 = diff(f(x-y),y)
v2 = 
ver = v1 + v2
ver = 
simplify(ver)
ans = 
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
Val on 24 Jun 2025
"It looks like diff() is happening to create two different notations that are not immediately compatible"
That is the point
I think that the right answer to the command:
v1 = diff(f(x-y),x)
should be
D(f)(x - y)
not "diff(f(x - y), x)" , which is a repetition of the command line.
Consider this workaround:
----------------------------------------
>> syms a positive
>> v1 = diff(f(a*x-y),x)
v1 =
a*D(f)(a*x - y)
>> v1=subs(v1,a,1)
v1 =
D(f)(x - y)
-----------------------------------------
that get the right form of the answer, so may immediately verify the solution f(x-y)...
...may be that is a bug to be fixed ?
Thankyou very much Mr Roberson for interest in this matter
Valerio
Val
Val on 25 Jun 2025
Dear Mr Roberson , let me have Your opinion
is a bug to be fixed ?
thankyou sincerely valerio

Sign in to comment.


Torsten
Torsten on 24 Jun 2025
Edited: Torsten on 24 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
Val on 24 Jun 2025
many thanks to all !!
anyway i think that the right answer to the command:
v1 = diff(f(x-y),x)
should be
D(f)(x - y)
not "diff(f(x - y), x)" , which is a repetition of the command line.
consider this workaround:
----------------------------------------
>> syms a positive
>> v1 = diff(f(a*x-y),x)
v1 =
a*D(f)(a*x - y)
>> v1=subs(v1,a,1)
v1 =
D(f)(x - y)
-----------------------------------------
that get the right form of the answer, so may verify the solution f(x-y)...
...may be that is a bug to be fixed ?
Thankyou very much for interest in this matter
kind regards Valerio (i hope i comment in the correct box)
  1 Comment
Torsten
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.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!