SERVING THE QUANTITATIVE FINANCE COMMUNITY

• 1
• 2
• 3
• 4
• 5
• 11

Alan
Posts: 10263
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: About solving a transport equation

Let me just address 1. for now. I just followed the prescription in my Vol I book, pg 33. That is, the characteristics $\xi$ are the solutions to the ODE:

$\frac{d \xi}{dt} = b(\xi) \equiv (1 - \xi)^2$ for this problem, with $\xi(t=0) = y$.

Since the solutions $\xi(t)$ also depend upon y, write them finally as $\xi(y,t)$.

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

Here's what I did.

The original pde is

$\frac{\partial u}{\partial t} - (1-y)^2\frac{\partial u}{\partial y} = 0$ on the interval $(0,1)$ (1)

We now use the chain rule to say $du = 0$ which leads to a total derivative

$\frac {du}{dt} = \frac{\partial u}{\partial y} \frac {dy}{dt} +\frac{\partial u}{\partial t}$ (2)

A bit of elimination between (1) and (2) now gives

$\frac{\partial u}{\partial y} ( \frac{dy}{dt} + (1-y)^2) = 0$ (3)

from which we get the ODE for the characteristics

$\frac{dy}{dt} = - (1-y)^2)$ (4)

At this stage my analysis is tilt and I have reached the cliff edge I can't seem to reproduce $\xi$ and how it relates to $y$. And like Dustin Hoffman in Straw Dogs I get a minus instead of a plus.
Last edited by Cuchulainn on January 27th, 2020, 2:20 pm, edited 5 times in total.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Posts: 10263
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: About solving a transport equation

Well, there is the characteristic trajectory $Y_t (= \xi_t)$ and its initial condition $Y_0 = y$. I suspect your method confuses the two (backwards vs forward variables). Or, similarly, $t$ vs $\tau = T - t$. Just guessing. Maybe the discussion in my Vol. I pgs 31-33 will resolve it for you.

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

Well, there is the characteristic trajectory $Y_t (= \xi_t)$ and its initial condition $Y_0 = y$. I suspect your method confuses the two (backwards vs forward variables). Or, similarly, $t$ vs $\tau = T - t$. Just guessing. Maybe the discussion in my Vol. I pgs 31-33 will resolve it for you.
The reason for the minus sign is I suspect how we define t (the usual story $\tau = T - t$.)
I have just ordered Volume I.  I'll be back!

Given the solution. what can be said about it? e.g.on y = 0, y = 1, large t etc.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

I'll play a little. For 2, I get

