Message Boards Message Boards

0
|
7664 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to solve a second order PDE with DSolve?

Posted 9 years ago

Hello everybody,

I have not posted in a while but I am back at it with my little research. I have the following second order PDE that I am trying to solve analytically.

fbarx[\[Alpha]_, \[Beta]_, \[Mu]_, \[Sigma]_] = (-((\[Alpha] (t/\
\[Beta])^\[Alpha])/t)*f[t, x] + \[Mu]*D[f[t, x], x] + \[Sigma]^2/2*
     D[f[t, x], x, x]);  

sol[\[Alpha]_, \[Beta]_, \[Mu]_, \[Sigma]_] := 
  NDSolve[{D[f[t, x], t] == fbarx[\[Alpha], \[Beta], \[Mu], \[Sigma]],
     f[0, x] == 1, f[t, 0.001] == Exp[-1000 t], 
    f[t, 5] == Exp[-1000 t]}, f, {t, 0.01, 5}, {x, 0.001, 5}];

And I can plot the results.

Manipulate[
 Plot3D[Evaluate[
   f[t, x] /. sol8[\[Alpha], \[Beta], \[Mu], \[Sigma]]], {t, 0.01, 
   5}, {x, 0.001, 5}, PlotRange -> All, 
  AxesLabel -> Automatic], {\[Alpha], 0.1, 5}, {\[Beta], 0.1, 
  5}, {\[Mu], -1, 1}, {\[Sigma], -2, 2}]

But when I try to solve for the exact solution - I do not get any form of solution in the output. It is just a repeat of the input.

pde = D[f[x, t], 
   t] == -((\[Alpha] (t/\[Beta])^\[Alpha])/t)*f[x, t] + \[Mu]*
    D[f[x, t], x] + \[Sigma]^2/2*D[f[x, t], x, x]

DSolve[pde, f[x, t], {x, t}]

Even when I add the initial condition - same story.

DSolve[{pde, f[x, 0] == 1}, f[x, t], {x, t}]

This PDE is almost the same as the Black Scholes; therefore, I am certain it should have a closed form.

Any help would be very greatly appreciated. Thank you!

POSTED BY: Edvin Beqari
3 Replies
Posted 9 years ago

After trying some stuff out I got some interesting results. I would like to share with you.

(1) - Here is the main equation again:

DFQ := D[f[t, x], 
   t] == -((\[Alpha] (t/\[Beta])^\[Alpha])/t)*f[t, x] - \[Mu]*D[f[t, x], x] - \[Sigma]^2/2*D[f[t, x], x, x]

(2) - Take the Fourier Transform of each term:

In[63]:= FourierTransform[-((\[Alpha] (t/\[Beta])^(-1+\[Alpha]))/\[Beta])*f[x,t],x,\[Xi],FourierParameters->{0,-2 Pi}]
Out[63]= FourierTransform[-((\[Alpha] (t/\[Beta])^(-1+\[Alpha]) f[x,t])/\[Beta]),x,\[Xi],FourierParameters->{0,-2 \[Pi]}]

In[64]:= FourierTransform[-\[Mu]*D[f[t,x],x],x,\[Xi],FourierParameters->{0,-2 Pi}]
Out[64]= -2 I \[Pi] \[Mu] \[Xi] FourierTransform[f[t,x],x,\[Xi]]

In[65]:= FourierTransform[-(\[Sigma]^2/2)*D[f[t,x],x,x],x,\[Xi],FourierParameters->{0,-2 Pi}]
Out[65]= 2 \[Pi]^2 \[Xi]^2 \[Sigma]^2 FourierTransform[f[t,x],x,\[Xi]]

(3) - Solve as a regular ODE:

In[66]:= DSolve[y'[t]+(-((\[Alpha] ((t/\[Beta])^(-1+\[Alpha])) )/\[Beta])-2 I \[Pi] \[Mu] \[Xi]+2 \[Pi]^2 \[Xi]^2 \[Sigma]^2)*y[t]==0,y[t],t]
Out[66]= {{y[t]->E^((t/\[Beta])^\[Alpha]-2 \[Pi] t \[Xi] (-I \[Mu]+\[Pi] \[Xi] \[Sigma]^2)) C[1]}}

(4) - I do not know how to apply the IC correctly so assume C=1, and take the Inverse Fourier Transform:

In[67]:= InverseFourierTransform[E^((t/\[Beta])^\[Alpha]-2 \[Pi] t \[Xi] (-I \[Mu]+\[Pi] \[Xi] \[Sigma]^2)),\[Xi],x,FourierParameters->{0,-2 Pi}]
Out[67]= E^((t/\[Beta])^\[Alpha]-(x+t \[Mu])^2/(2 t \[Sigma]^2))/(Sqrt[2 \[Pi]] Sqrt[t \[Sigma]^2])
  • Which looks like it has the correct form.

(5) - I plug in values to check the LHS is equal to the RHS, in case this is a solution:

sl[x_,t_]:=E^((t/\[Beta])^\[Alpha]-(x+t \[Mu])^2/(2 t \[Sigma]^2))/(Sqrt[2 \[Pi]] Sqrt[t \[Sigma]^2])

In[55]:= (D[sl[x,t],t])/.{\[Alpha]->1,\[Beta]->5,\[Mu]->0.2,\[Sigma]->0.4,x->2,t->4}
Out[55]= 0.00177528

In[56]:= (-((\[Alpha] (t/\[Beta])^\[Alpha])/t)*sl[x,t]-\[Mu]*D[sl[x,t],x]-\[Sigma]^2/2*D[sl[x,t],x,x])/.{\[Alpha]->1,\[Beta]->5,\[Mu]->0.2,\[Sigma]->0.4,x->2,t->4}
Out[56]= -0.00177528
  • So somehow I am off by a negative sign (maybe). My suspicion is that it has to do with the initial condition but if C is a constant then it would flip the sign on both sides again.

  • When I plot the function sl[x,t] it has a very different shape than the one when I use NDSolve.

I have some issues with NDSolve but I will address that later but I would like to know how to extract some values from NDSolve so I can compare with the Analytical solution for a fixed set of values.

PS: Is there anything I can do to improve my post above? Is it possible to plot Manipulate graphs in here?

POSTED BY: Edvin Beqari
Posted 9 years ago

I understand - thank you for the explanation.

POSTED BY: Edvin Beqari

PDE's are solved numerically with the Method of Lines in Mathematica. Analytical solutions of PDE's are very difficult to solve algorithmically, which is why I suspect Wolfram hasn't ever released any module for it. So you can use NDSolve, but not Solve for PDE's

POSTED BY: Eric Smith
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