@@ -18,6 +18,7 @@ Further, the solution of this equation with the given boundary conditions is pre
1818``` @example wave
1919using NeuralPDE, Lux, Optimization, OptimizationOptimJL
2020using DomainSets: Interval
21+ using IntervalSets: leftendpoint, rightendpoint
2122
2223@parameters t, x
2324@variables u(..)
@@ -64,7 +65,7 @@ We can plot the predicted solution of the PDE and compare it with the analytical
6465``` @example wave
6566using Plots
6667
67- ts, xs = [infimum (d.domain):dx:supremum (d.domain) for d in domains]
68+ ts, xs = [leftendpoint (d.domain):dx:rightendpoint (d.domain) for d in domains]
6869function analytic_sol_func(t, x)
6970 sum([(8 / (k^3 * pi^3)) * sin(k * pi * x) * cos(C * k * pi * t) for k in 1:2:50000])
7071end
@@ -99,7 +100,8 @@ with grid discretization `dx = 0.05` and physics-informed neural networks. Here,
99100``` @example wave2
100101using NeuralPDE, Lux, ModelingToolkit, Optimization, OptimizationOptimJL
101102using Plots, Printf
102- using DomainSets: Interval, infimum, supremum
103+ using DomainSets: Interval
104+ using IntervalSets: leftendpoint, rightendpoint
103105
104106@parameters t, x
105107@variables u(..) Dxu(..) Dtu(..) O1(..) O2(..)
@@ -169,7 +171,7 @@ res = Optimization.solve(prob, BFGS(); maxiters = 2000)
169171phi = discretization.phi[1]
170172
171173# Analysis
172- ts, xs = [infimum (d.domain):0.05:supremum (d.domain) for d in domains]
174+ ts, xs = [leftendpoint (d.domain):0.05:rightendpoint (d.domain) for d in domains]
173175
174176μ_n(k) = (v * sqrt(4 * k^2 * π^2 - b^2 * L^2 * v^2)) / (2 * L)
175177function b_n(k)
200202gif(anim, "1Dwave_damped_adaptive.gif", fps = 200)
201203
202204# Surface plot
203- ts, xs = [infimum (d.domain):0.01:supremum (d.domain) for d in domains]
205+ ts, xs = [leftendpoint (d.domain):0.01:rightendpoint (d.domain) for d in domains]
204206u_predict = reshape(
205207 [first(phi([t, x], res.u.depvar.u)) for
206208 t in ts for x in xs], (length(ts), length(xs)))
0 commit comments