summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luacas/tex/test/polynomials/partialfractions.lua
blob: 280d4d56f39ca5f4f818357edd7a128331dc8704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
local g1 = parse("x^3+4*x^2-x-2"):topolynomial()
local f1 = parse("x^4-x^2"):topolynomial()

local g2 = parse("2*x^6-4*x^5+5*x^4-3*x^3+x^2+3*x"):topolynomial()
local f2 = parse("x^7-3*x^6+5*x^5-7*x^4+7*x^3-5*x^2+3*x-1"):topolynomial()

starttest("partial fraction decomposition")

testeq(PolynomialRing.partialfractions(g1, f1):autosimplify(), parse("((2 * (x ^ -2)) + (x ^ -1) + ((-1 + x) ^ -1) + (-1 * ((1 + x) ^ -1)))"))
testeq(PolynomialRing.partialfractions(g2, f2):autosimplify(), parse("(((-1 + x) ^ -3) + ((-1 + x) ^ -1) + ((1 + (x ^ 2)) ^ -2) + ((1 + x) * ((1 + (x ^ 2)) ^ -1)))"))

endtest()