Skip to content

Commit 4d0e7c2

Browse files
authored
Merge pull request #1184 from SciML/add_danishnorweigan_emptyset
Consider the Danish/Norwegian letter ∅ as the empty set symbol (Ø)
2 parents fa4d209 + c7cf77f commit 4d0e7c2

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
end
8282
plot_network(brusselator)
8383
```
84+
- The letter Ø (used in Danish/Norwegian alphabet) is now conisdred the same as ∅ (empty set). It can no longer be used as a species/parameter.
8485

8586
## Catalyst 14.4.1
8687
- Support for user-defined functions on the RHS when providing coupled equations

src/Catalyst.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const ExprValues = Union{Expr, Symbol, Float64, Int, Bool}
6969
const CONSERVED_CONSTANT_SYMBOL =
7070

7171
# Declares symbols which may neither be used as parameters nor unknowns.
72-
const forbidden_symbols_skip = Set([:ℯ, :pi, , :t, :∅])
72+
const forbidden_symbols_skip = Set([:ℯ, :pi, , :t, :∅, ])
7373
const forbidden_symbols_error = union(Set([:im, :nothing, CONSERVED_CONSTANT_SYMBOL]),
7474
forbidden_symbols_skip)
7575

src/dsl.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### Constants Declarations ###
22

33
# Declare various arrow types symbols used for the empty set (also 0).
4-
const empty_set = Set{Symbol}([:∅])
4+
const empty_set = Set{Symbol}([:∅, ])
55
const fwd_arrows = Set{Symbol}([:>, :(=>), :, :, :, :, :, :, :, :, :, :, :, :])
66
const bwd_arrows = Set{Symbol}([:<, :(<=), :, :, :, :, :, :, :, :, :, :, :, :,
77
Symbol("<--")])

src/spatial_reaction_systems/spatial_reactions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ end
155155
# Loops through a rate and extracts all parameters.
156156
function find_parameters_in_rate!(parameters, rateex::ExprValues)
157157
if rateex isa Symbol
158-
if rateex in [:t, :∅, :im, :nothing, CONSERVED_CONSTANT_SYMBOL]
158+
if rateex in [:t, :∅, :Ø, :im, :nothing, CONSERVED_CONSTANT_SYMBOL]
159159
error("Forbidden term $(rateex) used in transport reaction rate.")
160160
elseif !(rateex in [:ℯ, :pi, ])
161161
push!(parameters, rateex)

test/dsl/dsl_basic_model_construction.jl

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,35 @@ let
444444
@test any(isequal(I), unknowns(rn))
445445
end
446446

447+
# Test that Ø (Danish/Norwegian letter), ∅ (empty set), and 0 (zero) are equivalent.
448+
let
449+
rn1 = @reaction_network rn begin
450+
p, Ø --> X
451+
d, X --> Ø
452+
end
453+
rn2 = @reaction_network rn begin
454+
p, ∅ --> X
455+
d, X -->
456+
end
457+
rn3 = @reaction_network rn begin
458+
p, 0 --> X
459+
d, X --> 0
460+
end
461+
rn4 = @reaction_network rn begin
462+
p, Ø --> X
463+
d, X -->
464+
end
465+
rn5 = @reaction_network rn begin
466+
p, Ø --> X
467+
d, X --> 0
468+
end
469+
rn6 = @reaction_network rn begin
470+
p, ∅ --> X
471+
d, X --> 0
472+
end
473+
@test rn1 == rn2 == rn3 == rn4 == rn5 == rn6
474+
end
475+
447476
# Tests backwards and bi-directional arrows.
448477
let
449478
rn1 = @reaction_network arrowtest begin
@@ -472,7 +501,7 @@ let
472501
end
473502

474503
# Test that symbols with special meanings are handled properly.
475-
let
504+
let
476505
test_network = @reaction_network begin t * k, X -->end
477506
@test length(species(test_network)) == 1
478507
@test length(parameters(test_network)) == 1
@@ -532,7 +561,7 @@ let
532561
@test_throws Exception @eval @reaction nothing, 0 --> X
533562
@test_throws Exception @eval @reaction Γ, 0 --> X
534563
@test_throws Exception @eval @reaction ∅, 0 --> X
535-
564+
536565
# @reaction macro, symbols that cannot be a reactant.
537566
@test_throws Exception @eval @reaction 1, 0 --> im
538567
@test_throws Exception @eval @reaction 1, 0 --> nothing
@@ -541,13 +570,13 @@ let
541570
@test_throws Exception @eval @reaction 1, 0 --> pi
542571
@test_throws Exception @eval @reaction 1, 0 --> π
543572
@test_throws Exception @eval @reaction 1, 0 --> t
544-
573+
545574
# @reaction_network macro, symbols that cannot be in the rate.
546575
@test_throws Exception @eval @reaction_network begin im, 0 --> X end
547576
@test_throws Exception @eval @reaction_network begin nothing, 0 --> X end
548577
@test_throws Exception @eval @reaction_network begin Γ, 0 --> X end
549578
@test_throws Exception @eval @reaction_network begin ∅, 0 --> X end
550-
579+
551580
# @reaction_network macro, symbols that cannot be a reactant.
552581
@test_throws Exception @eval @reaction_network begin 1, 0 --> im end
553582
@test_throws Exception @eval @reaction_network begin 1, 0 --> nothing end
@@ -561,4 +590,4 @@ let
561590
@test_throws Exception @eval @reaction_network begin
562591
d, X 0
563592
end
564-
end
593+
end

0 commit comments

Comments
 (0)