| 1 |
local a = DD(SymbolExpression("x") * SymbolExpression("y"), SymbolExpression("x")) |
| 2 |
local b = DD(Integer(3) * SymbolExpression("x") ^ Integer(2) + Integer(2) * SymbolExpression("x") + Integer(6), SymbolExpression("x")) |
| 3 |
local c = DD(E ^ SymbolExpression("x"), SymbolExpression("x")) |
| 4 |
local d = DD(FunctionExpression("f", {SymbolExpression("x") ^ Integer(2)})) |
| 5 |
local e = DD(SymbolExpression("x") ^ SymbolExpression("x")) |
| 6 |
local f = DD(PolynomialRing({Integer(3), Integer(4), Integer(5)}, "x")) |
| 7 |
local g = DD(LN(SymbolExpression("y")), SymbolExpression("y")) |
| 8 |
local h = DD(SymbolExpression("x") ^ SymbolExpression("n")) |
| 9 |
local i = DD(SIN((SymbolExpression("x")))) |
| 10 |
local j = DD(SIN(Integer(2) * COS(SymbolExpression("x")))) |
| 11 |
local k = DD(ARCTAN(SymbolExpression("x") ^ (Integer(1) / Integer(2)))) |
| 12 |
local l = DD(ARCSEC(SymbolExpression("x"))) |
| 13 |
|
| 14 |
starttest("derivatives") |
| 15 |
|
| 16 |
testeq(a, dparse("DD(x*y, x)")) |
| 17 |
testeq(a:autosimplify(), parse("y"), a) |
| 18 |
testeq(b:autosimplify(), parse("6 * x + 2"), b) |
| 19 |
testeq(c:autosimplify(), parse("e^x"), c) |
| 20 |
testeq(d:autosimplify(), (Integer(2) * SymbolExpression("x") * FunctionExpression("f", {SymbolExpression("x")^Integer(2)}, {Integer(1)})):autosimplify(), d) |
| 21 |
testeq(e:autosimplify(), parse("x^x * (1 + ln(x))"), e) |
| 22 |
testeq(f:autosimplify(), parse("4 + 10 * x"), f) |
| 23 |
testeq(g:autosimplify(), parse("y ^ -1"), g) |
| 24 |
testeq(h:autosimplify(), parse("n * x ^ (-1 + n)"), h) |
| 25 |
testeq(i:autosimplify(), parse("cos(x)"), i) |
| 26 |
testeq(j:autosimplify(), parse("-2 * cos(2 * cos(x)) * sin(x)"), j) |
| 27 |
testeq(k:autosimplify(), parse("1/2 * x^(-1/2) * (1+x) ^ -1"), k) |
| 28 |
testeq(l:autosimplify(), parse("abs(x)^-1 * (1 + -(x^2))^ (-1/2)"), l) |
| 29 |
|
| 30 |
endtest() |