1. 高校数学の「高次方程式・恒等式」関連の問題をPythonで解く
https://qiita.com/code0327/items/66efb7ac56cdea5b0b0d
Julia の SymPy でやってみる。
using SymPy
@syms x
f = x^3 - 1;
# (1)
f.(x => 2) |> string
"7"
# (2)
f.(x => 1) |> string
"0"
# (3)
factor(f) |> string
"(x - 1)*(x^2 + x + 1)"
# (4)
solve(f) |> string
"Sym[1, -1/2 - sqrt(3)*I/2, -1/2 + sqrt(3)*I/2]"

# (1)
solve(x^4 - 10x^3 +35x^2 - 50x + 24) |> string
"Sym[1, 2, 3, 4]"
# なお,
factor(x^4 - 10x^3 +35x^2 - 50x + 24) |> string
"(x - 4)*(x - 3)*(x - 2)*(x - 1)"
# (2)
solve(x^4 - 10x^2 +9) |> string
"Sym[-3, -1, 1, 3]"
# なお,
factor(x^4 - 10x^2 +9) |> string
"(x - 3)*(x - 1)*(x + 1)*(x + 3)"

# (1)
@syms a, b, c, x
solve(Eq(x^2, a*(x - 2)^2 + b*(x - 2) + c), [a, b, c]) |> string
"Dict{Any, Any}(c => 4, b => 4, a => 1)"
# (2)
@syms a, b, x
solve(Eq((3x- 4) / ((x + 2) * (x - 3)), a / (x + 2) + b / (x - 3)), [a, b])
Dict{Any, Any} with 2 entries:
b => 1
a => 2

# (1)
solve(Eq(3 / (x + 2) + 3 / (x - 2), 2)) |> string
"Sym[-1, 4]"
# (2)
solve(Eq(3 / (x + 2) + 3 / (x - 2), 0)) |> string
"Sym[0]"
# (3)
solve(Eq(sqrt(x + 3), x + 1)) |> string
"Sym[1]"
# (4)
solve(Eq(-sqrt(x + 3), x + 1)) |> string
"Sym[-2]"