The error between the theoretical value and the simulation value of imaginary part of the FFT results
Judging from your question, I think that you're confusing two related but different Hilbert relations. The first one holds for causal signals, for which the real and imaginary parts of their Fourier transforms are related via the Hilbert transform. The other one holds for analytic signals (whose spectrum is zero for negative frequencies), for which the real and imaginary parts of the time domain signal are related via the Hilbert transform.

So if you have a real valued function, as described in your question, and you take its Fourier transform, then the imaginary part of the Fourier transform can only be obtained from its real part via the Hilbert transform, if the signal is causal. Also note that the corresponding time domain signal is generally not analytic (because in that case its spectrum must be zero for negative frequencies and, consequently, the time domain signal must be complex-valued).