算額あれこれ

算額問題をコンピュータで解きます

いつか必要になるかも

using SymPy
@syms x, y, z
eq1 = x + y + z
eq2 = x + 3y + 4z
sympy.resultant(eq1, eq2, z)

    \(- 3 x - y\)

factor(x^2 + 1)

    \(x^{2} + 1\)

factor(x^2 + 1, gaussian=true)

    \(\left(x - i\right) \left(x + i\right)\)

factor(x^2 -2, extension=√Sym(2))

    \(\left(x - \sqrt{2}\right) \left(x + \sqrt{2}\right)\)

eq = 2^(x^2 + 2*x + 1)

    \(2^{x^{2} + 2 x + 1}\)

factor(eq, deep=true)

    \(2^{\left(x + 1\right)^{2}}\)

factor(5*x + 3*exp(2 - 7*x), deep=true, fraction=false)

    \(5 x + 3 e^{2} e^{- 7 x}\)

factor(5*x + 3*exp(2 - 7*x), deep=true)

    \(\left(5 x e^{7 x} + 3 e^{2}\right) e^{- 7 x}\)

sympy.all_roots(x^3 + x + 1)

    \(\left[\begin{smallmatrix}\operatorname{CRootOf} {\left(x^{3} + x + 1, 0\right)}\\\operatorname{CRootOf} {\left(x^{3} + x + 1, 1\right)}\\\operatorname{CRootOf} {\left(x^{3} + x + 1, 2\right)}\end{smallmatrix}\right]\)

real_roots(2x^3 - 7x^2 + 4x + 4)

    \(\displaystyle \left[\begin{smallmatrix}- \frac{1}{2}\\2\\2\end{smallmatrix}\right]\)

nroots(x^2 - 3, n=30)

    \(\left[\begin{smallmatrix}-1.73205080756887729352744634151\\1.73205080756887729352744634151\end{smallmatrix}\right]\)

@syms A
cancel( (sqrt(Sym(3)) + sqrt(Sym(15))*A)/(sqrt(Sym(2)) + sqrt(Sym(10))*A))

    \(\displaystyle \frac{\sqrt{6}}{2}\)