Skip to content

Commit a6ba97a

Browse files
committed
Rel 0.1.0
1 parent 08a948c commit a6ba97a

File tree

8 files changed

+600
-388
lines changed

8 files changed

+600
-388
lines changed

research/diff_eq.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using ComponentArrays
2+
using OrdinaryDiffEq
3+
using LinearAlgebra
4+
using Unitful
5+
6+
function newton(du, u, p, t)
7+
mu = 398600.4418u"km^3/s^2"
8+
r = norm(u.r)
9+
du.r = u.v
10+
du.v = -mu .* u.r / r^3
11+
end
12+
13+
r0 = [1131.340, -2282.343, 6672.423]u"km"
14+
v0 = [-5.64305, 4.30333, 2.42879]u"km/s"
15+
Δt = 86400.0*365u"s"
16+
rv0 = ComponentArray(r=r0, v=v0)
17+
18+
prob = ODEProblem(newton, rv0, (0.0u"s", Δt))
19+
@time sol = solve(prob, Vern8(), dt=100u"s", adaptive=false)
20+
#sol |> display
21+
println()
22+
23+
@time sol2 = solve(prob, Tsit5(), dt=100u"s",adaptive=false)
24+
25+
sol2.u[1].r |> display
26+
sol2.u[1].v |> display

research/interators_map.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
Iterators.map(x -> x^2, 1:3) |> display
3+
println()
4+
5+
collect(Iterators.map(x -> x^2, 1:3)) |> display
6+
7+
mapreduce(isodd, +, 1:5) |> display

research/macro_funs.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Is a macro useful for the helper functions in AG(), MAG(), etc?
2+
3+
module C
4+
macro makefunc(ex)
5+
return esc(quote
6+
wat() = $ex
7+
end)
8+
end
9+
end
10+
11+
using .C
12+
13+
C.@makefunc(345)
14+
15+
wat() |> display

research/sort_natural.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function natural(x, y)
2+
k(x) = [occursin(r"\d+", s) ? parse(Int, s) : s
3+
for s in split(replace(x, r"\d+" => s->" $s "))]
4+
A = k(x); B= k(y)
5+
for (a, b) in zip(A, B)
6+
if !isequal(a, b)
7+
return typeof(a) <: typeof(b) ? isless(a, b) :
8+
isa(a,Int) ? true : false
9+
end
10+
end
11+
return length(A) < length(B)
12+
end
13+
14+
sort(["a1", "a2", "a10"]) |> display
15+
16+
sort(["a1", "a2", "a10"], lt=natural) |> display

src/StructuralCausalModels.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ include("methods/all_paths.jl")
5050
include("methods/open_paths.jl")
5151
include("methods/backdoor_paths.jl")
5252
include("methods/adjustment_sets.jl")
53+
include("methods/graph_utils.jl")
5354
include("methods/ancestral_graph.jl")
55+
include("methods/ribbon_graph.jl")
5456

5557
include("utils/show_dag_path.jl")
5658
include("utils/ggm_conversions.jl")

0 commit comments

Comments
 (0)