Solving an initial value problem for a PDE

Having the following initial value problem
with some mathematical computations we reach to an end that an implicit general solution of this pde can have the following form
if we had phi=e^(-x^2) for example,
I have been able to solve a similar problem to this but the genral solution was only a function of x and t, but here we have also u, so how can we possibly do that.

Answers (1)

Torsten
Torsten on 26 Apr 2022
Edited: Torsten on 26 Apr 2022
The method of characteristics gives the equations
dt/ds = 1, t(0) = 0
dx/ds = u, x(0) = x0
du/ds = 0, u(0) = phi(x0)
with solution
x = x0 + phi(x0) * t
Thus to get the solution u(x,t) in (x,t), you will have to solve
x - x0 - phi(x0)*t = 0
for x0.
The solution u(x,t) in (x,t) is then given by u(x,t) = phi(x0).

6 Comments

Thank you for the quick reply, when solving this out I have got x0 to be a function of u, i.e, x0=x-ut, so my confussion is how can we implement x0 when it is a function of u? or is my understanding to the problem is wrong?
Torsten
Torsten on 26 Apr 2022
Edited: Torsten on 26 Apr 2022
x0 depends on x, t and phi, and all three are known.
would the following lines be a correct implementationt o the problem's solution ?
x=linspace(-10,10,41)';
t=linspace(0,1,41)';
[x,t] = meshgrid(x,t);
x0=x-exp(-x.^2).*t;
u= exp(-x0.^2) ;
s=surf (x,t,u,'FaceAlpha','1');
s.FaceColor = 'texturemap';
xlabel('x'),ylabel('t'),zlabel('u')
view(-40,25)
x0=x-exp(-x0.^2).*t;
instead of
x0=x-exp(-x.^2).*t;
Thus for each (x,t) combination, you have to iterate to get the correct x0 value.
but this will result in the follwong error
Arrays have incompatible sizes for this operation.
Error in gradproject (line 28)
x0=x-exp(-x0.^2).*t;
You can't set
x0 = x - exp(-x0.^2).*t
For each pair (x(i),t(j)) of your linspace, you have to find x0 (if it exists) for that
x0-x(i)+exp(-x0.^2)*t(j) = 0.
Use "fzero" to do that in a double loop over i and j.

Sign in to comment.

Asked:

on 26 Apr 2022

Edited:

on 26 Apr 2022

Community Treasure Hunt

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

Start Hunting!