TPS

Truncated Power Series struct TPS{T<:Union{Float64,ComplexF64}} <: Number

Syntax

t = TPS([number] [, use=(descriptor|tps)])

t = TPS64([real] [, use=(descriptor|tps)])

t = ComplexTPS64([number] [, use=(descriptor|tps)])

Description

Currently, GTPSA only supports TPSs with Float64 or ComplexF64 monomial coefficients.

t = TPS() creates a new TPS{Float64} (=TPS64) with all coefficients equal to zero using the Descriptor in GTPSA.desc_current

t = TPS(number) creates a new TPS equal to number. If number is a TPS, then this acts as a copy constructor, using that TPS's Descriptor (nesting TPSs is not permitted). Else, a TPS with monomial coefficient type promote_type(Float64,typeof(number)) is constructed using the Descriptor in GTPSA.desc_current

t = TPS64() creates a new TPS{Float64} with all coefficients equal to zero using the Descriptor in GTPSA.desc_current

t = TPS64(real) creates a new TPS{Float64} equal to real. If real is a TPS, then this acts as a copy constructor, using that TPS's Descriptor (nesting TPSs is not permitted). Else, a TPS with monomial coefficient type Float64 is constructed using the Descriptor in GTPSA.desc_current

t = ComplexTPS64() creates a new TPS{ComplexF64} with all coefficients equal to zero using the Descriptor in GTPSA.desc_current

t = ComplexTPS64(number) creates a new TPS{ComplexF64} equal to number. If number is a TPS, then this acts as a copy constructor, using that TPS's Descriptor (nesting TPSs is not permitted). Else, a TPS with monomial coefficient type ComplexF64 is constructed using the Descriptor in GTPSA.desc_current

Optional Keyword Argument

use=descriptor creates a new TPS having a Descriptor equal to that passed. If changing the Descriptor of a TPS, the number of variable + number of parameters must be equivalent, and invalid monomials in the new Descriptor will be removed.

use=tps creates a new TPS having a Descriptor equal to that used by the passed TPS. If changing the Descriptor of a TPS, the number of variable + number of parameters must be equivalent, and invalid monomials in the new Descriptor will be removed.

Examples


julia> GTPSA.show_header = truetrue
julia> d1 = Descriptor(1, 1); # 1 variable to order 1
julia> t1_1 = TPS()TPS64: ----------------------- # Variables: 1 Maximum order: 1 ----------------------- Coefficient Order Exponent 0.0000000000000000e+00 0 0
julia> t2_1 = TPS(5)TPS64: ----------------------- # Variables: 1 Maximum order: 1 ----------------------- Coefficient Order Exponent 5.0000000000000000e+00 0 0
julia> t3_1 = TPS(t2_1)TPS64: ----------------------- # Variables: 1 Maximum order: 1 ----------------------- Coefficient Order Exponent 5.0000000000000000e+00 0 0
julia> d2 = Descriptor(1, 10); # New Descriptor to order 10
julia> t1_2 = ComplexTPS64() # Uses d2ComplexTPS64: ----------------------- # Variables: 1 Maximum order: 10 ----------------------- Real Imag Order Exponent 0.0000000000000000e+00 0.0000000000000000e+00 0 0
julia> t2_2 = ComplexTPS64(6)ComplexTPS64: ----------------------- # Variables: 1 Maximum order: 10 ----------------------- Real Imag Order Exponent 6.0000000000000000e+00 0.0000000000000000e+00 0 0
julia> t3_2 = ComplexTPS64(t3_1, use=d2) # Promotes and changes DescriptorComplexTPS64: ----------------------- # Variables: 1 Maximum order: 10 ----------------------- Real Imag Order Exponent 5.0000000000000000e+00 0.0000000000000000e+00 0 0

Documentation

GTPSA.TPSType
TPS(ta::Union{Number,Nothing}=nothing; use::Union{Descriptor,TPS,Nothing}=nothing)
TPS{T}(ta::Union{Number,Nothing}=nothing; use::Union{Descriptor,TPS,Nothing}=nothing) where {T<:Union{Float64,ComplexF64}}

Constructor to create a new TPS equal to the real value ta. If ta is a TPS, this is equivalent to a copy constructor, with the result by default having the same Descriptor as ta. If ta is not a TPS, then the Descriptor used will by default be GTPSA.desc_current. The Descriptor for the constructed TPS can be set using use. If a TPS or ComplexTPS64 is passed to use, the Descriptor for that TPS will be used.

The constructor can also be used to create a copy of a TPS under one Descriptor to instead have a different Descriptor. In this case, invalid monomials under the new Descriptor are removed.

Input

  • ta – Any Number
  • use – (Optional) specify which Descriptor to use, default is nothing which uses the Descriptor for ta if ta isa TPS, else uses GTPSA.desc_current

Output

  • ret – New TPS equal to ta, with removal of invalid monomials if ta is a TPS and a new Descriptor is specified
source