$u(y,t) = f \left( \xi(y,t) \right)$ where the characteristic  $\xi(y,t) = \frac{y + t - t y}{1 + t - t y}$.
I have tested this solution against two FD schemes. Even with NT = 40, NY = 100 we get two digit accuracy and no oscillations. This for T = 1.
Now, for T = 20, my upwind scheme remains stable (no oscillation, monotonicity preserving? even for NT = 10 = NY), while the other (looks 'better'?) FD scheme starts producing wiggles.
X MOC exact solution X FDM solution
0 0.60653066 0 0.60652645
0.01 0.605008626 0.01 0.605000856
0.02 0.603475096 0.02 0.603468508
0.03 0.601929944 0.03 0.601911562
0.04 0.600373041 0.04 0.600357836
0.05 0.59880426 0.05 0.598790787
0.06 0.597223468 0.06 0.597224706
0.07 0.595630533 0.07 0.595627149
0.08 0.594025321 0.08 0.594023337
0.09 0.592407694 0.09 0.592390264
0.1 0.590777514 0.1 0.590765022
0.11 0.589134641 0.11 0.589117633
0.12 0.587478932 0.12 0.58748065
0.13 0.585810244 0.13 0.58580597
0.14 0.584128428 0.14 0.584130516
0.15 0.582433338 0.15 0.5824128
0.16 0.580724823 0.16 0.580715161
0.17 0.579002729 0.17 0.578987106
0.18 0.577266903 0.18 0.577278032
0.19 0.575517186 0.19 0.575507704
0.2 0.573753421 0.2 0.573750395
0.21 0.571975444 0.21 0.571946626
0.22 0.570183094 0.22 0.570191144
0.23 0.568376202 0.23 0.56836849
0.24 0.566554602 0.24 0.566564323
0.25 0.564718122 0.25 0.564681561
0.26 0.562866589 0.26 0.56287718
0.27 0.560999827 0.27 0.560988031
0.28 0.559117658 0.28 0.559135234
0.29 0.557219901 0.29 0.557171095
0.3 0.555306373 0.3 0.555336984
0.31 0.553376888 0.31 0.553353777
0.32 0.551431257 0.32 0.551445391
0.33 0.549469289 0.33 0.549417659
0.34 0.54749079 0.34 0.547561518
0.35 0.545495564 0.35 0.545404514
0.36 0.54348341 0.36 0.543553212
0.37 0.541454126 0.37 0.54139718
0.38 0.539407507 0.38 0.5394335
0.39 0.537343345 0.39 0.537323574
0.4 0.535261429 0.4 0.53526374
0.41 0.533161543 0.41 0.533154772
0.42 0.531043472 0.42 0.531040224
0.43 0.528906995 0.43 0.528902741
0.44 0.526751889 0.44 0.52674808
0.45 0.524577926 0.45 0.524574144
0.46 0.522384878 0.46 0.522381229
0.47 0.520172511 0.47 0.52016897
0.48 0.517940589 0.48 0.517937159
0.49 0.515688872 0.49 0.515685553
0.5 0.513417119 0.5 0.513413908
0.51 0.511125082 0.51 0.511121978
0.52 0.508812512 0.52 0.508809514
0.53 0.506479156 0.53 0.506476263
0.54 0.504124757 0.54 0.504121968
0.55 0.501749056 0.55 0.501746369
0.56 0.499351789 0.56 0.499349202
0.57 0.496932688 0.57 0.496930201
0.58 0.494491483 0.58 0.494489094
0.59 0.492027899 0.59 0.492025608
0.6 0.48954166 0.6 0.489539463
0.61 0.487032482 0.61 0.48703038
0.62 0.484500081 0.62 0.484498071
0.63 0.481944167 0.63 0.481942249
0.64 0.479364449 0.64 0.47936262
0.65 0.476760629 0.65 0.476758888
0.66 0.474132407 0.66 0.474130753
0.67 0.47147948 0.67 0.47147791
0.68 0.468801539 0.68 0.468800053
0.69 0.466098274 0.69 0.466096869
0.7 0.463369369 0.7 0.463368044
0.71 0.460614506 0.71 0.460613258
0.72 0.457833362 0.72 0.45783219
0.73 0.45502561 0.73 0.455024513
0.74 0.452190922 0.74 0.452189897
0.75 0.449328964 0.75 0.449328009
0.76 0.446439399 0.76 0.446438512
0.77 0.443521886 0.77 0.443521066
0.78 0.440576082 0.78 0.440575326
0.79 0.43760164 0.79 0.437600945
0.8 0.434598209 0.8 0.434597574
0.81 0.431565435 0.81 0.431564858
0.82 0.428502963 0.82 0.428502441
0.83 0.425410432 0.83 0.425409963
0.84 0.42228748 0.84 0.422287061
0.85 0.419133742 0.85 0.419133371
0.86 0.41594885 0.86 0.415948525
0.87 0.412732435 0.87 0.412732153
0.88 0.409484125 0.88 0.409483882
0.89 0.406203546 0.89 0.40620334
0.9 0.402890322 0.9 0.40289015
0.91 0.399544076 0.91 0.399543936
0.92 0.39616443 0.92 0.396164319
0.93 0.392751006 0.93 0.392750921
0.94 0.389303425 0.94 0.389303362
0.95 0.385821307 0.95 0.385821262
0.96 0.382304273 0.96 0.382304244
0.97 0.378751945 0.97 0.378751929
0.98 0.375163947 0.98 0.37516394
0.99 0.371539903 0.99 0.371539901
1 0.367879441 1 0.367879441


