ちょいめも

物理/Python/Cの雑記帳

2018-06-14から1日間の記事一覧

3次方程式を解く

import numpy as np def third_order_eq(a, b, c, d): term1 = (((-27*a**2*d + 9*a*b*c - 2*b**3)**2 + 4*(3*a*c - b**2)**3)**(1/2) - 27*a**2*d + 9*a*b*c - 2*b**3)**(1/3) term2 = 3*2**(1/3)*a term3 = 3*a*c - b**2 term4 = b/(3*a) term5 = -1/(6*2*…