# Geometric Brownian motion with volatility as function of time

With the following process: $$dS_t = r S_t dt + σ(t) St dW_t \tag1$$

and

$$\sigma (t) = 0.1 \ \ \ if \ \ t < 0.5 \\ \sigma (t) = 0.21 \ \ \ otherwise$$

I know the general solution should be : $$S_t = S_0 e^{rt − \frac{1}{2} \int_0^t \sigma (s)^2 ds +\int_0^t \sigma (s) dW_s} \tag2$$

and if $$log(S_t) = Z_t$$

$$Z_t = Z_0 + rt − \frac{1}{2} \int_0^t \sigma (s)^2 ds +\int_0^t \sigma (s) dW_s \tag3$$

My question is how to treat the integration if $$t \geq 0.5$$? I think I need to split the integration but I am not sure how to compute the integration in the half open interval $$t \in [0, 0.5)$$. Should the upper bond of the integral for $$t \in [0, 0.5)$$ be treated as a number with a limit approaching 5?

For computational simulation on discrete time, I know if the volatility is a constant, I can use (4) below for simulation in discrete time. ($$\delta W_s$$ is just normal distribution of variance $$\delta t$$) $$Z_{t+\delta t} = Z_t + (rt − \frac{1}{2} \sigma )\delta t +\sigma \delta W_s \tag4$$ However, I am not sure how to simulate (1) especially when the time progresses from $$t < 0.5$$ to $$t > 0.5$$

For your first question, for a sufficiently nicely-behaved function $$f$$ (which $$\sigma(t)$$ is), $$\int_a^bf(x)dx = \int_a^cf(x)dx + \int_c^bf(x)dx$$.
If I'm understanding your question correctly, it looks like you might be concerned we are "double counting" $$\sigma(0.5)$$ if we do this, but this is not the case a the set $$\{0.5\}$$ has measure zero -- intuitively, a set containing one point is so small that we can change it to whatever without affecting the integral.
To tie this back more directly to what you were asking, this means that for $$\sigma(t)$$, the integral over $$[0, 0.5)$$ is the same as the integral over $$[0, 0.5]$$.
For your second question, I would do something similar to (4) -- just use a different volatility if $$t>=0.5$$ vs $$t < 0.5$$. I would also probably take care to ensure that one of my timesteps begins at $$t=0.5$$, but for a sufficiently fine discretization, it doesn't matter too much.