{
  "id": "task_libraries:math/python",
  "path": "/exapedia/python-math-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python math libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python math libraries extend the language's built-in numbers with arrays, symbolic algebra, and arbitrary-precision arithmetic. A computer algebra system keeps expressions exact rather than rounding each step to a floating-point value. These libraries let researchers, engineers, and AI agents run numerical and symbolic calculations in Python."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python math libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#numpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F134"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#scipy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F149"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#sympy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F164"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mpmath",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F181"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torch",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#dask",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F209"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#numexpr",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F226"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F235"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#jax",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F243"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F252"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F245"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#numpy",
          "label": [
            {
              "t": "text",
              "text": "NumPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F135"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Adjustable decimal precision",
            "Sparse matrix storage"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#numpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F134"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F142"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#scipy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F149"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#sympy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F164"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mpmath",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F181"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torch",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#dask",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F209"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#numexpr",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F226"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F236"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F237"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#jax",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F243"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F254"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "numpy",
          "name": [
            {
              "t": "fact",
              "fact": "F134"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/numpy/numpy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/numpy"
            },
            {
              "label": "Docs",
              "href": "https://numpy.org/doc/stable/reference/routines.linalg.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://numpy.org/doc/stable/reference/routines.linalg.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F134"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/scikit-learn/scikit-learn",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F147"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def row_norms(X, squared=False):\n    \"\"\"Row-wise (squared) Euclidean norm of X.\n\n    Equivalent to np.sqrt((X * X).sum(axis=1)), but also supports sparse\n    matrices and does not create an X.shape-sized temporary.\n\n    Performs no input validation.\n\n    Parameters\n    ----------\n    X : array-like\n        The input array.\n    squared : bool, default=False\n        If True, return squared norms.\n\n    Returns\n    -------\n    array-like\n        The row-wise (squared) Euclidean norm of X.\n    \"\"\"\n    if sparse.issparse(X):\n        X = X.tocsr()\n        norms = csr_row_norms(X)\n        if not squared:\n            norms = np.sqrt(norms)\n    else:\n        xp, _ = get_namespace(X)\n        if _is_numpy_namespace(xp):\n            X = np.asarray(X)\n            norms = np.einsum(\"ij,ij->i\", X, X)\n            norms = xp.asarray(norms)\n        else:\n            norms = xp.sum(xp.multiply(X, X), axis=1)\n        if not squared:\n            norms = xp.sqrt(norms)\n    return norms\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/scikit-learn/scikit-learn/blob/a30a70e39ef550a01ea7234e9cf10d3d821df9cd/sklearn/utils/extmath.py#L58-L93",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20numpy%20for%20scalar%20geometry%20vector%20normalization%20filtering%20quadrature%20and%20arbitrary-precision%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F134"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\n\na = np.array([[1, 2], [3, 5]])\n\nb = np.array([1, 2])\n\nx = np.linalg.solve(a, b)\n\nx\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "quickstart.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F139"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "scipy",
          "name": [
            {
              "t": "fact",
              "fact": "F149"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/scipy/scipy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/scipy"
            },
            {
              "label": "Docs",
              "href": "https://docs.scipy.org/doc/scipy/reference/linalg.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F38"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F152"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.scipy.org/doc/scipy/reference/linalg.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F149"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F45"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F46"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/deepmodeling/jax-fem",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F162"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def scipy_spsolve(A, b):\n    logger.debug(\"Scipy Solver - Solving linear system with scipy.sparse.linalg.spsolve\")\n    indptr, indices, data = A.getValuesCSR()\n    Asp = scipy.sparse.csr_matrix((data, indices, indptr))\n    # SciPy's spsolve uses UMFPACK only when scikits.umfpack is installed and\n    # applicable; otherwise it falls back to SuperLU.\n    x = scipy.sparse.linalg.spsolve(Asp, onp.array(b))\n\n    # TODO: try https://jax.readthedocs.io/en/latest/_autosummary/jax.experimental.sparse.linalg.spsolve.html\n    # x = jax.experimental.sparse.linalg.spsolve(av, aj, ai, b)\n\n    logger.debug(\"Scipy Solver - Finished solving, linear solve res = %.3g\",\n                 np.linalg.norm(Asp @ x - b))\n    return x\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/deepmodeling/jax-fem/blob/01d11bdb57aa76dcfe7189e0e77d067960c2a6ac/jax_fem/solver.py#L89-L102",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20scipy%20for%20scalar%20geometry%20vector%20normalization%20filtering%20quadrature%20and%20arbitrary-precision%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F149"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\n\na = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])\n\nb = np.array([2, 4, -1])\n\nfrom scipy.linalg import solve\n\nx = solve(a, b)\n\nx\n\na @ x == b\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.solve.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "integrate.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F154"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "sympy",
          "name": [
            {
              "t": "fact",
              "fact": "F164"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/sympy/sympy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/sympy"
            },
            {
              "label": "Docs",
              "href": "https://docs.sympy.org/latest/modules/matrices/matrices.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F171"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.sympy.org/latest/modules/matrices/matrices.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F164"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Phylliade/ikpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F179"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _apply_geometric_transformations(self, theta, mu, symbolic):\n\n    if symbolic:\n        # Angle symbolique qui paramètre la rotation du joint en cours\n        symbolic_frame_matrix = np.eye(4)\n\n        # Apply translation matrix\n        symbolic_frame_matrix = symbolic_frame_matrix * sympy.Matrix(geometry.homogeneous_translation_matrix(*self.origin_translation))\n\n        # Apply orientation matrix\n        symbolic_frame_matrix = symbolic_frame_matrix * geometry.cartesian_to_homogeneous(geometry.rpy_matrix(*self.origin_orientation))\n\n        # Apply rotation matrix\n        if self.has_rotation:\n            symbolic_frame_matrix = symbolic_frame_matrix * geometry.cartesian_to_homogeneous(geometry.symbolic_axis_rotation_matrix(self.rotation, theta), matrix_type=\"sympy\")\n\n        # Apply translation\n        if self.has_translation:\n            translation_vector = self.translation * mu\n            symbolic_frame_matrix = symbolic_frame_matrix * geometry.get_symbolic_translation_matrix(translation_vector)\n\n        symbolic_frame_matrix = sympy.lambdify([theta, mu], symbolic_frame_matrix, \"numpy\")\n\n        return symbolic_frame_matrix\n\n    else:\n        # Init the transformation matrix\n        frame_matrix = np.eye(4)\n\n        # First, apply translation matrix\n        frame_matrix = np.dot(frame_matrix, geometry.homogeneous_translation_matrix(*self.origin_translation))\n\n        # Apply orientation\n        frame_matrix = np.dot(frame_matrix, geometry.cartesian_to_homogeneous(geometry.rpy_matrix(*self.origin_orientation)))\n\n        # Apply rotation matrix\n        if self.has_rotation:\n            frame_matrix = np.dot(frame_matrix, geometry.cartesian_to_homogeneous(geometry.axis_rotation_matrix(self.rotation, theta)))\n\n        # Apply translation\n        if self.has_translation:\n            translation_vector = self.translation * mu\n            frame_matrix = np.dot(frame_matrix, geometry.get_translation_matrix(translation_vector))\n\n        return frame_matrix\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Phylliade/ikpy/blob/95b289b1239fb644b1c2e9b799f5a7ec43d7bc37/src/ikpy/link.py#L231-L275",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=sympy%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F164"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from sympy import Matrix\n\nM = Matrix(3, 3, [0, 1, 1, 1, 0, 0, 1, 1, 1])\n\nM.eigenvals()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.sympy.org/latest/modules/matrices/matrices.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "matrices.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F169"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "mpmath",
          "name": [
            {
              "t": "fact",
              "fact": "F181"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mpmath/mpmath"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/mpmath"
            },
            {
              "label": "Docs",
              "href": "https://mpmath.org/doc/current/basics.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F64"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://mpmath.org/doc/current/basics.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F181"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F71"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F72"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from mpmath import mp\nwith mp.workdps(50):\n    print(mp.sqrt(2))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://mpmath.org/doc/current/basics.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "basics.html"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20mpmath%20for%20scalar%20geometry%20vector%20normalization%20filtering%20quadrature%20and%20arbitrary-precision%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F181"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F186"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "torch",
          "name": [
            {
              "t": "fact",
              "fact": "F192"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pytorch/pytorch"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/torch"
            },
            {
              "label": "Docs",
              "href": "https://docs.pytorch.org/docs/2.15/linalg.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F199"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.pytorch.org/docs/2.15/linalg.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/nerfstudio-project/nerfstudio",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F207"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def focus_of_attention(poses: Float[Tensor, \"*num_poses 4 4\"], initial_focus: Float[Tensor, \"3\"]) -> Float[Tensor, \"3\"]:\n    \"\"\"Compute the focus of attention of a set of cameras. Only cameras\n    that have the focus of attention in front of them are considered.\n\n     Args:\n        poses: The poses to orient.\n        initial_focus: The 3D point views to decide which cameras are initially activated.\n\n    Returns:\n        The 3D position of the focus of attention.\n    \"\"\"\n    # References to the same method in third-party code:\n    # https://github.com/google-research/multinerf/blob/1c8b1c552133cdb2de1c1f3c871b2813f6662265/internal/camera_utils.py#L145\n    # https://github.com/bmild/nerf/blob/18b8aebda6700ed659cb27a0c348b737a5f6ab60/load_llff.py#L197\n    active_directions = -poses[:, :3, 2:3]\n    active_origins = poses[:, :3, 3:4]\n    # initial value for testing if the focus_pt is in front or behind\n    focus_pt = initial_focus\n    # Prune cameras which have the current have the focus_pt behind them.\n    active = torch.sum(active_directions.squeeze(-1) * (focus_pt - active_origins.squeeze(-1)), dim=-1) > 0\n    done = False\n    # We need at least two active cameras, else fallback on the previous solution.\n    # This may be the \"poses\" solution if no cameras are active on first iteration, e.g.\n    # they are in an outward-looking configuration.\n    while torch.sum(active.int()) > 1 and not done:\n        active_directions = active_directions[active]\n        active_origins = active_origins[active]\n        # https://en.wikipedia.org/wiki/Line–line_intersection#In_more_than_two_dimensions\n        m = torch.eye(3) - active_directions * torch.transpose(active_directions, -2, -1)\n        mt_m = torch.transpose(m, -2, -1) @ m\n        focus_pt = torch.linalg.inv(mt_m.mean(0)) @ (mt_m @ active_origins).mean(0)[:, 0]\n        active = torch.sum(active_directions.squeeze(-1) * (focus_pt - active_origins.squeeze(-1)), dim=-1) > 0\n        if active.all():\n            # the set of active cameras did not change, so we're done.\n            done = True\n    return focus_pt\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/nerfstudio-project/nerfstudio/blob/50e0e3c70c775e89333256213363badbf074f29d/nerfstudio/cameras/camera_utils.py#L514-L549",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F206"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=torch%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import torch\n\nA = torch.randn(3, 3)\nb = torch.randn(3)\nx = torch.linalg.solve(A, b)\nprint(x)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.pytorch.org/docs/2.15/generated/torch.linalg.solve.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "torch.linalg.solve.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F197"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "dask",
          "name": [
            {
              "t": "fact",
              "fact": "F209"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/dask/dask"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/dask"
            },
            {
              "label": "Docs",
              "href": "https://docs.dask.org/en/stable/array-api.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F216"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.dask.org/en/stable/array-api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F209"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F225"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/dask/dask-ml",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F224"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def fit_transform(self, X, y=None):\n    \"\"\"Fit model to X and perform dimensionality reduction on X.\n\n    Parameters\n    ----------\n    X : array-like, shape (n_samples, n_features)\n        Training data.\n\n    y : Ignored\n\n    Returns\n    -------\n    X_new : array, shape (n_samples, n_components)\n        Reduced version of X. This will always be a dense array, of the\n        same type as the input array. If ``X`` was a ``dask.array``, then\n        ``X_new`` will be a ``dask.array`` with the same chunks along the\n        first dimension.\n    \"\"\"\n    X = self._check_array(X)\n    if self.algorithm not in {\"tsqr\", \"randomized\"}:\n        raise ValueError(\n            \"`algorithm` must be 'tsqr' or 'randomized', not '{}'\".format(\n                self.algorithm\n            )\n        )\n    if self.algorithm == \"tsqr\":\n        u, s, v = da.linalg.svd(X)\n        u = u[:, : self.n_components]\n        s = s[: self.n_components]\n        v = v[: self.n_components]\n    else:\n        u, s, v = da.linalg.svd_compressed(\n            X, self.n_components, n_power_iter=self.n_iter, seed=self.random_state\n        )\n    if not DASK_2_26_0:\n        u, v = svd_flip(u, v)\n\n    X_transformed = u * s\n    explained_var = X_transformed.var(axis=0)\n    full_var = X.var(axis=0).sum()\n    explained_variance_ratio = explained_var / full_var\n\n    if self.compute:\n        v, explained_var, explained_variance_ratio, s = compute(\n            v, explained_var, explained_variance_ratio, s\n        )\n    self.components_ = v\n    self.explained_variance_ = explained_var\n    self.explained_variance_ratio_ = explained_variance_ratio\n    self.singular_values_ = s\n    self.n_features_in_ = X.shape[1]\n    return X_transformed\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/dask/dask-ml/blob/fcc8111ac686e086985902f2050b3b17464966dc/dask_ml/decomposition/truncated_svd.py#L157-L208",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F223"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=dask%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F209"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import dask.array as da\n\nx = da.eye(2, chunks=2)\nu, s, v = da.linalg.svd(x)\nprint(s.compute())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.dask.org/en/stable/array-api.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "array-api.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F214"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "numexpr",
          "name": [
            {
              "t": "fact",
              "fact": "F226"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pydata/numexpr"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/numexpr"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/pydata/numexpr/3b5ddaad460a1cb65ca8f2c80c3bd6d6b173438a/doc/user_guide.rst"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F233"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F235"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/pydata/numexpr/3b5ddaad460a1cb65ca8f2c80c3bd6d6b173438a/doc/user_guide.rst",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F226"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/pandas-dev/pandas",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F241"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _evaluate(self):\n    import numexpr as ne\n\n    # convert the expression to a valid numexpr expression\n    s = self.convert()\n\n    env = self.expr.env\n    scope = env.full_scope\n    _check_ne_builtin_clash(self.expr)\n    return normalize_numexpr_result(ne.evaluate(s, local_dict=scope))\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/pandas-dev/pandas/blob/5a96bfa5f03224fb5dd0d895e5eb5f1beda23cf7/pandas/core/computation/engines.py#L115-L124",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F240"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=numexpr%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F226"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\nimport numexpr as ne\na = np.arange(10)\nprint(ne.evaluate(\"a**2 + 1\", local_dict={\"a\": a}))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/pydata/numexpr/3b5ddaad460a1cb65ca8f2c80c3bd6d6b173438a/doc/user_guide.rst",
                  "label": [
                    {
                      "t": "text",
                      "text": "user_guide.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F231"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "jax",
          "name": [
            {
              "t": "fact",
              "fact": "F243"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/jax-ml/jax"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/jax"
            },
            {
              "label": "Docs",
              "href": "https://docs.jax.dev/en/latest/jax.numpy.linalg.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F250"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F252"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F246"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F245"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://docs.jax.dev/en/latest/jax.numpy.linalg.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F243"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/deepmodeling/jax-fem",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F258"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def operator_to_matrix(operator_fn, problem):\n    \"\"\"Only used for when debugging.\n    Can be used to print the matrix, check the conditional number, etc.\n    \"\"\"\n    J = jax.jacfwd(operator_fn)(np.zeros(problem.num_total_dofs_all_vars))\n    return J\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/deepmodeling/jax-fem/blob/01d11bdb57aa76dcfe7189e0e77d067960c2a6ac/jax_fem/solver.py#L382-L387",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F257"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=jax%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F243"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import jax.numpy as jnp\n\nx = jnp.array([[1., 2., 3.], [4., 5., 7.]])\nprint(jnp.linalg.norm(x))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.jax.dev/en/latest/_autosummary/jax.numpy.linalg.norm.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "jax.numpy.linalg.norm.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F248"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python math library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#numpy",
          "label": [
            {
              "t": "text",
              "text": "NumPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits numerical work on arrays and matrices. "
        },
        {
          "t": "link",
          "href": "#scipy",
          "label": [
            {
              "t": "text",
              "text": "SciPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " adds integration, optimization, and other scientific algorithms on top of NumPy arrays. "
        },
        {
          "t": "link",
          "href": "#sympy",
          "label": [
            {
              "t": "text",
              "text": "SymPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits exact symbolic math. "
        },
        {
          "t": "link",
          "href": "#mpmath",
          "label": [
            {
              "t": "text",
              "text": "mpmath"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits arithmetic at arbitrary precision."
        }
      ]
    },
    {
      "q": "What is NumPy?",
      "a": [
        {
          "t": "link",
          "href": "#numpy",
          "label": [
            {
              "t": "text",
              "text": "NumPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " is the core package for array computing in Python, with broadcasting, elementwise functions, and linear algebra."
        }
      ]
    },
    {
      "q": "What is SymPy?",
      "a": [
        {
          "t": "link",
          "href": "#sympy",
          "label": [
            {
              "t": "text",
              "text": "SymPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a computer algebra system that keeps expressions exact and manipulates them symbolically. Its evalf method computes numerical approximations to a chosen number of digits."
        }
      ]
    },
    {
      "q": "NumPy vs SciPy: what is the difference?",
      "a": [
        {
          "t": "link",
          "href": "#numpy",
          "label": [
            {
              "t": "text",
              "text": "NumPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " supplies the array type and core numerical operations. "
        },
        {
          "t": "link",
          "href": "#scipy",
          "label": [
            {
              "t": "text",
              "text": "SciPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " builds on those arrays with algorithms for integration, differential equations, optimization, and signal processing."
        }
      ]
    },
    {
      "q": "What is JAX?",
      "a": [
        {
          "t": "link",
          "href": "#jax",
          "label": [
            {
              "t": "text",
              "text": "JAX"
            }
          ]
        },
        {
          "t": "text",
          "text": " runs NumPy-style array code with automatic differentiation and compilation on supported accelerators."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, numpy",
      "display": "NumPy",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, numpy",
      "display": "1.1B",
      "asOf": "2026-11-17"
    },
    "F3": {
      "label": "License, numpy",
      "display": "BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, numpy",
      "display": "2.5.5, Nov 2026",
      "asOf": "2026-11-15"
    },
    "F5": {
      "label": "Package release date, numpy",
      "display": "Nov 2026",
      "asOf": "2026-11-15"
    },
    "F6": {
      "label": "Repository stars, numpy",
      "display": "33.4K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Complex numbers, numpy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Definite integrals, numpy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Numerical derivatives, numpy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Special functions, numpy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, numpy",
      "display": "pip install numpy",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, numpy",
      "display": "Provides multidimensional arrays and operations for numerical computing.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, numpy",
      "display": "Calculates whole arrays elementwise",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, numpy",
      "display": "Apply mathematical operations to array elements with broadcasting.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, numpy",
      "display": "Integrates sampled data",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, numpy",
      "display": "Use trapezoid to integrate values sampled along an axis.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, numpy",
      "display": "Fixed-width integers can overflow",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, numpy",
      "display": "Choose a data type large enough for intermediate and final values.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations lead, numpy",
      "display": "Negative real roots return NaN",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations, numpy",
      "display": "Use complex inputs when square roots need complex results.",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Quickstart, numpy",
      "display": "import numpy as np\na = np.arange(15).reshape(3, 5)\na\na.shape\na.ndim\na.dtype.name\na.itemsize\na.size\ntype(a)\nb = np.array([6, 7, 8])\nb\ntype(b)\na = np.array([20, 30, 40, 50])\nb = np.arange(4)\nb\nc = a - b\nc\nb**2\n10 * np.sin(a)\na < 35\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function, numpy",
      "display": "def unitize(\n    vectors: ArrayLike,\n    check_valid: bool = False,\n    threshold: Number | None = None,\n):\n    \"\"\"\n    Unitize a vector or an array or row-vectors.\n\n    Parameters\n    ------------\n    vectors : (n,m) or (j) float\n       Vector or vectors to be unitized\n    check_valid :  bool\n       If set, will return mask of nonzero vectors\n    threshold : float\n       Cutoff for a value to be considered zero.\n\n    Returns\n    ---------\n    unit :  (n,m) or (j) float\n       Input vectors but unitized\n    valid : (n,) bool or bool\n        Mask of nonzero vectors returned if `check_valid`\n    \"\"\"\n    # make sure we have a numpy array\n    vectors = np.asanyarray(vectors)\n\n    # allow user to set zero threshold\n    if threshold is None:\n        threshold = TOL_ZERO\n\n    if len(vectors.shape) == 2:\n        # for (m, d) arrays take the per-row unit vector\n        # using sqrt and avoiding exponents is slightly faster\n        # also dot with ones is faser than .sum(axis=1)\n        norm = np.sqrt(np.dot(vectors * vectors, [1.0] * vectors.shape[1]))\n        # non-zero norms\n        valid = norm > threshold\n        # in-place reciprocal of nonzero norms\n        norm[valid] **= -1\n        # multiply by reciprocal of norm\n        unit = vectors * norm.reshape((-1, 1))\n\n    elif len(vectors.shape) == 1:\n        # treat 1D arrays as a single vector\n        norm = np.sqrt(np.dot(vectors, vectors))\n        valid = norm > threshold\n        if valid:\n            unit = vectors / norm\n        else:\n            unit = vectors.copy()\n    else:\n        raise ValueError(\"vectors must be (n, ) or (n, d)!\")\n\n    if check_valid:\n        return unit[valid], valid\n    return unit\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function reference, numpy",
      "display": "util.py · unitize()",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project repository, numpy",
      "display": "mikedh/trimesh",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project stars, mikedh/trimesh",
      "display": "3.7K",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project push date, mikedh/trimesh",
      "display": "Nov 2026",
      "asOf": "2026-11-13"
    },
    "F27": {
      "label": "Library name, scipy",
      "display": "SciPy",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Monthly downloads, scipy",
      "display": "383.8M",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "License, scipy",
      "display": "BSD",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Package release, scipy",
      "display": "1.18.1, Aug 2026",
      "asOf": "2026-08-21"
    },
    "F31": {
      "label": "Package release date, scipy",
      "display": "Aug 2026",
      "asOf": "2026-08-21"
    },
    "F32": {
      "label": "Repository stars, scipy",
      "display": "15.2K",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Complex numbers, scipy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Definite integrals, scipy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Numerical derivatives, scipy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Special functions, scipy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Install, scipy",
      "display": "pip install scipy",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "What it does, scipy",
      "display": "Provides numerical algorithms and scientific-computing tools built on NumPy.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, scipy",
      "display": "Integrates callable functions",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, scipy",
      "display": "Use quad to compute a definite integral of a callable.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths lead, scipy",
      "display": "Approximates callable derivatives",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths, scipy",
      "display": "Use differentiate.derivative to estimate a callable’s derivative.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, scipy",
      "display": "Sharp features can be missed",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, scipy",
      "display": "Pulses narrow relative to the integration interval can be integrated incorrectly.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "limitations lead, scipy",
      "display": "Returned errors are estimates",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "limitations, scipy",
      "display": "Treat quad’s reported absolute error as an estimate.",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Quickstart, scipy",
      "display": "import scipy.integrate as integrate\nimport scipy.special as special\nresult = integrate.quad(lambda x: special.jv(2.5,x), 0, 4.5)\nresult\nfrom scipy.integrate import quad\ndef integrand(x, a, b):\n    return a*x**2 + b\na = 2\nb = 1\nI = quad(integrand, 0, 1, args=(a,b))\nI\n",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project function, scipy",
      "display": "def _signal_filter_butterworth_ba(signal, sampling_rate=1000, lowcut=None, highcut=None, order=5):\n    \"\"\"Filter a signal using IIR Butterworth B/A method.\"\"\"\n    # Get coefficients\n    freqs, filter_type = _signal_filter_sanitize(lowcut=lowcut, highcut=highcut, sampling_rate=sampling_rate)\n\n    b, a = scipy.signal.butter(order, freqs, btype=filter_type, output=\"ba\", fs=sampling_rate)\n    try:\n        filtered = scipy.signal.filtfilt(b, a, signal, method=\"gust\")\n    except ValueError:\n        filtered = scipy.signal.filtfilt(b, a, signal, method=\"pad\")\n\n    return filtered\n",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project function reference, scipy",
      "display": "signal_filter.py · _signal_filter_butterworth_ba()",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project repository, scipy",
      "display": "neuropsychology/NeuroKit",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Project stars, neuropsychology/NeuroKit",
      "display": "2.4K",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Project push date, neuropsychology/NeuroKit",
      "display": "Nov 2026",
      "asOf": "2026-11-11"
    },
    "F53": {
      "label": "Library name, mpmath",
      "display": "mpmath",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Monthly downloads, mpmath",
      "display": "161.5M",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "License, mpmath",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Package release, mpmath",
      "display": "1.4.1, Mar 2026",
      "asOf": "2026-03-15"
    },
    "F57": {
      "label": "Package release date, mpmath",
      "display": "Mar 2026",
      "asOf": "2026-03-15"
    },
    "F58": {
      "label": "Repository stars, mpmath",
      "display": "1.2K",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Complex numbers, mpmath",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Definite integrals, mpmath",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Numerical derivatives, mpmath",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Special functions, mpmath",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "Install, mpmath",
      "display": "pip install mpmath",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "What it does, mpmath",
      "display": "Provides arbitrary-precision floating-point mathematical computation.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths lead, mpmath",
      "display": "Offers configurable working precision",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths, mpmath",
      "display": "Set mp.dps to choose the working decimal precision.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "strengths lead, mpmath",
      "display": "Integrates functions along complex paths",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "strengths, mpmath",
      "display": "Use quad to evaluate integrals over a specified complex path.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations lead, mpmath",
      "display": "Float inputs retain earlier rounding",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "limitations, mpmath",
      "display": "Use decimal strings when constructing high-precision decimal inputs.",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "limitations lead, mpmath",
      "display": "Default precision changes persist",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "limitations, mpmath",
      "display": "Use workdps when a precision change should be temporary.",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Quickstart, mpmath",
      "display": "from mpmath import *\nmpf(4)\nmpf(2.5)\nmpf(\"1.25e6\")\nmpf(mpf(2))\nmpf(\"inf\")\nmpc(2,3)\nmpc(complex(2,3)).imag\nmp.dps = 50\nmpf(1) / 6\nmp.dps = 25\nmpf(2) ** mpf('0.5')\n",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project function, mpmath",
      "display": "def do_integral(expr: 'Integral', prec: int, options: OPT_DICT) -> TMP_RES:\n    func = expr.args[0]\n    x, xlow, xhigh = expr.args[1]\n    if xlow == xhigh:\n        xlow = xhigh = 0\n    elif x not in func.free_symbols:\n        # only the difference in limits matters in this case\n        # so if there is a symbol in common that will cancel\n        # out when taking the difference, then use that\n        # difference\n        if xhigh.free_symbols & xlow.free_symbols:\n            diff = xhigh - xlow\n            if diff.is_number:\n                xlow, xhigh = 0, diff\n\n    oldmaxprec = options.get('maxprec', DEFAULT_MAXPREC)\n    options['maxprec'] = min(oldmaxprec, 2*prec)\n\n    with local_workprec(prec + 5) as ctx:\n        xlow = as_mpmath(xlow, prec + 15, options, ctx)\n        xhigh = as_mpmath(xhigh, prec + 15, options, ctx)\n\n        # Integration is like summation, and we can phone home from\n        # the integrand function to update accuracy summation style\n        # Note that this accuracy is inaccurate, since it fails\n        # to account for the variable quadrature weights,\n        # but it is better than nothing\n\n        from sympy.functions.elementary.trigonometric import cos, sin\n        from .symbol import Wild\n\n        have_part = [False, False]\n        max_real_term: float | int = MINUS_INF\n        max_imag_term: float | int = MINUS_INF\n\n        def f(t: Expr) -> mpc | mpf:\n            nonlocal max_real_term, max_imag_term\n            re, im, re_acc, im_acc = evalf(func, ctx.prec, {'subs': {x: t}})\n\n            have_part[0] = re or have_part[0]\n            have_part[1] = im or have_part[1]\n\n            max_real_term = max(max_real_term, fastlog(re))\n            max_imag_term = max(max_imag_term, fastlog(im))\n\n            if im:\n                return ctx.mpc(re or fzero, im)\n            return ctx.mpf(re or fzero)\n\n        if options.get('quad') == 'osc':\n            A = Wild('A', exclude=[x])\n            B = Wild('B', exclude=[x])\n            D = Wild('D')\n            m = func.match(cos(A*x + B)*D)\n            if not m:\n                m = func.match(sin(A*x + B)*D)\n            if not m:\n                raise ValueError(\"An integrand of the form sin(A*x+B)*f(x) \"\n                  \"or cos(A*x+B)*f(x) is required for oscillatory quadrature\")\n            period = as_mpmath(2*S.Pi/m[A], prec + 15, options, ctx)\n            result = ctx.quadosc(f, [xlow, xhigh], period=period)\n            # XXX: quadosc does not do error detection yet\n            quadrature_error = MINUS_INF\n        else:\n            result, quadrature_err = ctx.quadts(f, [xlow, xhigh], error=1)\n            quadrature_error = fastlog(quadrature_err._mpf_)\n\n    options['maxprec'] = oldmaxprec\n\n    if have_part[0]:\n        re: MPF_TUP | None = result.real._mpf_\n        re_acc: int | None\n        if re == fzero:\n            re_s, re_acc = scaled_zero(int(-max(prec, max_real_term, quadrature_error)))\n            re = scaled_zero(re_s)  # handled ok in evalf_integral\n        else:\n            re_acc = int(-max(max_real_term - fastlog(re) - prec, quadrature_error))\n    else:\n        re, re_acc = None, None\n\n    if have_part[1]:\n        im: MPF_TUP | None = result.imag._mpf_\n        im_acc: int | None\n        if im == fzero:\n            im_s, im_acc = scaled_zero(int(-max(prec, max_imag_term, quadrature_error)))\n            im = scaled_zero(im_s)  # handled ok in evalf_integral\n        else:\n            im_acc = int(-max(max_imag_term - fastlog(im) - prec, quadrature_error))\n    else:\n        im, im_acc = None, None\n\n    result = re, im, re_acc, im_acc\n    return result\n",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project function reference, mpmath",
      "display": "evalf.py · do_integral()",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project repository, mpmath",
      "display": "sympy/sympy",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "Project stars, sympy/sympy",
      "display": "15.1K",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Project push date, sympy/sympy",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Library name, math",
      "display": "math",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Monthly downloads, math",
      "display": "Standard library",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "License, math",
      "display": "PSF License Version 2",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Package release, math",
      "display": "With Python",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Undated package release, math",
      "display": "With Python",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Repository context, math",
      "display": "Part of Python",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Complex numbers, math",
      "display": "Unsupported",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "Special functions, math",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "Install, math",
      "display": "Bundled with Python",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "What it does, math",
      "display": "Provides Python’s standard-library mathematical functions for real-valued calculations.",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths lead, math",
      "display": "Ships with Python",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths, math",
      "display": "Use scalar mathematical functions without installing another package.",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "strengths lead, math",
      "display": "Reduces rounding error in sums",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "strengths, math",
      "display": "Use fsum for careful floating-point summation.",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "limitations lead, math",
      "display": "Complex inputs need another module",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "limitations, math",
      "display": "Use cmath, Python’s complex-number math module, when complex inputs are required.",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Quickstart, math",
      "display": "import math\nmath.cos(math.pi / 4)\nmath.log(1024, 2)\n",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project function, math",
      "display": "def rotate(\n    self,\n    angle: float,\n    resample: Resampling = Resampling.NEAREST,\n    expand: int | bool = False,\n    center: tuple[float, float] | None = None,\n    translate: tuple[int, int] | None = None,\n    fillcolor: float | tuple[float, ...] | str | None = None,\n) -> Image:\n    \"\"\"\n    Returns a rotated copy of this image.  This method returns a\n    copy of this image, rotated the given number of degrees counter\n    clockwise around its centre.\n\n    :param angle: In degrees counterclockwise.\n    :param resample: An optional resampling filter.  This can be\n       one of :py:data:`Resampling.NEAREST` (use nearest neighbour),\n       :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2\n       environment), or :py:data:`Resampling.BICUBIC` (cubic spline\n       interpolation in a 4x4 environment). If omitted, or if the image has\n       mode \"1\", \"P\" or \"PA\", it is set to :py:data:`Resampling.NEAREST`.\n       See :ref:`concept-filters`.\n    :param expand: Optional expansion flag.  If true, expands the output\n       image to make it large enough to hold the entire rotated image.\n       If false or omitted, make the output image the same size as the\n       input image.  Note that the expand flag assumes rotation around\n       the center and no translation.\n    :param center: Optional center of rotation (a 2-tuple).  Origin is\n       the upper left corner.  Default is the center of the image.\n    :param translate: An optional post-rotate translation (a 2-tuple).\n    :param fillcolor: An optional color for area outside the rotated image.\n    :returns: An :py:class:`~PIL.Image.Image` object.\n    \"\"\"\n\n    angle = angle % 360.0\n    if math.isnan(angle):\n        msg = \"invalid angle\"\n        raise ValueError(msg)\n\n    # Fast paths regardless of filter, as long as we're not\n    # translating or changing the center.\n    if not (center or translate):\n        if angle == 0:\n            return self.copy()\n        if angle == 180:\n            return self.transpose(Transpose.ROTATE_180)\n        if angle in (90, 270) and (expand or self.width == self.height):\n            return self.transpose(\n                Transpose.ROTATE_90 if angle == 90 else Transpose.ROTATE_270\n            )\n\n    # Calculate the affine matrix.  Note that this is the reverse\n    # transformation (from destination image to source) because we\n    # want to interpolate the (discrete) destination pixel from\n    # the local area around the (floating) source pixel.\n\n    # The matrix we actually want (note that it operates from the right):\n    # (1, 0, tx)   (1, 0, cx)   ( cos a, sin a, 0)   (1, 0, -cx)\n    # (0, 1, ty) * (0, 1, cy) * (-sin a, cos a, 0) * (0, 1, -cy)\n    # (0, 0,  1)   (0, 0,  1)   (     0,     0, 1)   (0, 0,   1)\n\n    # The reverse matrix is thus:\n    # (1, 0, cx)   ( cos -a, sin -a, 0)   (1, 0, -cx)   (1, 0, -tx)\n    # (0, 1, cy) * (-sin -a, cos -a, 0) * (0, 1, -cy) * (0, 1, -ty)\n    # (0, 0,  1)   (      0,      0, 1)   (0, 0,   1)   (0, 0,   1)\n\n    # In any case, the final translation may be updated at the end to\n    # compensate for the expand flag.\n\n    w, h = self.size\n\n    if translate is None:\n        post_trans = (0, 0)\n    else:\n        post_trans = translate\n    if center is None:\n        center = (w / 2, h / 2)\n\n    angle = -math.radians(angle)\n    matrix = [\n        round(math.cos(angle), 15),\n        round(math.sin(angle), 15),\n        0.0,\n        round(-math.sin(angle), 15),\n        round(math.cos(angle), 15),\n        0.0,\n    ]\n\n    def transform(x: float, y: float, matrix: list[float]) -> tuple[float, float]:\n        a, b, c, d, e, f = matrix\n        return a * x + b * y + c, d * x + e * y + f\n\n    matrix[2], matrix[5] = transform(\n        -center[0] - post_trans[0], -center[1] - post_trans[1], matrix\n    )\n    matrix[2] += center[0]\n    matrix[5] += center[1]\n\n    if expand:\n        # calculate output size\n        xx = []\n        yy = []\n        for x, y in ((0, 0), (w, 0), (w, h), (0, h)):\n            transformed_x, transformed_y = transform(x, y, matrix)\n            xx.append(transformed_x)\n            yy.append(transformed_y)\n        nw = math.ceil(max(xx)) - math.floor(min(xx))\n        nh = math.ceil(max(yy)) - math.floor(min(yy))\n\n        # We multiply a translation matrix from the right.  Because of its\n        # special form, this is the same as taking the image of the\n        # translation vector as new translation vector.\n        matrix[2], matrix[5] = transform(-(nw - w) / 2.0, -(nh - h) / 2.0, matrix)\n        w, h = nw, nh\n\n    return self.transform(\n        (w, h), Transform.AFFINE, matrix, resample, fillcolor=fillcolor\n    )\n",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project function reference, math",
      "display": "Image.py · rotate()",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Project repository, math",
      "display": "python-pillow/Pillow",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Project stars, python-pillow/Pillow",
      "display": "14.0K",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Project push date, python-pillow/Pillow",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need",
      "display": "Scalar calculations without another install",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Why choose math",
      "display": "the standard-library math module",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need in introduction",
      "display": "scalar calculations without another install",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "When to consider mpmath",
      "display": "working precision must be configurable",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need",
      "display": "Elementwise calculations on arrays",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Why choose numpy",
      "display": "array operations and broadcasting",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Developer need in introduction",
      "display": "elementwise calculations on arrays",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need",
      "display": "Integration of a callable",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Why choose scipy",
      "display": "definite numerical quadrature",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need in introduction",
      "display": "integration of a callable",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "When to consider mpmath",
      "display": "configurable working precision is the priority",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need",
      "display": "More working digits",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "Why choose mpmath",
      "display": "configurable decimal working precision",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Developer need in introduction",
      "display": "more working digits",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "When to consider numpy",
      "display": "array elementwise operations fit the calculation",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "Page introduction",
      "display": "Python math libraries let developers perform numerical calculations.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: How does this differ from a matrix or symbolic-math comparison?",
      "display": "math supplies scalar mathematical functions.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: How does this differ from a matrix or symbolic-math comparison?",
      "display": "NumPy centers on homogeneous multidimensional arrays.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: How does this differ from a matrix or symbolic-math comparison?",
      "display": "SciPy computes numerical integrals of callable functions.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: How does this differ from a matrix or symbolic-math comparison?",
      "display": "mpmath offers configurable working precision through its mp context.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Can the standard math module accept complex numbers?",
      "display": "Its functions explicitly exclude complex inputs and direct complex-number calculations to cmath.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: What does math.fsum add to ordinary floating-point summation?",
      "display": "It tracks multiple intermediate partial sums to avoid precision loss.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Can NumPy integer calculations overflow?",
      "display": "NumPy numeric types have fixed sizes and can overflow when a result needs more space.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Why does a NumPy square root sometimes return NaN instead of a complex result?",
      "display": "Negative real elements produce NaN; complex input uses the complex-valued result contract.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: How does integrating samples differ from integrating a callable?",
      "display": "NumPy trapezoid integrates supplied samples along an axis using the composite trapezoidal rule.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: How does integrating samples differ from integrating a callable?",
      "display": "SciPy quad computes a definite integral of a callable.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: Does a numerical gradient use the same input as a callable derivative?",
      "display": "NumPy gradient operates on an N-dimensional array.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: Does a numerical gradient use the same input as a callable derivative?",
      "display": "SciPy derivative evaluates an elementwise real scalar function numerically.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "FAQ: Can SciPy quadrature miss narrow pulses?",
      "display": "Sharp features narrow relative to the integration interval can be integrated incorrectly.",
      "asOf": "2026-11-17"
    },
    "F130": {
      "label": "FAQ: Is the error returned by quad a guaranteed exact error?",
      "display": "The reported absolute error is an estimate.",
      "asOf": "2026-11-17"
    },
    "F131": {
      "label": "FAQ: Should a high-precision mpmath decimal start as a Python float?",
      "display": "At high precision, construct fractional mpf values from strings; the input’s earlier rounding limits accuracy.",
      "asOf": "2026-11-17"
    },
    "F132": {
      "label": "FAQ: How can mpmath precision be changed temporarily?",
      "display": "workprec, workdps, extraprec, and extradps provide scoped precision changes.",
      "asOf": "2026-11-17"
    },
    "F133": {
      "label": "FAQ: What does Text output mean for a numerical library?",
      "display": "NumPy savetxt saves an array to a text file.",
      "asOf": "2026-11-17"
    },
    "F134": {
      "label": "Library name, numpy",
      "display": "NumPy",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Monthly downloads, numpy",
      "display": "1.1B",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "License, numpy",
      "display": "BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Package release, numpy",
      "display": "2.5.5",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Package release date, numpy",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Install, numpy",
      "display": "pip install numpy",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Quickstart, numpy",
      "display": "import numpy as np\n\na = np.array([[1, 2], [3, 5]])\n\nb = np.array([1, 2])\n\nx = np.linalg.solve(a, b)\n\nx\n",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Repository stars, numpy",
      "display": "33.4K",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Adjustable decimal precision, numpy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Sparse matrix storage, numpy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Mathematical interface and execution model, numpy",
      "display": "Homogeneous array computing, broadcasting, elementwise functions, and numerical linear algebra form the core mathematical interface. Machine/extended floating dtypes have fixed representations; an object array containing another library’s numbers is not a native adjustable-precision scalar type.",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Project function, numpy",
      "display": "def row_norms(X, squared=False):\n    \"\"\"Row-wise (squared) Euclidean norm of X.\n\n    Equivalent to np.sqrt((X * X).sum(axis=1)), but also supports sparse\n    matrices and does not create an X.shape-sized temporary.\n\n    Performs no input validation.\n\n    Parameters\n    ----------\n    X : array-like\n        The input array.\n    squared : bool, default=False\n        If True, return squared norms.\n\n    Returns\n    -------\n    array-like\n        The row-wise (squared) Euclidean norm of X.\n    \"\"\"\n    if sparse.issparse(X):\n        X = X.tocsr()\n        norms = csr_row_norms(X)\n        if not squared:\n            norms = np.sqrt(norms)\n    else:\n        xp, _ = get_namespace(X)\n        if _is_numpy_namespace(xp):\n            X = np.asarray(X)\n            norms = np.einsum(\"ij,ij->i\", X, X)\n            norms = xp.asarray(norms)\n        else:\n            norms = xp.sum(xp.multiply(X, X), axis=1)\n        if not squared:\n            norms = xp.sqrt(norms)\n    return norms\n",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Project source file, numpy",
      "display": "sklearn/utils/extmath.py",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Project full_name, numpy",
      "display": "scikit-learn/scikit-learn",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Project stargazers_count, numpy",
      "display": "68.2K",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Library name, scipy",
      "display": "SciPy",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Monthly downloads, scipy",
      "display": "392.1M",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "License, scipy",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Package release, scipy",
      "display": "1.18.1",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Package release date, scipy",
      "display": "Aug 2026",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Install, scipy",
      "display": "pip install scipy",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Quickstart, scipy",
      "display": "import numpy as np\n\na = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])\n\nb = np.array([2, 4, -1])\n\nfrom scipy.linalg import solve\n\nx = solve(a, b)\n\nx\n\na @ x == b\n",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Repository stars, scipy",
      "display": "15.2K",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Adjustable decimal precision, scipy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Sparse matrix storage, scipy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Mathematical interface and execution model, scipy",
      "display": "Scientific numerical algorithms complement NumPy arrays: integration, differential equations, optimization, special functions, signal processing, and sparse solvers. A dedicated algorithm library is a different choice from an array container; installing NumPy and SciPy together is explicitly recommended in the SciPy FAQ.",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project function, scipy",
      "display": "def scipy_spsolve(A, b):\n    logger.debug(\"Scipy Solver - Solving linear system with scipy.sparse.linalg.spsolve\")\n    indptr, indices, data = A.getValuesCSR()\n    Asp = scipy.sparse.csr_matrix((data, indices, indptr))\n    # SciPy's spsolve uses UMFPACK only when scikits.umfpack is installed and\n    # applicable; otherwise it falls back to SuperLU.\n    x = scipy.sparse.linalg.spsolve(Asp, onp.array(b))\n\n    # TODO: try https://jax.readthedocs.io/en/latest/_autosummary/jax.experimental.sparse.linalg.spsolve.html\n    # x = jax.experimental.sparse.linalg.spsolve(av, aj, ai, b)\n\n    logger.debug(\"Scipy Solver - Finished solving, linear solve res = %.3g\",\n                 np.linalg.norm(Asp @ x - b))\n    return x\n",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Project source file, scipy",
      "display": "jax_fem/solver.py",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Project full_name, scipy",
      "display": "deepmodeling/jax-fem",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Project stargazers_count, scipy",
      "display": "784",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Library name, sympy",
      "display": "SymPy",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Monthly downloads, sympy",
      "display": "169.9M",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "License, sympy",
      "display": "BSD",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Package release, sympy",
      "display": "1.14.0",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Package release date, sympy",
      "display": "Apr 2025",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Install, sympy",
      "display": "pip install sympy",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Quickstart, sympy",
      "display": "from sympy import Matrix\n\nM = Matrix(3, 3, [0, 1, 1, 1, 0, 0, 1, 1, 1])\n\nM.eigenvals()\n",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Official description, sympy",
      "display": "Performs computer algebra in Python.",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Quickstart source file, sympy",
      "display": "latest/modules/matrices/matrices.html",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Repository stars, sympy",
      "display": "15.1K",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Adjustable decimal precision, sympy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Sparse matrix storage, sympy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Mathematical interface and execution model, sympy",
      "display": "Computer algebra with exact expressions and symbolic matrices; evalf(n) computes configurable-digit numerical approximations of expressions. Symbolic representation and adjustable-precision numerical output are separate capabilities, and binary Python floats can lose digits before SymPy receives them.",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project function, sympy",
      "display": "def _apply_geometric_transformations(self, theta, mu, symbolic):\n\n    if symbolic:\n        # Angle symbolique qui paramètre la rotation du joint en cours\n        symbolic_frame_matrix = np.eye(4)\n\n        # Apply translation matrix\n        symbolic_frame_matrix = symbolic_frame_matrix * sympy.Matrix(geometry.homogeneous_translation_matrix(*self.origin_translation))\n\n        # Apply orientation matrix\n        symbolic_frame_matrix = symbolic_frame_matrix * geometry.cartesian_to_homogeneous(geometry.rpy_matrix(*self.origin_orientation))\n\n        # Apply rotation matrix\n        if self.has_rotation:\n            symbolic_frame_matrix = symbolic_frame_matrix * geometry.cartesian_to_homogeneous(geometry.symbolic_axis_rotation_matrix(self.rotation, theta), matrix_type=\"sympy\")\n\n        # Apply translation\n        if self.has_translation:\n            translation_vector = self.translation * mu\n            symbolic_frame_matrix = symbolic_frame_matrix * geometry.get_symbolic_translation_matrix(translation_vector)\n\n        symbolic_frame_matrix = sympy.lambdify([theta, mu], symbolic_frame_matrix, \"numpy\")\n\n        return symbolic_frame_matrix\n\n    else:\n        # Init the transformation matrix\n        frame_matrix = np.eye(4)\n\n        # First, apply translation matrix\n        frame_matrix = np.dot(frame_matrix, geometry.homogeneous_translation_matrix(*self.origin_translation))\n\n        # Apply orientation\n        frame_matrix = np.dot(frame_matrix, geometry.cartesian_to_homogeneous(geometry.rpy_matrix(*self.origin_orientation)))\n\n        # Apply rotation matrix\n        if self.has_rotation:\n            frame_matrix = np.dot(frame_matrix, geometry.cartesian_to_homogeneous(geometry.axis_rotation_matrix(self.rotation, theta)))\n\n        # Apply translation\n        if self.has_translation:\n            translation_vector = self.translation * mu\n            frame_matrix = np.dot(frame_matrix, geometry.get_translation_matrix(translation_vector))\n\n        return frame_matrix\n",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Project source file, sympy",
      "display": "src/ikpy/link.py",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Project full_name, sympy",
      "display": "Phylliade/ikpy",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Project stargazers_count, sympy",
      "display": "1.0K",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Library name, mpmath",
      "display": "mpmath",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Monthly downloads, mpmath",
      "display": "168.4M",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "License, mpmath",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Package release, mpmath",
      "display": "1.4.1",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Package release date, mpmath",
      "display": "Mar 2026",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Install, mpmath",
      "display": "pip install mpmath==1.4.1",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Quickstart, mpmath",
      "display": "from mpmath import mp\nwith mp.workdps(50):\n    print(mp.sqrt(2))\n",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Repository stars, mpmath",
      "display": "1.2K",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Adjustable decimal precision, mpmath",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Sparse matrix storage, mpmath",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Mathematical interface and execution model, mpmath",
      "display": "Arbitrary-precision floating-point real/complex arithmetic with context decimal working precision and numerical special functions/calculus. It is a numerical library rather than a computer algebra system. Matrix storage uses a sparse dictionary; this does not assert SciPy-style sparse formats or high-performance sparse solvers.",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Library name, torch",
      "display": "PyTorch",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Monthly downloads, torch",
      "display": "59.5M",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "License, torch",
      "display": "Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Package release, torch",
      "display": "2.15.0",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Package release date, torch",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Install, torch",
      "display": "pip install torch",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Quickstart, torch",
      "display": "import torch\n\nA = torch.randn(3, 3)\nb = torch.randn(3)\nx = torch.linalg.solve(A, b)\nprint(x)\n",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Official description, torch",
      "display": "Computes with tensors and dynamic neural networks on GPUs.",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Quickstart source file, torch",
      "display": "generated/torch.linalg.solve.html",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Repository stars, torch",
      "display": "105.6K",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Adjustable decimal precision, torch",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Sparse matrix storage, torch",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Mathematical interface and execution model, torch",
      "display": "Tensor arithmetic, numerical linear algebra, differentiation, and accelerator execution are available alongside neural-network tooling. Broad PyTorch package downloads include model workloads and do not measure use as a general mathematics library.",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Project function, torch",
      "display": "def focus_of_attention(poses: Float[Tensor, \"*num_poses 4 4\"], initial_focus: Float[Tensor, \"3\"]) -> Float[Tensor, \"3\"]:\n    \"\"\"Compute the focus of attention of a set of cameras. Only cameras\n    that have the focus of attention in front of them are considered.\n\n     Args:\n        poses: The poses to orient.\n        initial_focus: The 3D point views to decide which cameras are initially activated.\n\n    Returns:\n        The 3D position of the focus of attention.\n    \"\"\"\n    # References to the same method in third-party code:\n    # https://github.com/google-research/multinerf/blob/1c8b1c552133cdb2de1c1f3c871b2813f6662265/internal/camera_utils.py#L145\n    # https://github.com/bmild/nerf/blob/18b8aebda6700ed659cb27a0c348b737a5f6ab60/load_llff.py#L197\n    active_directions = -poses[:, :3, 2:3]\n    active_origins = poses[:, :3, 3:4]\n    # initial value for testing if the focus_pt is in front or behind\n    focus_pt = initial_focus\n    # Prune cameras which have the current have the focus_pt behind them.\n    active = torch.sum(active_directions.squeeze(-1) * (focus_pt - active_origins.squeeze(-1)), dim=-1) > 0\n    done = False\n    # We need at least two active cameras, else fallback on the previous solution.\n    # This may be the \"poses\" solution if no cameras are active on first iteration, e.g.\n    # they are in an outward-looking configuration.\n    while torch.sum(active.int()) > 1 and not done:\n        active_directions = active_directions[active]\n        active_origins = active_origins[active]\n        # https://en.wikipedia.org/wiki/Line–line_intersection#In_more_than_two_dimensions\n        m = torch.eye(3) - active_directions * torch.transpose(active_directions, -2, -1)\n        mt_m = torch.transpose(m, -2, -1) @ m\n        focus_pt = torch.linalg.inv(mt_m.mean(0)) @ (mt_m @ active_origins).mean(0)[:, 0]\n        active = torch.sum(active_directions.squeeze(-1) * (focus_pt - active_origins.squeeze(-1)), dim=-1) > 0\n        if active.all():\n            # the set of active cameras did not change, so we're done.\n            done = True\n    return focus_pt\n",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Project source file, torch",
      "display": "nerfstudio/cameras/camera_utils.py",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Project full_name, torch",
      "display": "nerfstudio-project/nerfstudio",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Project stargazers_count, torch",
      "display": "12.2K",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Library name, dask",
      "display": "Dask",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Monthly downloads, dask",
      "display": "31.6M",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "License, dask",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Package release, dask",
      "display": "2026.8.0",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Package release date, dask",
      "display": "Aug 2026",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Install, dask",
      "display": "pip install \"dask[array]\"",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Quickstart, dask",
      "display": "import dask.array as da\n\nx = da.eye(2, chunks=2)\nu, s, v = da.linalg.svd(x)\nprint(s.compute())\n",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Official description, dask",
      "display": "Runs PyData workloads in parallel with task scheduling.",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Quickstart source file, dask",
      "display": "array-api and generated/dask.array.linalg.svd.html",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Repository stars, dask",
      "display": "14.0K",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Adjustable decimal precision, dask",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Sparse matrix storage, dask",
      "display": "Via plugin",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Mathematical interface and execution model, dask",
      "display": "Dask Array applies a NumPy-like interface to chunked task graphs, with deferred computation and explicit compute. It can work with supported alternative chunk types; it does not introduce a native arbitrary-precision numeric scalar type. Whole-package counters also include scheduling/dataframe workloads.",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Project function, dask",
      "display": "def fit_transform(self, X, y=None):\n    \"\"\"Fit model to X and perform dimensionality reduction on X.\n\n    Parameters\n    ----------\n    X : array-like, shape (n_samples, n_features)\n        Training data.\n\n    y : Ignored\n\n    Returns\n    -------\n    X_new : array, shape (n_samples, n_components)\n        Reduced version of X. This will always be a dense array, of the\n        same type as the input array. If ``X`` was a ``dask.array``, then\n        ``X_new`` will be a ``dask.array`` with the same chunks along the\n        first dimension.\n    \"\"\"\n    X = self._check_array(X)\n    if self.algorithm not in {\"tsqr\", \"randomized\"}:\n        raise ValueError(\n            \"`algorithm` must be 'tsqr' or 'randomized', not '{}'\".format(\n                self.algorithm\n            )\n        )\n    if self.algorithm == \"tsqr\":\n        u, s, v = da.linalg.svd(X)\n        u = u[:, : self.n_components]\n        s = s[: self.n_components]\n        v = v[: self.n_components]\n    else:\n        u, s, v = da.linalg.svd_compressed(\n            X, self.n_components, n_power_iter=self.n_iter, seed=self.random_state\n        )\n    if not DASK_2_26_0:\n        u, v = svd_flip(u, v)\n\n    X_transformed = u * s\n    explained_var = X_transformed.var(axis=0)\n    full_var = X.var(axis=0).sum()\n    explained_variance_ratio = explained_var / full_var\n\n    if self.compute:\n        v, explained_var, explained_variance_ratio, s = compute(\n            v, explained_var, explained_variance_ratio, s\n        )\n    self.components_ = v\n    self.explained_variance_ = explained_var\n    self.explained_variance_ratio_ = explained_variance_ratio\n    self.singular_values_ = s\n    self.n_features_in_ = X.shape[1]\n    return X_transformed\n",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Project source file, dask",
      "display": "dask_ml/decomposition/truncated_svd.py",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Project full_name, dask",
      "display": "dask/dask-ml",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Project stargazers_count, dask",
      "display": "951",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Library name, numexpr",
      "display": "NumExpr",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Monthly downloads, numexpr",
      "display": "14.4M",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "License, numexpr",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Package release, numexpr",
      "display": "2.14.2",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Package release date, numexpr",
      "display": "Jul 2026",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Install, numexpr",
      "display": "pip install numexpr==2.14.2 numpy==2.5.5",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Quickstart, numexpr",
      "display": "import numpy as np\nimport numexpr as ne\na = np.arange(10)\nprint(ne.evaluate(\"a**2 + 1\", local_dict={\"a\": a}))\n",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Official description, numexpr",
      "display": "Evaluates numerical expressions on NumPy arrays.",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Quickstart source file, numexpr",
      "display": "doc/user_guide.rst",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Repository stars, numexpr",
      "display": "2.5K",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Adjustable decimal precision, numexpr",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Sparse matrix storage, numexpr",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Mathematical interface and execution model, numexpr",
      "display": "A numerical-expression virtual machine evaluates supported elementwise NumPy-array arithmetic from strings, with a bounded numeric type set and configurable CPU thread pool. This is not unrestricted Python evaluation, a general linear-algebra engine, or an arbitrary-precision numeric type.",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Project function, numexpr",
      "display": "def _evaluate(self):\n    import numexpr as ne\n\n    # convert the expression to a valid numexpr expression\n    s = self.convert()\n\n    env = self.expr.env\n    scope = env.full_scope\n    _check_ne_builtin_clash(self.expr)\n    return normalize_numexpr_result(ne.evaluate(s, local_dict=scope))\n",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Project source file, numexpr",
      "display": "pandas/core/computation/engines.py",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Project full_name, numexpr",
      "display": "pandas-dev/pandas",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Project stargazers_count, numexpr",
      "display": "49.6K",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Library name, jax",
      "display": "JAX",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Monthly downloads, jax",
      "display": "12.8M",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "License, jax",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Package release, jax",
      "display": "0.12.1",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Package release date, jax",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Install, jax",
      "display": "pip install jax",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Quickstart, jax",
      "display": "import jax.numpy as jnp\n\nx = jnp.array([[1., 2., 3.], [4., 5., 7.]])\nprint(jnp.linalg.norm(x))\n",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Official description, jax",
      "display": "Differentiates, compiles, and transforms NumPy code.",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "Quickstart source file, jax",
      "display": "_autosummary/jax.numpy.linalg.norm.html and README.md",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Repository stars, jax",
      "display": "36.6K",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Adjustable decimal precision, jax",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Sparse matrix storage, jax",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Mathematical interface and execution model, jax",
      "display": "NumPy-style numerical arrays plus automatic differentiation and compilation transformations, with supported accelerator backends. Default dtype policy favors32-bit values, and enabling X64 changes allowed fixed-width types rather than creating arbitrary-precision arithmetic.",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Project function, jax",
      "display": "def operator_to_matrix(operator_fn, problem):\n    \"\"\"Only used for when debugging.\n    Can be used to print the matrix, check the conditional number, etc.\n    \"\"\"\n    J = jax.jacfwd(operator_fn)(np.zeros(problem.num_total_dofs_all_vars))\n    return J\n",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Project source file, jax",
      "display": "jax_fem/solver.py",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Project full_name, jax",
      "display": "deepmodeling/jax-fem",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "Project stargazers_count, jax",
      "display": "784",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python math libraries math NumPy SciPy mpmath code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
