# Packages for interval and radius of power series

**URL:** <https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package\
**Created:** [December 4, 2020, 12:10am UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230 "2020-12-04T00:10:03Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [December 8, 2020, 12:34am UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230/21 "2020-12-08T00:34:00Z")

</div>

Here is what I have, that seems to be in the same ballpark as Maple, or doing Cauchy by hand.  
[Richardson.jl](https://github.com/JuliaMath/Richardson.jl)  
[TaylorSeries.jl](http://www.juliadiff.org/TaylorSeries.jl/stable/)

```julia
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

```

```julia
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)

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 8, 2020, 5:02am UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230/22 "2020-12-08T05:02:00Z")

</div>

I don’t think you need TaylorSeries.jl for this? Why do you have the `abs` in there?

---

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [December 8, 2020, 5:03am UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230/23 "2020-12-08T05:03:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 8, 2020, 6:17am UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230/24 "2020-12-08T06:17:33Z")

</div>

> [@brett\_knoss](#):
>
> ```julia
> extrapolate(0, rtol=Inf) do t
> @show t
> abs(cos(t+1)/cos(t)-1)
> end
> 
> ```

You don’t need TaylorSeries:

```julia
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
julia> extrapolate(t -> cos(t + 1) / cos(t) - 1, 0)

```

---

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [December 8, 2020, 6:06pm UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230/25 "2020-12-08T18:06:14Z")

</div>

I think it’s supposed to be infinity, not 0.45

```julia
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

```julia
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.

[Previous page](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230.md?page=1)
