Skip to content

Commit

Permalink
Lower tolerance in AD example
Browse files Browse the repository at this point in the history
  • Loading branch information
hersle committed Jan 22, 2025
1 parent ba47050 commit a54ae10
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/src/automatic_differentiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ To do so, let us write a small wrapper function that calculates the power spectr
```@example ad
using SymBoltz
M = ΛCDM()
pars = [M.γ.T₀, M.c.Ω₀, M.b.Ω₀, M.ν.Neff, M.g.h, M.b.rec.Yp, M.h.m, M.I.As, M.I.ns, M.Λ.Ω₀] # TODO: no M.Λ.Ω
prob0 = CosmologyProblem(M, Dict(pars .=> NaN))
function P(k, θ)
pars = Dict([M.γ.T₀, M.c.Ω₀, M.b.Ω₀, M.ν.Neff, M.g.h, M.b.rec.Yp, M.h.m, M.I.As, M.I.ns, M.Λ.Ω₀] .=> θ) # TODO: no Λ
prob = CosmologyProblem(M, pars) # TODO: remake
sol = solve(prob, k)
prob = remake(prob0, Dict(pars .=> θ)) # TODO: remake
sol = solve(prob, k; verbose = true, thread = true, ptopts = (alg = SymBoltz.KenCarp4(), reltol = 1e-3))
return spectrum_matter(sol, k)
end
```
Expand Down

0 comments on commit a54ae10

Please sign in to comment.