Here is what I have, that seems to be in the same ballpark as Maple, or doing Cauchy by hand.
Richardson.jl
TaylorSeries.jl
using Richardson
using Roots
t=Taylor1(pi/2,4)
extrapolate(0, rtol=Inf) do t
@show t
abs(cos(t+1)/cos(t)-1)
end
t = 0.0
t = 0.0
(0.45969769413186023, 0.0)
thus r =0.45969769413186023,
and
interval
[-0.45969769413186023,0.45969769413186023] (cos of each is a real value)
Maple gives:
-0.4161468365
by hand I got
abs(1/2)
I don’t think you need TaylorSeries.jl for this? Why do you have the abs
in there?
TaylorSeries.jl, allows for t to be defined. I didn’t need the abs in (cos(t+1)/cos(t)), I did want to show that this is less than 1 though.
You don’t need TaylorSeries:
julia> using Richardson
julia> extrapolate(0, rtol=Inf) do t
cos(t + 1) / cos(t) - 1
end
(-0.45969769413186023, 0.0)
The do t
makes an anonymous function, so this is equivalent to
julia> extrapolate(t -> cos(t + 1) / cos(t) - 1, 0)
I think it’s supposed to be infinity, not 0.45
using TaylorSeries
using Richardson
f(x)=cos(x)
t=Taylor1(1,2)
p(x)=f(t*x)
extrapolate(pi/2, rtol=Inf) do x
@show x
(p(x+1)/p(x)+3.14/2)
end
doesn’t give infinity, but it does give, 3245… , which is a lot bigger than I had
f(x)=log(x)
t=Taylor1(1,6)
p(x)=f(t*x)
extrapolate(2, rtol=Inf) do x
@show x
(p(x+1)/p(x))
end
gives me 1.9953446264741, which rounds to 2, which is what my textbook gives.