|
17 | 17 | @test isequal(differentiate(:(a * x ^ 2), :x), :(a * (2 * x)))
|
18 | 18 | @test isequal(differentiate(:(2 ^ x), :x), :(*(0.6931471805599453, ^(2, x))))
|
19 | 19 | @test isequal(differentiate(:(sin(x)), :x), :(cos(x)))
|
20 |
| -@test isequal(differentiate(:(cos(x)), :x), :(*(-1,sin(x)))) # needs a better simplify |
| 20 | +@test isequal(differentiate(:(cos(x)), :x), :(-sin(x))) |
21 | 21 | @test isequal(differentiate(:(tan(x)), :x), :(1 + tan(x)^2))
|
22 | 22 | @test isequal(differentiate(:(exp(x)), :x), :(exp(x)))
|
23 | 23 | @test isequal(differentiate(:(log(x)), :x), :(1 / x))
|
24 | 24 | @test isequal(differentiate(:(sin(x) + sin(x)), :x), :(cos(x) + cos(x)))
|
25 |
| -@test isequal(differentiate(:(sin(x) - cos(x)), :x), :(-(cos(x),*(-1,sin(x))))) # Simplify -(a, -(b)) => +(a, b) |
| 25 | +@test isequal(differentiate(:(sin(x) - cos(x)), :x), :(cos(x) + sin(x))) |
26 | 26 | @test isequal(differentiate(:(x * sin(x)), :x), :(sin(x) + x * cos(x)))
|
27 | 27 | @test isequal(differentiate(:(x / sin(x)), :x), :((sin(x) - x * cos(x)) / (sin(x)^2)))
|
28 | 28 | @test isequal(differentiate(:(sin(sin(x))), :x), :(*(cos(x),cos(sin(x)))))
|
29 |
| -@test isequal(differentiate(:(sin(cos(x) + sin(x))), :x), :(*(+(*(-1,sin(x)),cos(x)),cos(+(cos(x),sin(x)))))) # Clean this up |
30 |
| -@test isequal(differentiate(:(exp(-x)), :x), :(*(-1,exp(-(x))))) # Simplify this to -(exp(-x)) |
| 29 | +@test isequal(differentiate(:(sin(cos(x) + sin(x))), :x), :(*(+(-sin(x),cos(x)),cos(+(cos(x),sin(x)))))) |
| 30 | +@test isequal(differentiate(:(exp(-x)), :x), :(-exp(-x))) |
31 | 31 | @test isequal(differentiate(:(log(x^2)), :x), :(/(*(2,x),^(x,2))))
|
32 | 32 | @test isequal(differentiate(:(x^n), :x), :(*(n, ^(x, -(n, 1)))))
|
33 | 33 | @test isequal(differentiate(:(n^x), :x), :(*(^(n, x), log(n))))
|
|
47 | 47 | #
|
48 | 48 |
|
49 | 49 | # @test isequal(differentiate("sin(x) + cos(x)^2"), :(+(cos(x),*(2,cos(x)))))
|
50 |
| -@test isequal(differentiate("x + exp(-x) + sin(exp(x))", :x), :(+(1,*(-1,exp(-(x))),*(exp(x),cos(exp(x)))))) |
| 50 | +@test isequal(differentiate("x + exp(-x) + sin(exp(x))", :x), :(+(1,-exp(-x),*(exp(x),cos(exp(x)))))) |
51 | 51 |
|
52 | 52 | # TODO: Make these work
|
53 | 53 | # differentiate(:(sin(x)), :x)(0.0)
|
|
0 commit comments