Computing I(t) — Synaptic Current
In NMA Tutorial 1, synaptic current oscillates: I(t) = i_mean · (1 + sin(2πt / 0.01)). This mimics rhythmic input from other neurons with a 10 ms period.
Breaking it down:
• np.sin(x) oscillates between −1 and +1
• 2 np.pi t / 0.01 — full cycle every 0.01 s = 10 ms
• 1 + sin(...) shifts up so current is always ≥ 0
• i_mean * (...) scales to the right physical amplitude
I(t) = i_mean × (1 + sin(2πt / 0.01))
Period = 10 ms. Ranges from 0 to 2×i_mean. At t=0: I = i_mean.
import numpy as npi_mean = 25e-11dt = 1e-3for step in range(5): t = step * dt i_t = i_mean * (1 + np.sin(2 * np.pi * t / 0.01)) print(f"t={t*1000:.0f} ms: I(t) = {i_t:.2e} A")At t=0: sin(0)=0, so I(0)=i_mean. At t=2.5 ms: sin(π/2)=1, maximum current = 2×i_mean.
f-strings for tiny numbers: Use {value:.2e} for scientific notation. {i_t:.2e} prints 2.50e-10 instead of 0.00000000025. Always use .2e for currents and resistances.