Update app.py
Browse files
app.py
CHANGED
|
@@ -92,8 +92,19 @@ elif selected_function == "関数の交点":
|
|
| 92 |
x = symbols('x', real=True)
|
| 93 |
func1 = simplify(parse_expr(func1_expression))
|
| 94 |
func2 = simplify(parse_expr(func2_expression))
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
# 三平方の定理(空欄補充)
|
| 99 |
elif selected_function == "三平方の定理":
|
|
|
|
| 92 |
x = symbols('x', real=True)
|
| 93 |
func1 = simplify(parse_expr(func1_expression))
|
| 94 |
func2 = simplify(parse_expr(func2_expression))
|
| 95 |
+
|
| 96 |
+
# 関数を数値的に解くためのラムダ関数
|
| 97 |
+
equation_system = lambda x: [func1.subs('x', x[0]) - func2.subs('x', x[0]),
|
| 98 |
+
func1.subs('x', x[1]) - func2.subs('x', x[1])]
|
| 99 |
+
|
| 100 |
+
# 初期値の設定
|
| 101 |
+
initial_guess = [0, 0]
|
| 102 |
+
|
| 103 |
+
# fsolveを使用して交点を求める
|
| 104 |
+
intersection_points = fsolve(equation_system, initial_guess)
|
| 105 |
+
|
| 106 |
+
st.success(f"関数の交点の座標: {tuple(intersection_points)}")
|
| 107 |
+
|
| 108 |
|
| 109 |
# 三平方の定理(空欄補充)
|
| 110 |
elif selected_function == "三平方の定理":
|