# structural_simplify


简化代数方程并计算方程拓扑排序

函数库: TySymbolicMath

# 语法

structural_simplify(sys; simplify)

# 说明

从结构上简化系统中的代数方程并计算观察方程的拓扑排序。 当simplify=true 时,simplify 函数将在撕裂过程中应用。示例

# 示例

简化并观察常微分方程结构

创建常微分方程问题

using TySymbolicMath
using ModelingToolkit
@parameters a b
@variables t x(t) y(t) z(t) g(t) r
r=[sqrt((x+a)^2+z^2),sqrt((x-b)^2+z^2)]
D = Differential(t)
eqs=[
D(x)~y
D(y)~2*g+x-b*(x+a)/(r[1]^3)-a*(x-b)/(r[2]^3)
D(z)~g
D(g)~-2*y+z-b*z/r[1]^3-a*z/r[1]^3-a*z/r[2]^3
]
@named apollooeqsys=ODESystem(eqs,t,[x,y,z,g],[a,b])
apollooeqsys = Model apollooeqsys with 4 equations
States (4):
x(t)
y(t)
z(t)
g(t)

Parameters (2):
a
b

简化并查看方程结构

structural_simplify(apollooeqsys)
ans = Model apollooeqsys with 4 equations
States (4):
x(t)
y(t)
z(t)
g(t)

Parameters (2):
a
b

Incidence matrix:4×8 SparseArrays.SparseMatrixCSC{Num, Int64} with 12 stored entries:
 ⋅  ×  ⋅  ⋅  ×  ⋅  ⋅  ⋅
 ×  ⋅  ×  ×  ⋅  ×  ⋅  ⋅
 ⋅  ⋅  ⋅  ×  ⋅  ⋅  ×  ⋅
 ×  ×  ×  ⋅  ⋅  ⋅  ⋅  ×

# 输入参数

sys - 系统名称

sys输入为系统名称,structural_simplify将已构建好的系统简化并查看拓扑结构。

simplify - 简化

当simplify=true 时,simplify 函数将在撕裂过程中应用