|
1 | 1 | using ForwardDiff: jacobian |
2 | 2 |
|
3 | | -const MC = 100000 # maximum of counts |
4 | | -const IVAL = 1e-2 # first variation |
5 | | -const RATE = 1e-3 # variation rate |
6 | | -const NEPS = 1e-12 # eps of Newton's method |
7 | | - |
8 | 3 |
|
9 | 4 | function create_diffeq(model_path::String) |
10 | 5 | lines::Vector{String} = [] |
@@ -93,7 +88,8 @@ function newtons_method!( |
93 | 88 | bifparam::Int, |
94 | 89 | n_state::Int, |
95 | 90 | dim_newton::Int, |
96 | | - n_variable::Int) |
| 91 | + n_variable::Int; |
| 92 | + NEPS::Float64) |
97 | 93 | u::Vector{Float64} = zeros(n_state) |
98 | 94 | vx::Vector{Float64} = zeros(dim_newton) |
99 | 95 | s::Matrix{Float64} = zeros(dim_newton, dim_newton + 1) |
@@ -215,12 +211,21 @@ function new_curve!( |
215 | 211 | n_state::Int, |
216 | 212 | n_param::Int=1, |
217 | 213 | n_variable::Int=n_state + 1, |
218 | | - dim_newton::Int=n_state) |
| 214 | + dim_newton::Int=n_state, |
| 215 | + MC::Int=100000, |
| 216 | + IVAL::Float64=1e-2, |
| 217 | + RATE::Float64=1e-3, |
| 218 | + NEPS::Float64=1e-12) |
| 219 | + # direction : Set to true to +IVAL, false to -IVAL |
219 | 220 | # bifparam : name(index) of bifurcation parameter |
220 | 221 | # n_state : num of state variables |
221 | 222 | # n_param : num of parameters |
222 | 223 | # n_variable : num of variables |
223 | 224 | # dim_newton : dim of Newton's method |
| 225 | + # MC : maximum of counts |
| 226 | + # IVAL : first variation |
| 227 | + # RATE : variation rate |
| 228 | + # NEPS : eps of Newton's method |
224 | 229 | count::Int = 1 |
225 | 230 | x::Vector{Float64} = zeros(n_variable) |
226 | 231 | dx::Vector{Float64} = zeros(n_variable) |
@@ -265,6 +270,7 @@ function new_curve!( |
265 | 270 | n_state, |
266 | 271 | dim_newton, |
267 | 272 | n_variable, |
| 273 | + NEPS=NEPS, |
268 | 274 | ) |
269 | 275 |
|
270 | 276 | write(FOUT1, @sprintf("%d\t", count)) |
@@ -306,6 +312,7 @@ function new_curve!( |
306 | 312 | n_state, |
307 | 313 | dim_newton, |
308 | 314 | n_variable, |
| 315 | + NEPS=NEPS, |
309 | 316 | ) |
310 | 317 |
|
311 | 318 | # maximum variation |
|
0 commit comments