@@ -17,14 +17,14 @@ function find_state_names(xml)
17
17
# nodes = findall("//x:math//x:eq/following-sibling::x:apply[1]/x:ci", root(xml), ["x"=>mathml_ns])
18
18
# vars = nodecontent.(nodes)
19
19
nodes = findall (" //x:math//x:apply/x:diff" , root (xml), [" x" => mathml_ns])
20
- vars = [nodecontent (lastelement (parentnode (n))) for n in nodes]
20
+ vars = [strip ( nodecontent (lastelement (parentnode (n) ))) for n in nodes]
21
21
return unique (vars)
22
22
end
23
23
24
24
# find the unique independent variable
25
25
function find_iv (xml)
26
26
nodes = findall (" //x:math//x:bvar/x:ci" , root (xml), [" x" => mathml_ns])
27
- ivs = unique (nodecontent .(nodes))
27
+ ivs = unique (strip .( nodecontent .(nodes) ))
28
28
if length (ivs) > 1
29
29
error (" Only one independent variable (iv) is acceptable" )
30
30
end
@@ -116,10 +116,15 @@ function flatten_equations(xml, eqs)
116
116
s = Dict (eq. lhs => eq. rhs for eq in alg)
117
117
118
118
# alg = [eq.lhs ~ substitute(eq.rhs, s) for eq in alg]
119
- for (i,eq) in enumerate (alg)
120
- eq = eq. lhs ~ substitute (eq. rhs, s)
121
- s[eq. lhs] = eq. rhs
122
- alg[i] = eq
119
+ b = true
120
+ while b
121
+ b = false
122
+ for (i,eq) in enumerate (alg)
123
+ eq = (eq. lhs ~ substitute (eq. rhs, s))
124
+ b = b || ! isequal (eq, alg[i])
125
+ s[eq. lhs] = eq. rhs
126
+ alg[i] = eq
127
+ end
123
128
end
124
129
125
130
# s = Dict(a.lhs => a.rhs for a in alg)
0 commit comments