{"library":"numexpr","code":"import numpy as np\nimport numexpr as ne\n\n# Create large arrays for demonstrating performance benefits\na = np.arange(1_000_000, dtype=np.float64)\nb = np.arange(1_000_000, 0, -1, dtype=np.float64)\n\n# Evaluate a complex expression using numexpr\nresult_ne = ne.evaluate(\"sin(a) + arcsinh(a/b) + (a * b - 4.1 * a) > 2.5 * b\")\n\nprint(result_ne)\nprint(f\"Result type: {result_ne.dtype}\")\n\n# You can also set the number of threads dynamically\n# print(f\"Current numexpr threads: {ne.nthreads}\")\n# ne.set_num_threads(4)\n# print(f\"New numexpr threads: {ne.nthreads}\")","lang":"python","description":"This quickstart demonstrates how to import `numexpr` and use its primary `evaluate` function. It takes a string expression, which is then parsed and efficiently computed on large NumPy arrays, leveraging NumExpr's optimizations and multi-threading. The example uses common mathematical and logical operations.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}