Last edited by Cuchulainn on January 29th, 2020, 3:27 pm, edited 1 time in total.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

double f(double y)
{ // Initial conditions

return std::exp(-y);
}
T = 20, NY = NT = 10 using upwind

X MOC exact solution X FDM solution
0 0.385821307 0 0.379587712
0.1 0.385724622 0.1 0.37945997
0.2 0.385605221 0.2 0.379304392
0.3 0.385454033 0.3 0.379110744
0.4 0.385256415 0.4 0.378863056
0.5 0.384987099 0.5 0.378534937
0.6 0.384598419 0.6 0.37807938
0.7 0.38398843 0.7 0.37740359
0.8 0.382892886 0.8 0.376294661
0.9 0.380348757 0.9 0.374128127
1 0.367879441 1 0.367879441
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Posts: 10263
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: About solving a transport equation

Just thinking out loud, since the solution to these types of PDE's is always given by $u(y,t) = f(\xi(y,t))$, I wonder if the best numerical approach might be to just solve the ODE for $\xi$ numerically and plug it in?  This would be a nice dimensional reduction.

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

Just thinking out loud, since the solution to these types of PDE's is always given by $u(y,t) = f(\xi(y,t))$, I wonder if the best numerical approach might be to just solve the ODE for $\xi$ numerically and plug it in?  This would be a nice dimensional reduction.
That's worth a think about and have not seen any one doing this (except Jim Douglas Jr., one of the founders of ADI) So, in our Anchor/Asian/Cheyette pde it would entail solving the part

$\frac{\partial V}{\partial t} = \lambda(S-A)\frac{\partial V}{\partial A}$

by your ODE, but I think it would have to be solved numerically(?), which should not be a big deal. The nitty gritty part would inserting the ODE logic into the full Anchor model and bolting down all the pieces at the boundaries.

Now, we can choose several avenues, e.g. Strang-Marchuk operator splitting

leg1 : ODE
leg2 : BS PDE
leg3: ODE

or even traditional ADI which can't be worse than the self-flagellation going on here

https://forum.wilmott.com/viewtopic.php?f=34&t=100474
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Posts: 10263
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: About solving a transport equation

Well, you've jumped to a more difficult problem. I was referring to the type of problem posted for $u(y,t)$.

Or, more generally, the method should work for

$u_t = b(y) u_y - c(y) u + k(y,t)$ with $u(y,0) = f(y)$.
Last edited by Alan on January 28th, 2020, 3:56 pm, edited 2 times in total.

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

Well, you've jumped to a more difficult problem. I was referring to the type of problem posted for $u(y,t)$.

Or, more generally, the method should work for

$u_t = b(y) u_y - c(y) u + k(y,t)$ with $u(y,0) = f(y)$.
That would be very useful because x% of fdm is not perfect for this pde.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Alan
Posts: 10263
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

### Re: About solving a transport equation

Thinking some more, maybe even an ODE solver is overkill for numerics here.
All you really have to solve is

(*) $\int_y^{\xi(t)} \frac{dx}{b(x)} = t$, which implicitly determines $\xi(t) = \xi(y,t)$.

So, now it's reduced to just a root-finding exercise. For a given $(y,t)$ pair, solve (*) numerically for the root $\xi$, plug into $f(\cdot)$, and you're done (for the original class of problem you posted). For the more general one, $u_t = b(y) u_y - c(y) u + k(y,t)$, again you just solve (*), and then plug into the expression at the bottom of pg 33 that you'll see when my book arrives.

Paul
Posts: 10789
Joined: July 20th, 2001, 3:28 pm

### Re: About solving a transport equation

First of all, what is the 1 doing in there? Get rid of that asap. Then z=1/y.

Cuchulainn
Posts: 62582
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: About solving a transport equation

First of all, what is the 1 doing in there? Get rid of that asap. Then z=1/y.
Alan, I think it's for you.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Paul
Posts: 10789
Joined: July 20th, 2001, 3:28 pm

### Re: About solving a transport equation

I’m referring to the pde.

$z=\frac{1}{y-1}$