I am applying the Feynman-Kac theory for solving a PDE with boundary conditions.

For the SDE simulation I use the Euler-approximation, which introduces a time-step $h$ for the Brownian Motion, and since the PDE has some boundary conditions, we need to compute its hitting time $\tau$.

Numerically speaking, I start with $\tau = 0$ and increase it progressively.

So at each step:

- the process position is increased by a normal depending (also) on $h$ (the SDE);
- the variable $\tau$ is increased by some $k$;
- the hitting condition is checked.

My question is: is there a specific connection between $h$ and $k$? Below my reasoning.

*EDIT**: I am adding more details with the hope of expressing better my question.*

Consider the 1-dimensional heat on $[0,1]$, $u_t = u_{xx}$ with zero boundary conditions. So $u_0$ a known initial state, and $v(t,0)=v(t,1)=0$ for each time. Suppose we want to compute the solution at time $T=0.05$.

The stopping time to insert into Feynman-Kac expectation is:

$ \tau = \inf \{ k \geq 0 : T-k \leq 0,$ or $X_s\geq 1$, or $X_s \leq 0 \} $

where with $X_t$ solves $dX_t = \sqrt{2} {dB}_t$.

I approximate the SDE say with a time-step $h=0.01$, so if we start from $x \in [0,1]$ (point on which we are going to compute the PDE solution) and set $k=0$ (hitting time approximation), at every step we:

- move by adding a normal $N(0, 2h)$
- increase $k$ by $\sqrt{h}$

Again: when (1) goes to 0 or 1, or $T - k$ goes to 0, the hit is considered done.

Now, (1) works great: the process take its time for hitting the boundary. Conversely, since $\sqrt(0.01)=0.1$, $T - \sqrt{h} = 0.05-0.1 = -0.05$ so the boundary is immediately hit!

As a result, in the simulation the boundary is hit always after one step and I obtain just a small shift of my initial condition $u_0$.

If, conversely, in (2) I subtract something like $h^{1.8}$, rather than $\sqrt{h}$, the results are pretty nice...