diff --git a/src/taylor.jl b/src/taylor.jl index 0c9766d85..fcd9b6c18 100644 --- a/src/taylor.jl +++ b/src/taylor.jl @@ -56,3 +56,6 @@ function taylor(f, x, x0, n; kwargs...) # 3) substitute back x = x′ + x0 return substitute(s, x′ => x - x0) end +function taylor(eq::Equation, args...; kwargs...) + return taylor(eq.lhs, args...; kwargs...) ~ taylor(eq.rhs, args...; kwargs...) +end diff --git a/test/taylor.jl b/test/taylor.jl index de927e158..9c0b9debd 100644 --- a/test/taylor.jl +++ b/test/taylor.jl @@ -26,3 +26,8 @@ end # around x ≠ 0 @test substitute(taylor(√(x), x, 1, 0:6), x => x + 1) - taylor(√(1+x), x, 0:6) == 0 + +# equations +eq = sin(2*x) ~ 2*sin(x)*cos(x) +eq = taylor(eq, x, 0:7) +@test eq.lhs - eq.rhs == 0