BPTK-Py: base ** variable_exponent in equation returns 1.0; np.power/np.log not supported on Converter
05:18 01 Nov 2025

I’m building a simulation in BPTK-Py and need a power with a variable exponent inside a node equation:

Resale_Value_DM1.equation = 1 - Depreciation_DM
Resale_Value_DM2.equation = Resale_Value_DM1 ** Average_Expected_Years_Kept_DM
Resale_Value_DM3.equation = Resale_Value_DM2 * DM_Price

In a plain notebook, 0.9292 ** 6 == 0.6436580523, but inside the model Resale_Value_DM2 becomes 1.0 and Resale_Value_DM3 == DM_Price, as if the exponent were 0.

I tried:

Resale_Value_DM2.equation = np.power(1 - Depreciation_DM, Average_Expected_Years_Kept_DM)
from numpy import log as ln, exp
Resale_Value_DM2.equation = exp(ln(Resale_Value_DM1) * Average_Expected_Years_Kept_DM)

but got:

TypeError: loop of ufunc does not support argument 0 of type Converter which has no callable log method

It looks like BPTK’s Converter objects don’t support NumPy ufuncs and variable exponents fall back to 0. Question: Is there a supported way to compute a ** b where b is a model variable in BPTK-Py equations? If not, what’s the recommended workaround (piecewise constant exponents, or compute in pandas and feed back)? Any example would be appreciated.

Minimal numbers: Depreciation_DM=0.0708, Average_Expected_Years_Kept_DM=6, DM_Price=42_000_000. Expected (1-0.0708)**6 ≈ 0.643658, not 1.0.

python numpy debugging simulation pow