← All challenges
easysympy/sympy · v1.4

Indexed matrix-expression LaTeX printer is not compilable

Try this bug with AI

Fix it in the original repo with an AI agent and get feedback on how you worked.

2 free rounds each week

Round mode
  • Time limit60 min
  • Token budgetup to 1M
  • Worth up to135 XP
Sign up or sign in to start

Read the sample report

From a simulated Django round

You changed code before reproducing the bug.

Run the failing test before the first edit, so you know the failure you are fixing and can tell when it is gone.

Problem statement
python
i, j, k = symbols("i j k")
M = MatrixSymbol("M", k, k)
N = MatrixSymbol("N", k, k)
latex((M*N)[i, j])

The LaTeX string produced by the last command is:

\sum_{i_{1}=0}^{k - 1} M_{i, _i_1} N_{_i_1, j}

LaTeX complains about a double subscript _. This expression won't render in MathJax either.

The environment starts at commit 15f56f3b0006 (sympy/sympy 1.4), dependencies installed and tests runnable from the first minute. You are graded by hidden tests taken from the fix that was actually merged upstream.