Skip to content

Commit

Permalink
Removed dx and dt
Browse files Browse the repository at this point in the history
  • Loading branch information
Samedh Desai committed Sep 5, 2023
1 parent 70609cc commit e1996c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions docs/src/tutorials/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Dxx = Differential(x)^2
_σ = 0.5
x_0 = -2.2
x_end = 2.2
# Discretization
dx = 0.01
eq = Dx((α * x - β * x^3) * p(x)) ~ (_σ^2 / 2) * Dxx(p(x))
Expand All @@ -57,7 +55,7 @@ lb = [x_0]
ub = [x_end]
function norm_loss_function(phi, θ, p)
function inner_f(x, θ)
dx * phi(x, θ) .- 1
0.01 * phi(x, θ) .- 1
end
prob = IntegralProblem(inner_f, lb, ub, θ)
norm2 = solve(prob, HCubatureJL(), reltol = 1e-8, abstol = 1e-8, maxiters = 10)
Expand Down Expand Up @@ -98,7 +96,7 @@ using Plots
C = 142.88418699042 #fitting param
analytic_sol_func(x) = C * exp((1 / (2 * _σ^2)) * (2 * α * x^2 - β * x^4))
xs = [infimum(d.domain):dx:supremum(d.domain) for d in domains][1]
xs = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1]
u_real = [analytic_sol_func(x) for x in xs]
u_predict = [first(phi(x, res.u)) for x in xs]
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/param_estim.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, Tsit5(), dt = 0.1)
ts = [infimum(d.domain):dt:supremum(d.domain) for d in domains][1]
ts = [infimum(d.domain):0.01:supremum(d.domain) for d in domains][1]
function getData(sol)
data = []
us = hcat(sol(ts).u...)
Expand Down Expand Up @@ -130,7 +130,7 @@ And then finally some analysis by plotting.

```@example param_estim
minimizers = [res.u.depvar[depvars[i]] for i in 1:3]
ts = [infimum(d.domain):(dt / 10):supremum(d.domain) for d in domains][1]
ts = [infimum(d.domain):(0.001):supremum(d.domain) for d in domains][1]
u_predict = [[discretization.phi[i]([t], minimizers[i])[1] for t in ts] for i in 1:3]
plot(sol)
plot!(ts, u_predict, label = ["x(t)" "y(t)" "z(t)"])
Expand Down

0 comments on commit e1996c6

Please sign in to comment.