{
 "action": "Not for automatic application — the patched example does not run on 1.18.1: exit code 1, NameError: name 'errest' is not defined. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.",
 "alternatives": [
  {
   "action": "Not for automatic application — the patched example does not run on 1.18.1: exit code 1, NameError: name 'error_estimate' is not defined. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.",
   "applicability": {
    "exit_code": 1,
    "line": 13,
    "method": "literal_patch",
    "occurrences": 1,
    "patched_sha": "92ac8e3842d6",
    "reason": "the patched example does not run on 1.18.1: exit code 1, NameError: name 'error_estimate' is not defined",
    "run_on": "1.18.1",
    "status": "fails"
   },
   "by_notes": false,
   "changelog_ref": {
    "quote": "",
    "url": ""
   },
   "confirmations": 2,
   "detect": [
    "disp"
   ],
   "equivalence": "same",
   "format": "replace",
   "kind": "changed",
   "right": "root = sqrtm(matrix)",
   "script_right": "from scipy.linalg import norm, sqrtm\n\n\ndef main():\n    # Symmetric and strictly diagonally dominant with positive diagonal,\n    # so this matrix is positive definite.\n    matrix = [\n        [4.0, 1.0, 1.0],\n        [1.0, 3.0, 0.0],\n        [1.0, 0.0, 2.0],\n    ]\n\n    root = sqrtm(matrix)\n    error_estimate = norm(root @ root - matrix, ord=\"fro\") ** 2 / norm(matrix, ord=\"fro\")\n    residual_norm = norm(root @ root - matrix, ord=\"fro\")\n\n    print(\"Principal matrix square root:\")\n    print(root)\n    print(\"\\nSciPy error estimate:\", error_estimate)\n    print(\"Frobenius norm of (root @ root - matrix):\", residual_norm)\n\n\nif __name__ == \"__main__\":\n    main()",
   "script_wrong": "from scipy.linalg import norm, sqrtm\n\n\ndef main():\n    # Symmetric and strictly diagonally dominant with positive diagonal,\n    # so this matrix is positive definite.\n    matrix = [\n        [4.0, 1.0, 1.0],\n        [1.0, 3.0, 0.0],\n        [1.0, 0.0, 2.0],\n    ]\n\n    root, error_estimate = sqrtm(matrix, disp=False)\n    residual_norm = norm(root @ root - matrix, ord=\"fro\")\n\n    print(\"Principal matrix square root:\")\n    print(root)\n    print(\"\\nSciPy error estimate:\", error_estimate)\n    print(\"Frobenius norm of (root @ root - matrix):\", residual_norm)\n\n\nif __name__ == \"__main__\":\n    main()",
   "seen_in_models": [
    "gpt-6.1-sol"
   ],
   "wrong": "root, error_estimate = sqrtm(matrix, disp=False)"
  }
 ],
 "applicability": {
  "exit_code": 1,
  "line": 12,
  "method": "literal_patch",
  "occurrences": 1,
  "patched_sha": "22534c53e714",
  "reason": "the patched example does not run on 1.18.1: exit code 1, NameError: name 'errest' is not defined",
  "run_on": "1.18.1",
  "status": "fails"
 },
 "by_notes": false,
 "changelog_ref": {
  "quote": "",
  "url": ""
 },
 "confirmations": {
  "failed": 0,
  "worked": 4
 },
 "detect": [
  "disp"
 ],
 "ecosystem": "pypi",
 "equivalence": "same",
 "error_kind": "unexpected_kwarg",
 "error_signature": {
  "message": "sqrtm() got an unexpected keyword argument 'disp'",
  "norm": "unexpected_kwarg:disp",
  "type": "TypeError"
 },
 "first_seen": "2026-10-20T16:11:13+00:00",
 "format": "replace",
 "format_version": 2,
 "id": "pypi/scipy/1.18.1/0003",
 "kind": "changed",
 "license": "https://creativecommons.org/licenses/by/4.0/",
 "package": "scipy",
 "proof": {
  "applicability": {
   "exit_code": 1,
   "line": 12,
   "method": "literal_patch",
   "occurrences": 1,
   "patched_sha": "22534c53e714",
   "reason": "the patched example does not run on 1.18.1: exit code 1, NameError: name 'errest' is not defined",
   "run_on": "1.18.1",
   "status": "fails"
  },
  "auto_apply": false,
  "auto_apply_reason": "the patch gives fails when applied word for word",
  "auto_apply_rule": "Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.",
  "equivalence": "same",
  "equivalent": true,
  "fails_on": "1.18.1",
  "fixed_on": "1.18.1",
  "level": "differential",
  "method": {
   "fix_on": "1.18.1",
   "name": "stdout_match",
   "normalization": "lines stripped, blank lines dropped, runs of whitespace collapsed; memory addresses, timestamps and temporary paths masked",
   "original_on": "1.17.1",
   "scope": "the observable stdout of one example script; return values, files, other inputs and exception types are not compared, so a match is not a proof of equivalent behaviour"
  },
  "script_right": "from scipy import linalg\n\n# Construct a 3x3 symmetric positive-definite matrix\n# (strictly diagonally dominant with positive diagonal elements ensures SPD)\nA = [\n    [4.0, 1.0, 0.5],\n    [1.0, 5.0, 1.0],\n    [0.5, 1.0, 6.0],\n]\n\n# Compute principal matrix square root and error estimate from scipy\nroot = linalg.sqrtm(A)\nerrest = linalg.norm((root @ root) - A, \"fro\") ** 2 / linalg.norm(A, \"fro\")\n\n# Compute the Frobenius norm of the difference: ||root^2 - A||_F\ndiff = (root @ root) - A\nfrobenius_diff = linalg.norm(diff, \"fro\")\n\n# Print the results\nprint(\"Matrix Square Root (root):\")\nprint(root)\nprint(\"\\nSciPy Error Estimate:\")\nprint(errest)\nprint(\"\\nFrobenius Norm of (root^2 - A):\")\nprint(frobenius_diff)",
  "script_wrong": "from scipy import linalg\n\n# Construct a 3x3 symmetric positive-definite matrix\n# (strictly diagonally dominant with positive diagonal elements ensures SPD)\nA = [\n    [4.0, 1.0, 0.5],\n    [1.0, 5.0, 1.0],\n    [0.5, 1.0, 6.0],\n]\n\n# Compute principal matrix square root and error estimate from scipy\nroot, errest = linalg.sqrtm(A, disp=False)\n\n# Compute the Frobenius norm of the difference: ||root^2 - A||_F\ndiff = (root @ root) - A\nfrobenius_diff = linalg.norm(diff, \"fro\")\n\n# Print the results\nprint(\"Matrix Square Root (root):\")\nprint(root)\nprint(\"\\nSciPy Error Estimate:\")\nprint(errest)\nprint(\"\\nFrobenius Norm of (root^2 - A):\")\nprint(frobenius_diff)",
  "works_on": "1.17.1"
 },
 "right": "root = linalg.sqrtm(A)",
 "seen_in_models": [
  "gemini-3.8-flash",
  "gpt-6.1-sol"
 ],
 "seq": 3,
 "slug": "scipy-linalg-sqrtm",
 "source": "pipeline",
 "symbol": "scipy.linalg.sqrtm",
 "updated": "2026-10-27T17:20:00+00:00",
 "url": "https://formachines.ai/errata/pypi/scipy/0003-scipy-linalg-sqrtm/",
 "variant_confirmations": 2,
 "variant_models": [
  "gemini-3.8-flash"
 ],
 "verified": "sandbox",
 "versions": {
  "changed_in": ">1.17.1,<=1.18.1",
  "fails_on": "1.18.1",
  "works_on": "1.17.1"
 },
 "wrong": "root, errest = linalg.sqrtm(A, disp=False)"
}