shade-econ/sequence-jacobian

Jacobian not functioning well for log and exp inside blocks

ludwigstraub opened this issue · 0 comments

A reminder that we need to fix the following issue.

Whenever we use np.log or np.exp in a block, it throws an error when computing Jacobians.

Here is a minimal example:

import numpy as np
import matplotlib.pyplot as plt
import sequence_jacobian as sj

@sj.simple
def test(x):
    y = np.exp(x)
    return y

ss = test.steady_state({'x': 1})
test.jacobian(ss, inputs=['x'], outputs=['y'], T=100)

The current workaround is to write y = x.apply(np.exp) inside the block, which is pretty cumbersome.