diff --git a/src/parameters.jl b/src/parameters.jl index 7d716c9a..64f08fb6 100644 --- a/src/parameters.jl +++ b/src/parameters.jl @@ -48,15 +48,18 @@ function set_variable_names(varnames::Vector{T}) where {T<:AbstractString} nothing end """ - get_variables(;order=get_order()) + get_variables(T::Type, [order::Int=get_order()]) -Return a `TaylorN` vector with each entry representing an +Return a `TaylorN{T}` vector with each entry representing an independent variable. It takes the default `_params_TaylorN_` values if `set_variables` hasn't been changed with the exception that `order` can be explicitely established by the user without changing internal values -for `num_vars` or `variable_names`. +for `num_vars` or `variable_names`. Ommiting `T` defaults to `Float64`. """ -get_variables(;order::Integer=get_order()) = [TaylorN(i,order=order) for i in 1:get_numvars()] +get_variables(T::Type, order::Int=get_order()) = + [TaylorN(T, i, order=order) for i in 1:get_numvars()] +get_variables(order::Int=get_order()) = + [TaylorN(Float64, i, order=order) for i in 1:get_numvars()] """ set_variables([T::Type], names::String; [order=get_order(), numvars=-1]) diff --git a/test/manyvariables.jl b/test/manyvariables.jl index 716f1b1c..44b52395 100644 --- a/test/manyvariables.jl +++ b/test/manyvariables.jl @@ -44,8 +44,10 @@ end @test get_numvars() == 2 @test get_variables()[1].order == get_order() - @test get_variables(order=2)[1].order == 2 - @test get_variables(order=3)[1] == TaylorN(1,order=3) + @test get_variables(2)[1].order == 2 + @test get_variables(3)[1] == TaylorN(1, order=3) + @test get_variables(Int, 3)[1] == TaylorN(Int, 1, order=3) + @test length(get_variables()) == get_numvars() x, y = set_variables("x y", order=6) @test x.order == 6