diff --git a/Manifest.toml b/Manifest.toml index 35d4c71..68c93d9 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -32,14 +32,13 @@ uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" version = "0.4.5" [[Accessors]] -deps = ["CompositionsBase", "ConstructionBase", "InverseFunctions", "MacroTools"] -git-tree-sha1 = "e93c42e833e6d4bd28be7b3b56d8deb99fd51f25" +deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"] +git-tree-sha1 = "0ba8f4c1f06707985ffb4804fdad1bf97b233897" uuid = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" -version = "0.1.40" +version = "0.1.41" [Accessors.extensions] AxisKeysExt = "AxisKeys" - DatesExt = "Dates" IntervalSetsExt = "IntervalSets" LinearAlgebraExt = "LinearAlgebra" StaticArraysExt = "StaticArrays" @@ -49,7 +48,6 @@ version = "0.1.40" [Accessors.weakdeps] AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" - Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Requires = "ae029012-a4dd-5104-9daa-d747884805df" @@ -128,18 +126,6 @@ git-tree-sha1 = "d8b0439d2be438a5f2cd68ec158fe08a7b2595b7" uuid = "e2ed5e7c-b2de-5872-ae92-c73ca462fb04" version = "0.1.9" -[[BitTwiddlingConvenienceFunctions]] -deps = ["Static"] -git-tree-sha1 = "f21cfd4950cb9f0587d5067e69405ad2acd27b87" -uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b" -version = "0.1.6" - -[[CPUSummary]] -deps = ["CpuId", "IfElse", "PrecompileTools", "Static"] -git-tree-sha1 = "5a97e67919535d6841172016c9530fd69494e5ec" -uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" -version = "0.2.6" - [[ChainRulesCore]] deps = ["Compat", "LinearAlgebra"] git-tree-sha1 = "1713c74e00545bfe14605d2a2be1712de8fbcb58" @@ -150,12 +136,6 @@ weakdeps = ["SparseArrays"] [ChainRulesCore.extensions] ChainRulesCoreSparseArraysExt = "SparseArrays" -[[CloseOpenIntervals]] -deps = ["Static", "StaticArrayInterface"] -git-tree-sha1 = "05ba0d07cd4fd8b7a39541e31a7b0254704ea581" -uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9" -version = "0.1.13" - [[Combinatorics]] git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860" uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" @@ -229,10 +209,10 @@ weakdeps = ["IntervalSets", "LinearAlgebra", "StaticArrays"] ConstructionBaseStaticArraysExt = "StaticArrays" [[ControlSystemsBase]] -deps = ["DSP", "ForwardDiff", "IterTools", "LaTeXStrings", "LinearAlgebra", "MacroTools", "MatrixEquations", "MatrixPencils", "Polyester", "Polynomials", "PrecompileTools", "Printf", "Random", "RecipesBase", "SparseArrays", "StaticArraysCore", "UUIDs"] -git-tree-sha1 = "400d8ab689cf056e7499333b2b58339e16771b9d" +deps = ["DSP", "ForwardDiff", "IterTools", "LaTeXStrings", "LinearAlgebra", "MacroTools", "MatrixEquations", "MatrixPencils", "Polynomials", "PrecompileTools", "Printf", "Random", "RecipesBase", "SparseArrays", "StaticArraysCore", "UUIDs"] +path = "/home/fredrikb/.julia/dev/ControlSystems/lib/ControlSystemsBase" uuid = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e" -version = "1.12.0" +version = "1.13.1" [ControlSystemsBase.extensions] ControlSystemsBaseImplicitDifferentiationExt = ["ImplicitDifferentiation", "ComponentArrays"] @@ -241,12 +221,6 @@ version = "1.12.0" ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66" ImplicitDifferentiation = "57b37032-215b-411a-8a7c-41a003a55207" -[[CpuId]] -deps = ["Markdown"] -git-tree-sha1 = "fcbb72b032692610bfbdb15018ac16a36cf2e406" -uuid = "adafc99b-e345-5852-983c-f28acb93d879" -version = "0.3.1" - [[DSP]] deps = ["Bessels", "FFTW", "IterTools", "LinearAlgebra", "Polynomials", "Random", "Reexport", "SpecialFunctions", "Statistics"] git-tree-sha1 = "489db9d78b53e44fb753d225c58832632d74ab10" @@ -519,12 +493,6 @@ version = "0.16.5" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" -[[LayoutPointers]] -deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface"] -git-tree-sha1 = "a9eaadb366f5493a5654e843864c13d8b107548c" -uuid = "10f19ff3-798f-405d-979b-55457f8fc047" -version = "0.1.17" - [[LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" @@ -612,11 +580,6 @@ git-tree-sha1 = "72aebe0b5051e5143a079a4685a46da330a40472" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" version = "0.5.15" -[[ManualMemory]] -git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd" -uuid = "d125e4d3-2237-4719-b19c-fa641b8a4667" -version = "0.1.8" - [[Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" @@ -661,9 +624,9 @@ version = "0.5.7" [[MutableArithmetics]] deps = ["LinearAlgebra", "SparseArrays", "Test"] -git-tree-sha1 = "a2710df6b0931f987530f59427441b21245d8f5e" +git-tree-sha1 = "43122df26d27424b23577d59e2d8020f28386516" uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" -version = "1.6.0" +version = "1.6.2" [[NaNMath]] deps = ["OpenLibm_jll"] @@ -719,23 +682,11 @@ version = "1.11.0" [Pkg.weakdeps] REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" -[[Polyester]] -deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] -git-tree-sha1 = "6d38fea02d983051776a856b7df75b30cf9a3c1f" -uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" -version = "0.7.16" - -[[PolyesterWeave]] -deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] -git-tree-sha1 = "645bed98cd47f72f67316fd42fc47dee771aefcd" -uuid = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad" -version = "0.2.2" - [[Polynomials]] deps = ["LinearAlgebra", "OrderedCollections", "RecipesBase", "Requires", "Setfield", "SparseArrays"] -git-tree-sha1 = "adc25dbd4d13f148f3256b6d4743fe7e63a71c4a" +git-tree-sha1 = "27f6107dc202e2499f0750c628a848ce5d6e77f5" uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" -version = "4.0.12" +version = "4.0.13" [Polynomials.extensions] PolynomialsChainRulesCoreExt = "ChainRulesCore" @@ -773,9 +724,9 @@ uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" version = "1.11.0" [[PtrArrays]] -git-tree-sha1 = "77a42d78b6a92df47ab37e177b2deac405e1c88f" +git-tree-sha1 = "1d36ef11a9aaf1e8b74dacc6a731dd1de8fd493d" uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" -version = "1.2.1" +version = "1.3.0" [[PyCall]] deps = ["Conda", "Dates", "Libdl", "LinearAlgebra", "MacroTools", "Serialization", "VersionParsing"] @@ -867,16 +818,11 @@ version = "0.5.13" uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" -[[SIMDTypes]] -git-tree-sha1 = "330289636fb8107c5f32088d2741e9fd7a061a5c" -uuid = "94e857df-77ce-4151-89e5-788b33177be4" -version = "0.1.0" - [[SciMLBase]] deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "Expronicon", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] -git-tree-sha1 = "3e5a9c5d6432b77a271646b4ada2573f239ac5c4" +git-tree-sha1 = "a263684f4134d50fe1863184281cc04a787a96a2" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.70.0" +version = "2.71.0" [SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -949,26 +895,6 @@ weakdeps = ["ChainRulesCore"] [SpecialFunctions.extensions] SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" -[[Static]] -deps = ["CommonWorldInvalidations", "IfElse", "PrecompileTools"] -git-tree-sha1 = "87d51a3ee9a4b0d2fe054bdd3fc2436258db2603" -uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "1.1.1" - -[[StaticArrayInterface]] -deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Static"] -git-tree-sha1 = "96381d50f1ce85f2663584c8e886a6ca97e60554" -uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718" -version = "1.8.0" - - [StaticArrayInterface.extensions] - StaticArrayInterfaceOffsetArraysExt = "OffsetArrays" - StaticArrayInterfaceStaticArraysExt = "StaticArrays" - - [StaticArrayInterface.weakdeps] - OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" - StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" - [[StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454" @@ -1018,12 +944,6 @@ weakdeps = ["ChainRulesCore", "InverseFunctions"] StatsFunsChainRulesCoreExt = "ChainRulesCore" StatsFunsInverseFunctionsExt = "InverseFunctions" -[[StrideArraysCore]] -deps = ["ArrayInterface", "CloseOpenIntervals", "IfElse", "LayoutPointers", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface", "ThreadingUtilities"] -git-tree-sha1 = "f35f6ab602df8413a50c4a25ca14de821e8605fb" -uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da" -version = "0.5.7" - [[SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" @@ -1041,9 +961,9 @@ version = "2.2.1" [[SymPyCore]] deps = ["CommonEq", "CommonSolve", "Latexify", "LinearAlgebra", "Markdown", "RecipesBase", "SpecialFunctions"] -git-tree-sha1 = "d9772eaf485a2d9353b6ecf7fa36f8d81cb523d5" +git-tree-sha1 = "dbceac356a3b33d1de385278ba7ec8db97de734c" uuid = "458b697b-88f0-4a86-b56b-78b75cfb3531" -version = "0.2.7" +version = "0.2.8" weakdeps = ["TermInterface"] [SymPyCore.extensions] @@ -1063,9 +983,9 @@ version = "0.2.2" [[SymbolicUtils]] deps = ["AbstractTrees", "ArrayInterface", "Bijections", "ChainRulesCore", "Combinatorics", "ConstructionBase", "DataStructures", "DocStringExtensions", "DynamicPolynomials", "IfElse", "LinearAlgebra", "MultivariatePolynomials", "NaNMath", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "TermInterface", "TimerOutputs", "Unityper", "WeakValueDicts"] -git-tree-sha1 = "bca944105ac43be732e3bdc38e39a4ce17391137" +git-tree-sha1 = "0312d7a96d1e1dc683df96a24378469e3c1abddc" uuid = "d1185830-fcd6-423d-90d6-eec64667417b" -version = "3.8.1" +version = "3.10.1" [SymbolicUtils.extensions] SymbolicUtilsLabelledArraysExt = "LabelledArrays" @@ -1077,9 +997,9 @@ version = "3.8.1" [[Symbolics]] deps = ["ADTypes", "ArrayInterface", "Bijections", "CommonWorldInvalidations", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "IfElse", "LaTeXStrings", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "Primes", "RecipesBase", "Reexport", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArraysCore", "SymbolicIndexingInterface", "SymbolicLimits", "SymbolicUtils", "TermInterface"] -git-tree-sha1 = "493c70c2a94a96dff97523afd2fb4ea7fd346b93" +path = "/home/fredrikb/.julia/dev/Symbolics" uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7" -version = "6.22.1" +version = "6.23.0" [Symbolics.extensions] SymbolicsForwardDiffExt = "ForwardDiff" @@ -1129,12 +1049,6 @@ deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" version = "1.11.0" -[[ThreadingUtilities]] -deps = ["ManualMemory"] -git-tree-sha1 = "eda08f7e9818eb53661b3deb74e3159460dfbc27" -uuid = "8290d209-cae3-49c0-8002-c8c24d57dab5" -version = "0.5.2" - [[TimerOutputs]] deps = ["ExprTools", "Printf"] git-tree-sha1 = "d7298ebdfa1654583468a487e8e83fae9d72dac3" diff --git a/Project.toml b/Project.toml index 3bd58f6..72a56e6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SymbolicControlSystems" uuid = "886cb795-8fd3-4b11-92f6-8071e46f71c5" authors = ["Fredrik Bagge Carlson"] -version = "0.2.0" +version = "0.3.0" [deps] ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e" @@ -9,12 +9,14 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6" +SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" [compat] ControlSystemsBase = "1" Latexify = "0.14, 0.15, 0.16" SymPy = "2" +SymbolicUtils = "3.10.1" Symbolics = "6" julia = "1.10" diff --git a/src/SymbolicControlSystems.jl b/src/SymbolicControlSystems.jl index d997d01..000b61b 100644 --- a/src/SymbolicControlSystems.jl +++ b/src/SymbolicControlSystems.jl @@ -3,7 +3,7 @@ module SymbolicControlSystems using LinearAlgebra using ControlSystemsBase, SymPy, Latexify import Symbolics as Symb -import Symbolics: Num +using Symbolics: Num using InteractiveUtils export sp, @@ -11,6 +11,7 @@ export sp, latextf, Sym, @syms, + to_num, simplify, tustin, doubleeuler, @@ -25,7 +26,7 @@ const sp = SymPy.sympy# SymPy.PyCall.PyNULL() const s = SymPy.Sym("s") const z = SymPy.Sym("z") -const NumOrDiv = Union{Num, Symb.SymbolicUtils.Div, Symb.SymbolicUtils.BasicSymbolic} +const NumOrDiv = Union{Symb.Num, Symb.SymbolicUtils.Div, Symb.SymbolicUtils.BasicSymbolic} @@ -51,7 +52,13 @@ function SymPy.Sym(sys::TransferFunction) end end -function Num(sys::StateSpace{<:Any,Num}) + +""" + to_num(sys::LTISystem) + +Convert a symbolic state-space system to a symbolic expression representing a transfer function +""" +function to_num(sys::StateSpace{<:Any,Num}) # ControlSystemsBase.issiso(sys) || throw(ArgumentError("Only SISO systems are supported")) A, B, C, D = ControlSystemsBase.ssdata(sys) λ = isdiscrete(sys) ? Symb.@variables(z) : Symb.@variables(s) @@ -60,16 +67,16 @@ function Num(sys::StateSpace{<:Any,Num}) if sys.nx < 4 ex = Symb.simplify.(ex) end - length(ex) == 1 ? ex[] : ex + length(ex) == 1 ? Num(ex[]) : Num.(ex) end -function Num(sys::TransferFunction) - ControlSystemsBase.issiso(sys) || (return Num(ss(sys))) +function to_num(sys::TransferFunction) + ControlSystemsBase.issiso(sys) || (return to_num(ss(sys))) λ = isdiscrete(sys) ? Symb.@variables(z) : Symb.@variables(s) λ = λ[] num = sum(((i, t),) -> t * λ^(i-1), enumerate(reverse(numvec(sys)[]))) |> Symb.simplify den = sum(((i, t),) -> t * λ^(i-1), enumerate(reverse(denvec(sys)[]))) |> Symb.simplify - num/den # |> Symb.simplify + Num(num/den)::Symb.Num # |> Symb.simplify end """ @@ -79,12 +86,14 @@ Convert a symbolic, rational expression into a transfer function. `h` denotes th """ function ControlSystemsBase.tf(sys::Sym, h = nothing) n, d = sp.fraction(sys) - d = sp.Poly(d) # d = d.monic() # Don't do this here - n = n isa Number ? n : sp.Poly(n) - if h === nothing + if h === nothing || h isa Continuous + d = sp.Poly(d, s) + n = n isa Number ? n : sp.Poly(n, s) tf(expand_coeffs(n, s), expand_coeffs(d, s)) else + d = sp.Poly(d, z) + n = n isa Number ? n : sp.Poly(n, z) tf(expand_coeffs(n, z), expand_coeffs(d, z), h) end end @@ -101,10 +110,10 @@ expand_coeffs(n::Real, args...; numeric = false) = n function ControlSystemsBase.tf(sys::NumOrDiv, h = nothing) sp = Symb.symbolics_to_sympy(sys) G = tf(sp, h) - tf(Num.(numvec(G)[]), Num.(denvec(G)[]), G.timeevol) + tf(to_num.(numvec(G)[]), to_num.(denvec(G)[]), G.timeevol) end -Base.:(==)(s1::TransferFunction{<:Any,<:ControlSystemsBase.SisoTf{Num}}, s2::TransferFunction{<:Any,<:ControlSystemsBase.SisoTf{<:NumOrDiv}}) = isequal(Num(s1), Num(s2)) +Base.:(==)(s1::TransferFunction{<:Any,<:ControlSystemsBase.SisoTf{Num}}, s2::TransferFunction{<:Any,<:ControlSystemsBase.SisoTf{<:NumOrDiv}}) = isequal(to_num(s1), to_num(s2)) Base.promote_op(::typeof(/),::Type{NumOrDiv},::Type{NumOrDiv}) = Num # This is required to make conversion to ss work. Arithmetic operaitons on Num are super type unstable so inference fails https://github.com/JuliaSymbolics/Symbolics.jl/issues/626 @@ -113,6 +122,7 @@ function ControlSystemsBase.minreal(sys::TransferFunction{<:Any,<:ControlSystems end function ControlSystemsBase.tf(sys::StateSpace{TE,<:Sym}) where TE + simplify = sp.simplify n, p = simplify.(sp.Poly.(simplify.(sp.fraction(simplify(Sym(sys)))), s)) tf(simplify(n / p), sys.timeevol) end @@ -130,7 +140,7 @@ function ControlSystemsBase.minreal(sys::StateSpace{<:Any,<:Sym}) nsys = sp.simplify.(nsys) end -function Num(x::Sym) +function to_num(x::Sym)::Num try return Float64(x) catch diff --git a/test/runtests.jl b/test/runtests.jl index 52f9b2e..d4c0dbc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,6 +6,7 @@ z = SymbolicControlSystems.z import Symbolics import Symbolics: Num using LinearAlgebra +Base.active_repl.options.hint_tab_completes = false # This messes with sympy https://discourse.julialang.org/t/sympy-makes-repl-to-stuck/124814/6 macro test_both(G,sym) @@ -24,10 +25,10 @@ end macro test_both_symb(G,sym) quote if isdiscrete($(esc(G))) - @test isequal(Num($(esc(G))), $(esc(sym))) + @test isequal(to_num($(esc(G))), $(esc(sym))) @test isequal($(esc(G)), tf($(esc(sym)), $(esc(G)).Ts)) else - @test isequal(Num($(esc(G))), $(esc(sym))) + @test isequal(to_num($(esc(G))), $(esc(sym))) @test $(esc(G)) == tf($(esc(sym))) # @test isequal(tf(ss($(esc(G)))), tf($(esc(sym)))) # ss -> tf calls eigvals which fails on Num end @@ -288,13 +289,13 @@ end @test_both_symb tf([a], [b, c, 1], 0.1) a/(b*z^2 + c*z + 1) # Test that denominator is still monic - @test string(Num(tf([a], [1, c, b]))) == string(a/(s^2 + c*s + b)) - @test string(Num(tf([a], [1, c, b], 0.1))) == string(a/(z^2 + c*z + b)) + @test string(to_num(tf([a], [1, c, b]))) == string(a/(s^2 + c*s + b)) + @test string(to_num(tf([a], [1, c, b], 0.1))) == string(a/(z^2 + c*z + b)) # Test that denominator is still monic - @test string(Num(tf([b, a], [1, c, 1]))) == string((b*s + a)/(s^2 + c*s + 1)) - @test string(Num(tf([b, a], [1, c, 1], 0.1))) == string((b*z + a)/(z^2 + c*z + 1)) + @test string(to_num(tf([b, a], [1, c, 1]))) == string((b*s + a)/(s^2 + c*s + 1)) + @test string(to_num(tf([b, a], [1, c, 1], 0.1))) == string((b*z + a)/(z^2 + c*z + 1)) # Test that denominator is still monic @@ -307,7 +308,7 @@ end @test_both_symb tf([b, a], [1, c, 1], 0.1) (b*z + a)/(z^2 + c*z + 1) # MIMO - Num(tf([a], [1, c, b]) .* LinearAlgebra.diagm([1, 1])) + to_num(tf([a], [1, c, b]) .* LinearAlgebra.diagm([1, 1])) end @@ -323,7 +324,7 @@ end tf([a], [b, c]) end - @test Gsymbolcs == tf(Num(Gsympy)) - @test Symbolics.symbolics_to_sympy(Num(Gsymbolcs)) == Sym(Gsympy) + @test Gsymbolcs == tf(to_num(Gsympy)) + @test Symbolics.symbolics_to_sympy(to_num(Gsymbolcs)) == Sym(Gsympy) end end