How can I compute the integral of only the positive part of a Brownian motion process? I would like to compute $$\int_{\{W(t)>0\}}W(t) dW(t)$$ In the end I want the expectation of the above integral.
The probability that the process is below 0 in this interval is 0.5 from the reflection principle. In terms of step functions this seems to be something like only keep half of them but I don't really know how to translate that into a rigorous argument.
I haven't been able to find a similar example anywhere. Is it possible to compute this integral?
From simulating it in python it seems to look like this. I corrected the simulation, since I wasn't multiplying by dw in each step. Now it seems clear it is a martingale (thanks
Stratos supports the strike for pointing out that it's a martingale)
import numpy as np
import matplotlib.pyplot
# Set the parameters for the simulation
T = 1.0 # Total time
N = 1000 # Number of steps
dt = T / N # Time step size
M = 1000 # Number of realizations (simulations)
# Create an array to store the realizations
g_t_matrix = np.zeros((M, N + 1))
# Simulate M realizations of the stochastic process
for i in range(M):
# Generate a Wiener process realization: W(t) for each step
dw = np.random.normal(0, np.sqrt(dt), N + 1)
W_t = dw.cumsum()
# Apply the function g(t) to the Wiener process
g_t = np.maximum(0, W_t)
g_t_matrix[i] = g_t*dw
# Calculate the average of g(t) across all realizations
g_t_average = g_t_matrix.mean(axis=0)

Being a square-integrable martingale, its expectation is zero as pointed out by other users.
Going further, consider the function $f(x) = \frac{1}{2}\max\{0, x\}^2$. Although this is not a $C^2$-function, it can be verified that we can still apply Itô's lemma to obtain
\begin{align*} \mathrm{d}f(W_t) &= f'(W_t) \, \mathrm{d}W_t + \frac{1}{2}f''(W_t) \, \mathrm{d}t \\ &= \max\{0, W_t\} \, \mathrm{d}W_t + \frac{1}{2} \mathbf{1}[W_t \geq 0] \, \mathrm{d}t. \end{align*}
(For instance, we may apply Itô's Lemma to $f_{\epsilon}(x) = \frac{1}{4}x(x + \sqrt{x^2 + \epsilon^2})$ and then take limit as $\epsilon \to 0$.) Consequently, it follows that
$$ Y_T := \int_{0}^{T} \max\{0, W_t\} \, \mathrm{d}W_t = \frac{1}{2}\max\{0, W_T\}^2 - \frac{1}{2} \int_{0}^{T} \mathbf{1}[W_t \geq 0] \, \mathrm{d}t. $$
Below is the probability histogram of $10^5$ simulated samples of $Y_1$:
Here is a correct simulation using Python, correcting errors in OP's simulation:
And here is a simulation using Mathematica: