01-基石题-test
This commit is contained in:
26
01-基石题-test/模型MiniMax21工具openode/solve.py
Normal file
26
01-基石题-test/模型MiniMax21工具openode/solve.py
Normal 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)
|
||||
Reference in New Issue
Block a user