How do I make dynamically named symbols?

I’m making a function that calculates the equation for the error of a given symbolic equation.

using Symbolics
function findErrorFromSym(sym)
    vars = Symbolics.get_variables(sym)
    @variables varErrs[eachindex(vars)]
    Dvars = [expand_derivatives(Differential(i)(sym)) for i in vars]
    symErr = sqrt(sum((Dvars[i]*varErrs[i])^2 for i in eachindex(vars)))
    return symErr
end

But I’m currently just using an array of variables to store the error of each variable, but this is ugly and unintuitive when working with an equation with a’s b’s and c’s.

How can I make dynamically named symbols that just have “Err” on the end?

julia> suffix_err(s::Union{Symbol,String}) = 
           Symbol(string(s,"Err"))
julia> suffix_err(:Sym)
:SymErr
julia> suffix_err("Str")
:StrErr

you could use “_err” rather than “Err”

It seems I can’t pass that to @variables.
If I try:

@variables suffix_err(:Sym)

It tries to make a variable suffix_err that is a function of :Sym.

yes – I misread the post, answering how to make symbols for Julia rather than about working with Symbolics.jl.

I think you can use the variable function in this case.