Skip to content

Commit f034149

Browse files
Merge pull request #768 from KPCCoiL/fix-C14-example
Correct physics of C14 example
2 parents d11016b + e391c41 commit f034149

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/src/examples/classical_physics.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ using OrdinaryDiffEq, Plots
1515
gr()
1616
1717
#Half-life of Carbon-14 is 5,730 years.
18-
C₁ = 5.730
18+
= 5.730
1919
2020
#Setup
2121
u₀ = 1.0
22-
tspan = (0.0, 1.0)
22+
tspan = (0.0, 30.0)
2323
2424
#Define the problem
25-
radioactivedecay(u, p, t) = -C₁ * u
25+
radioactivedecay(u, p, t) = -log(2) / t½ * u
2626
2727
#Pass to solver
2828
prob = ODEProblem(radioactivedecay, u₀, tspan)
2929
sol = solve(prob, Tsit5())
3030
3131
#Plot
3232
plot(sol, linewidth = 2, title = "Carbon-14 half-life",
33-
xaxis = "Time in thousands of years", yaxis = "Percentage left",
33+
xaxis = "Time in thousands of years", yaxis = "Ratio left",
3434
label = "Numerical Solution")
35-
plot!(sol.t, t -> exp(-C₁ * t), lw = 3, ls = :dash, label = "Analytical Solution")
35+
plot!(sol.t, t -> 2^(-t / t½), lw = 3, ls = :dash, label = "Analytical Solution")
3636
```
3737

3838
## Second Order Linear ODE

0 commit comments

Comments
 (0)