Skip to content

Conversation

@mmcky
Copy link
Contributor

@mmcky mmcky commented Dec 22, 2025

Issue

The e() excess demand function had a @jax.jit decorator that caused shape mismatch errors when called with different dimensional inputs throughout the notebook:

  • First called with 2D inputs (A is 2×2, p is length 2)
  • Later called with 3D inputs (A is 3×3, p is length 3)

This resulted in: TypeError: dot_general requires contracting dimensions to have the same shape, got (3,) and (3000,)

Solution

Removed the @jax.jit decorator from the e() function definition at line 556 in newton_method.md.

The newton() solver function still uses @jax.jit internally for its update function q(), so performance is maintained while allowing JAX to handle varying input dimensions flexibly.

Testing

This fix allows the notebook to execute successfully with the upgraded anaconda environment (2025.12).

Related

- Upgrade anaconda to 2025.12
- Upgrade quantecon-book-theme to 0.15.1
- Add jupyter-book version constraint (<2.0)
- Configure Dependabot for conda ecosystem with jupyter-book restriction
- Temporarily disable build cache for full execution check
The @jax.jit decorator on e() causes shape mismatch errors when the function
is called with different dimensional inputs (2D vs 3D) throughout the notebook.
Removing the decorator allows JAX to handle the function more flexibly.

The newton() solver function still uses @jax.jit internally, so performance
is maintained.
@mmcky
Copy link
Contributor Author

mmcky commented Dec 23, 2025

Closing as looked more closely at the issue and incorporated a fix in #768

@mmcky mmcky closed this Dec 23, 2025
@mmcky mmcky deleted the fix-newton-method-jax-shape branch December 23, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants