Skip to content

Commit

Permalink
fix: fix "mathtt{}" symbolic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye committed Oct 27, 2024
1 parent b2068db commit 492da4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Plots = "1.39"
PrecompileTools = "1.2"
ProgressMeter = "1.7.2"
SteadyStateDiffEq = "2.3.2"
SymbolicUtils = "3.7"
Symbolics = "~6.14"
SymbolicUtils = "3.5"
Symbolics = "6.4"
julia = "1.10.0"

[extras]
Expand Down
6 changes: 3 additions & 3 deletions src/HarmonicVariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ function declare_variable(name::String, independent_variable::Num)
end

"Return the name of a variable (excluding independent variables)"
function var_name(x::Num)
function var_name(x::Num)::String
var = Symbolics._toexpr(x)
return var isa Expr ? String(var.args[1]) : String(var)
var = var isa Expr ? String(var.args[1]) : String(var)
return String(replace(var, r"\\mathtt\{([^}]*)\}" => s"\1"))
end
# var_name(x::Term) = String(Symbolics._toexpr(x).args[1])
var_name(x::SymbolicUtils.Sym) = String(x.name)

0 comments on commit 492da4f

Please sign in to comment.