diff --git a/.gitignore b/.gitignore index f687067..af16a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.quarto/ _site tikz_*.svg +.DS_Store \ No newline at end of file diff --git a/solutions:nelson-niu/finite-sets.jl b/solutions:nelson-niu/finite-sets.jl new file mode 100644 index 0000000..36f8935 --- /dev/null +++ b/solutions:nelson-niu/finite-sets.jl @@ -0,0 +1,22 @@ +struct FinSet + n::Int +end + +struct FinFunction + dom::FinSet + codom::FinSet + values::Vector{Int} +end + +A, B = FinSet(3), FinSet(2) +f = FinFunction(A, B, [1,2,2]) + +function product(X::FinSet, Y::FinSet) + x, y = X.n, Y.n + P = FinSet(x * y) + + proj_left = FinFunction(P, X, [i for i in 1:X.n for j in 1:Y.n]) + proj_right = FinFunction(P, Y, [j for i in 1:X.n for j in 1:Y.n]) + + return P, proj_left, proj_right +end \ No newline at end of file diff --git a/solutions:nelson-niu/graphs.jl b/solutions:nelson-niu/graphs.jl new file mode 100644 index 0000000..52a4990 --- /dev/null +++ b/solutions:nelson-niu/graphs.jl @@ -0,0 +1,10 @@ +using Catlab, Catlab.CategoricalAlgebra + +@present GrphDiagram(FreeSchema) begin + E :: Ob + V :: Ob + src::Hom(E, V) + tgt::Hom(E, V) +end + +@acset_type Grph(GrphDiagram, index=[:src,:tgt]) \ No newline at end of file diff --git a/solutions:nelson-niu/helloworld.jl b/solutions:nelson-niu/helloworld.jl new file mode 100644 index 0000000..233e948 --- /dev/null +++ b/solutions:nelson-niu/helloworld.jl @@ -0,0 +1 @@ +println("Hello World") \ No newline at end of file diff --git a/solutions:nelson-niu/rabbits.jl b/solutions:nelson-niu/rabbits.jl new file mode 100644 index 0000000..1dee9cf --- /dev/null +++ b/solutions:nelson-niu/rabbits.jl @@ -0,0 +1,8 @@ +using Catlab, AlgebraicDynamics, AlgebraicDynamics.UWDDynam + +rabbits = ContinuousResourceSharer{Float64}( + 1, + 1, + (R, p, t) -> p.α*R, + [1] +) \ No newline at end of file diff --git a/solutions:nelson-niu/uwd-data.jl b/solutions:nelson-niu/uwd-data.jl new file mode 100644 index 0000000..865fce5 --- /dev/null +++ b/solutions:nelson-niu/uwd-data.jl @@ -0,0 +1,10 @@ +using Catlab.Programs.RelationalPrograms +using Catlab.Graphics.GraphvizGraphs + +my_uwd = @relation (x, y, z) where (w, x, y, z) begin + R(x, w) + S(y, w) + T(z, w) +end + +to_graphviz(R, box_labels=:name)