20260109_161620_quadratic_vertex-工具openode模型MiniMax21

This commit is contained in:
严浩
2026-01-09 16:18:57 +08:00
parent f4c66010e3
commit 9488e4391c
8 changed files with 172 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# /// script
# requires-python = ">=3.11"
# dependencies = ["sympy"]
# ///
import sympy as sp
x = sp.symbols("x", real=True)
a, b, c = -2, 8, -3
y = a * x**2 + b * x + c
vertex_x = -b / (2 * a)
vertex_y = a * vertex_x**2 + b * vertex_x + c
print("=" * 50)
print("二次函数 y = -2x² + 8x - 3 求解结果")
print("=" * 50)
print(f"\n1. 顶点坐标: ({sp.nsimplify(vertex_x)}, {sp.nsimplify(vertex_y)})")
print(f" 即: x = {vertex_x}, y = {vertex_y}")
print(f"\n2. 函数最大值: y = {vertex_y}")
print(f" 由于 a = -2 < 0抛物线开口向下")
print(f" 顶点为最高点,即为最大值点。")
print(f"\n3. 对称轴: x = {vertex_x}")
print("=" * 50)