# Taylor expansions in independent variables (support AbstractGraph)

## API

FeynmanDiagram.Taylor.ParamsTaylorType
ParamsTaylor

DataType holding the current parameters for TaylorSeries.
This part of code is adopted from TaylorSeries.jl (https://github.com/JuliaDiff/TaylorSeries.jl)

Fields:

• orders :: Int Orders (degree) of the polynomials
• num_vars :: Int Number of variables
• variable_names :: Vector{String} Names of the variables
• variable_symbols :: Vector{Symbol} Symbols of the variables

These parameters can be changed using set_variables

FeynmanDiagram.Taylor.TaylorSeriesType
mutable struct TaylorSeries{T}

A representation of a taylor series.

Members:

• name::Symbol name of the diagram
• coeffs::Dict{Vector{Int},T} The taylor expansion coefficients. The integer array define the order of corresponding coefficient.
FeynmanDiagram.Taylor.TaylorSeriesMethod
function TaylorSeries(::Type{T}, nv::Int) where {T}

Create a taylor series equal to variable with index nv. For example, if global variables are "x y", in put nv=2 generate series t=y.

Arguments:

• ::Type{T} DataType of coefficients in taylor series.
• nv::Int Index of variable.
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}

Returns a taylor series g1 * g2 representing the product of g2 with g1.

Arguments:

• g1 First taylor series
• g2 Second taylor series
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, c2::Number) where {T}

Returns a TaylorSeries representing the scalar multiplication g1*c2.

Arguments:

• g1 TaylorSeries
• c2 scalar multiple
Base.:*Method
function Base.:*(c1::Number, g2::TaylorSeries{T}) where {T}

Returns a TaylorSeries representing the scalar multiplication g2*c1.

Arguments:

• g2 TaylorSeries
• c1 scalar multiple
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, c::S) where {T,S<:Number}

Returns a taylor series g1 + c representing the addition of constant c with g1.

Arguments:

• g1 Taylor series
• c Constant
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}

Returns a taylor series g1 + g2 representing the addition of g2 with g1.

Arguments:

• g1 First taylor series
• g2 Second taylor series
Base.:+Method
function Base.:+(c::S, g1::TaylorSeries{T}) where {S<:Number,T}

Returns a taylor series g1 + c representing the addition of constant c with g1.

Arguments:

• g1 Taylor series
• c Constant
Base.:-Method
function Base.:-(g1::TaylorSeries{T,V}, g2::TaylorSeries{T,V}) where {T,V}

Returns a taylor series g1 - g2 representing the difference of g2 with g1.

Arguments:

• g1 First taylor series
• g2 Second taylor series
Base.:^Method
function Base.:^(x::TaylorSeries, p::Integer)

Return the power of taylor series x^p, where p is an integer.

Arguments:

• x Taylor series
• 'p' Power index
Base.oneMethod
function  Base.one(g::TaylorSeries{T}) where {T}

Return a constant one for a given taylor series.

Arguments:

• g Taylor series
FeynmanDiagram.Taylor.displayBigOMethod
displayBigO(d::Bool) --> nothing

Set/unset displaying of the big 𝒪 notation in the output of Taylor1 and TaylorN polynomials. The initial value is true.

FeynmanDiagram.Taylor.getcoeffMethod
function getcoeff(g::TaylorSeries, order::Vector{Int})

Return the taylor coefficients with given order in taylor series g.

Arguments:

• g Taylor series
• order Order of target coefficients
FeynmanDiagram.Taylor.getderivativeMethod
function getderivative(g::TaylorSeries, order::Vector{Int})

Return the derivative with given order in taylor series g.

Arguments:

• g Taylor series
• order Order of derivative
FeynmanDiagram.Taylor.set_variablesMethod
set_variables([T::Type], names::String; [orders=get_orders(), numvars=-1])

Return a TaylorSeries{T} vector with each entry representing an independent variable. names defines the output for each variable (separated by a space). The default type T is Float64, and the default for orders is the one defined globally.

If numvars is not specified, it is inferred from names. If only one variable name is defined and numvars>1, it uses this name with subscripts for the different variables.

julia> set_variables(Int, "x y z", orders=[4,4,4])
3-element Array{TaylorSeries.Taylor{Int},1}:
1 x + 𝒪(x⁵y⁵z⁵)
1 y + 𝒪(x⁵y⁵z⁵)
1 z + 𝒪(x⁵y⁵z⁵)
FeynmanDiagram.Taylor.taylor_binomialMethod
function taylor_binomial(o1::Vector{Int}, o2::Vector{Int})

Return the taylor binomial prefactor when product two high-order derivatives with order o1 and o2.

# Arguments:
- o1  Order of first derivative
- o2  Order of second derivative
FeynmanDiagram.Taylor.use_show_defaultMethod
use_Base_show(d::Bool) --> nothing

Use Base.show_default method (default show method in Base), or a custom display. The initial value is false, so customized display is used.