[過去ログ] 底辺私立医大を卒業した医者って頭悪いよね? Part30 (1002レス)
1-

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
814
(1): (ワッチョイ df1e-Vcku [2a02:6ea0:d348:2000:* [上級国民]]) 2024/05/22(水) 08:23:45.94 ID:g+5oxCgk0(3/8) AAS
import numpy as np

def is_acute_triangle(a, b, c):
# Calculate the squares of the lengths of the sides
a2 = np.sum((b - c) ** 2)
b2 = np.sum((a - c) ** 2)
c2 = np.sum((a - b) ** 2)

# Check the condition for acute triangle
return (a2 + b2 > c2) and (a2 + c2 > b2) and (b2 + c2 > a2)

def monte_carlo_simulation(n):
count_acute = 0
for _ in range(n):
# Generate 3 random points
a, b, c = np.random.rand(3, 2)

# Check if they form an acute triangle
if is_acute_triangle(a, b, c):
count_acute += 1

# Probability of forming an acute triangle
return count_acute / n

# Run the simulation with 1,000,000 trials
n_trials = 1000000
probability = monte_carlo_simulation(n_trials)
probability


0.274288
1-
あと 188 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.010s