朱莉娅 DifferentialEquations.jl 说 "InexactError"
Julia DifferentialEquations.jl says "InexactError"
这是我第一次尝试复杂的耦合 ode 方程:
using DifferentialEquations
using Plots
function chaos!(dx, x, p, t)
dx[1] = 1im*((p[3] * x[1] - 2 * real(x[2])) * x[1] - 0.5) - x[1] / 2
dx[2] = -1im*(0.5 * p[2] * abs(x[2])^2 + x[2]) - x[2] * p[1] / 2
end
x0 = [1, 1];
tspan = (0, 100);
p =[0.001, 1.4, -0.95]
prob = ODEProblem(chaos!, x0, tspan, p)
sol = solve(prob,Tsit5())
结果是:
ERROR: InexactError: Float64(-0.5 - 3.45im)
Stacktrace:
[1] Real
@ .\complex.jl:44 [inlined]
[2] convert
@ .\number.jl:7 [inlined]
[3] setindex!
@ .\array.jl:903 [inlined]
[4] chaos!(dx::Vector{Float64}, x::Vector{Float64}, p::Vector{Float64}, t::Float64)
@ Main .\Untitled-1:5
[5] ODEFunction
@ C:\Users\CTCY\.julia\packages\SciMLBase\BoNUy\src\scimlfunctions.jl:345 [inlined]
.....
我不太明白它想告诉我什么。 “inexacterror”到底是什么意思?
初始条件需要复杂:
x0 = ComplexF64[1, 1];
这是我第一次尝试复杂的耦合 ode 方程:
using DifferentialEquations
using Plots
function chaos!(dx, x, p, t)
dx[1] = 1im*((p[3] * x[1] - 2 * real(x[2])) * x[1] - 0.5) - x[1] / 2
dx[2] = -1im*(0.5 * p[2] * abs(x[2])^2 + x[2]) - x[2] * p[1] / 2
end
x0 = [1, 1];
tspan = (0, 100);
p =[0.001, 1.4, -0.95]
prob = ODEProblem(chaos!, x0, tspan, p)
sol = solve(prob,Tsit5())
结果是:
ERROR: InexactError: Float64(-0.5 - 3.45im)
Stacktrace:
[1] Real
@ .\complex.jl:44 [inlined]
[2] convert
@ .\number.jl:7 [inlined]
[3] setindex!
@ .\array.jl:903 [inlined]
[4] chaos!(dx::Vector{Float64}, x::Vector{Float64}, p::Vector{Float64}, t::Float64)
@ Main .\Untitled-1:5
[5] ODEFunction
@ C:\Users\CTCY\.julia\packages\SciMLBase\BoNUy\src\scimlfunctions.jl:345 [inlined]
.....
我不太明白它想告诉我什么。 “inexacterror”到底是什么意思?
初始条件需要复杂:
x0 = ComplexF64[1, 1];