diff --git a/src/taylor.jl b/src/taylor.jl index dad8de2ad..f322b6c1f 100644 --- a/src/taylor.jl +++ b/src/taylor.jl @@ -136,11 +136,11 @@ function taylor(f, x, x0, n; rationalize=true, kwargs...) # 1) substitute dummy x′ = x - x0 name = Symbol(nameof(x), "′") # e.g. Symbol("x′") x′ = only(@variables $name) - f = substitute(f, x => x′ + x0) + f = substitute(f, x => x′ + x0; kwargs...) # 2) expand f around x′ = 0 s = taylor(f, x′, n; rationalize, kwargs...) # 3) substitute back x = x′ + x0 - return substitute(s, x′ => x - x0) + return substitute(s, x′ => x - x0; kwargs...) end diff --git a/test/taylor.jl b/test/taylor.jl index d5fdd7435..d2380e1a8 100644 --- a/test/taylor.jl +++ b/test/taylor.jl @@ -66,5 +66,5 @@ eqs = substitute(eqs, Dict(sol)) # don't evaluate numerical expressions eq = y ~ 2*Num(π)*x -eq = taylor(eq, x, 1; rationalize=false, fold=false) +eq = taylor(eq, x, 0, 1; rationalize=false, fold=false) @test contains(string(eq), "π") # should not turn 2*π into 6.28...