01-基石题-test

This commit is contained in:
严浩
2026-01-09 17:15:50 +08:00
parent 97154d4b5b
commit f5c6f1d20f
26 changed files with 0 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)