# Hull White help needed

I've been trying to calibrate Hull-White 1 Factor & 2 Factor model using Caps but I've some major doubts about my methodology, and would really appreciate some help.

I am using these formulas

For getting the instantaneous forward rates needed in theta formula i used the central difference method for getting the derivatives at the discrete time intervals t

(from excel data.....assumed P(t,T)= math.exp(r*t))

1) In the A formula for P(t,T) which formula should we use? e^-rt or the Ae^-B*r(t)...If I have to use the latter one, what should I take r? the same r value i used initially for calculating DFs? or the r(t) analytical formula after the Hull White calibration? (I calibrated a,sigma value using sum squared min error with implied caplet values from formula given above and market values that i had)

2) After the calibration step, how do i get the r(t) values? i have to use monte carlo simulation

Thank you once again for your time, I am completely new to this field & would appreciate a helping hand. or the

On the formula of the zero bond: The representation of the zero bond with r involves an integral and even worse, an expectation ($$P(t,T) = E( exp(-\int_t^T r(\tau) d\tau )$$). The core advantage of the HW Model is that you have an analytic formula for P in terms of A and B. So you would use that formula. Note that the paper mentioned above also gives the correct values for A and B under the simulation scheme. Its an advantage to have the correct analytic formula under the simulated model instead of using the formula derived from the continuous time SDE, but being in a discretised setup.