This is what I did:
using ModelingToolkit
@parameters t
@variables a(t) b(t) c[1:2](t)
# then calculate:
(c' * [a, b]) * c
I think (c' * [a, b])
can be a scalar, so the dimension is correct.
julia> size(c' * [a, b])
()
julia> size(c)
(2,)
But it raised an error:
ERROR: MethodError: no method matching iterate(::Term{Num, Nothing})
Closest candidates are:
iterate(::Union{LinRange, StepRangeLen}) at range.jl:664
iterate(::Union{LinRange, StepRangeLen}, ::Int64) at range.jl:664
iterate(::T) where T<:Union{Base.KeySet{var"#s77", var"#s76"} where {var"#s77", var"#s76"<:Dict}, Base.ValueIterator{var"#s75"} where var"#s75"<:Dict} at dict.jl:693
...
Stacktrace:
[1] copyto!(dest::Vector{Any}, src::Term{Num, Nothing})
@ Base ./abstractarray.jl:843
[2] _collect(cont::UnitRange{Int64}, itr::Term{Num, Nothing}, #unused#::Base.HasEltype, isz::Base.HasLength)
@ Base ./array.jl:608
[3] collect
@ ./array.jl:602 [inlined]
[4] broadcastable
@ ./broadcast.jl:682 [inlined]
[5] broadcasted
@ ./broadcast.jl:1312 [inlined]
[6] broadcast(::typeof(*), ::Term{Num, Nothing}, ::Symbolics.ArrayOp{AbstractVector{Real}})
@ Base.Broadcast ./broadcast.jl:821
[7] materialize(bc::Base.Broadcast.Broadcasted{Symbolics.SymWrapBroadcast, Nothing, typeof(*), Tuple{Num, Symbolics.Arr{Num, 1}}})
@ Symbolics ~/.julia/packages/Symbolics/mFWWM/src/array-lib.jl:169
[8] broadcast_preserving_zero_d
@ ./broadcast.jl:872 [inlined]
[9] *(A::Num, B::Symbolics.Arr{Num, 1})
@ Base ./arraymath.jl:52
[10] top-level scope
@ REPL[39]:1
I’m not sure whether I did something wrong, hope someone can help me.