# == Test that nu has a real solution before assigning == #
warning_msg = """
Hint: you probably set government spending too {}. Elect a {}
Congress and start over.
"""
disc = a0**2 - 4 * a0 * b0
if disc >= 0:
nu = 0.5 * (a0 - sqrt(disc)) / a0
else:
print "There is no Ramsey equilibrium for these parameters."
print warning_msg.format('high', 'Republican')
sys.exit(0)
# == Test that the Lagrange multiplier has the right sign == #
if nu * (0.5 - nu) < 0:
print "Negative multiplier on the government budget constraint."
print warning_msg.format('low', 'Democratic')
sys.exit(0)
Thomas Sargent was awarded the Nobel Prize in Economics in 2011 together with Christopher A. Sims "for their empirical research on cause and effect in the macroeconomy"
This is more for already-economists who want to learn the Python toolchain for their work, I think.
I do time series analysis (non-economic). So for example having a Kalman Filter python cookbook example is useful if I know the algorithms I want to use, but not the python libraries.
I'd say the specific topics covered (macro questions like optimal savings, optimal taxation, etc) are what makes it an economics text, although you're right that much of the technical topics covered are applications of non-econ-specific algorithms and modeling techniques.
Sargent is associated with "freshwater" macroeconomics. They tend to be very rigorous to the point of dropping topics considered important by other economists from their models.
Stachurski's book goes into the underlying theory more deeply with code examples. It's also got a very good/practical introduction into real analysis and measure theory. Great resource for modern computational economics.