title: Using scipy fft and ifft to solve ordinary differential equation numerically
body: <p>I have an <code>ordinary differential equation</code> in time domain as follows: </p>
  
  <pre><code>C*du/dt = -g*u + I
  </code></pre>
  
  <p>where <code>I = A*t/tau*exp^(1-t/tau)</code></p>
  
  <p>in the freq domain:</p>
  
  <pre><code>u(w) = I(w)/(g*(1+C/g*j*w))
  </code></pre>
  
  <p><code>j</code> being the complex number <code>sqrt(-1)</code></p>
  
  <p>hence i can get <code>u(t)</code> by going into the freq domain using  <a href="https://en.wikipedia.org/wiki/Fast_Fourier_transform">fast Fourier transform</a> (<code>fft</code>) and then back using <code>ifft</code>.</p>
  
  <p>the codes:</p>
  
  <pre><code>t = np.linspace(0.,499.9,5000)
  I = q*t*np.exp(1-t/Tau_ca)/Tau_ca
  u1 = np.fft.ifft(np.fft.fft(I)/(G_l*(1.+1.j*(C_m/G_l)*np.fft.fftfreq(t.shape[-1]))))
  </code></pre>
  
  <p>However, when I compare this <code>u(t)</code> obtained with other methods such as numerical integration of the differential equation or its analytical form, it is not correct. I have tried and been unsuccessful at figuring out where my mistakes are. </p>
  
  <p>please enlighten.</p>