Can someone elaborate on how to use `set_state`

while using `parallel_integrator`

.Specifically how exactly to specify the index of the state to be set.?

I couldn’t interpret tht documentation provided on their website!

Which package are you referring to?

That’s just a regular `i`

. The notation `set_state!(integ, u [, i::Int = 1])`

means that `set_state!`

has two methods, one accepting two arguments (`set_state!(integ, u)`

) and one accepting three arguments (`set_state!(integ, u, i)`

), where the third argument is constrained to be an `Int`

and by default having a value of `1`

if not set. In general, a method signature with a part of it in brackets `[]`

like in the one you posted means that the part in brackets is optional (though you may have to set them manually if you require certain functionality, as seems to be the case with this parallel integrator of yours).

Hi thanks!

I am new to Julia yet but however this does not seem to work as expected

Here

`pintg`

is the parallel_integrator object , `rescaled`

is the state that is to be passed in as the second `ì=2`

state, however this error message appears!if nothing is passed as the third argument it works as usual on

`i=1`

!
How did you create `pintg`

? I suspect this isn’t a parallel integrator, since it says `SimpleDiffEq.SimpleATsit5Integrator`

.

Also, posting code instead of screenshots of code will make it easier for us to help you:

```
# parallel_integrator(chaotic_ds,[u0, u1])
## set random initial-config: u_0, perturbation: perturb, perturbed-config: u_p
u_0 = randn(dim)
perturb = 10^(-5)
u_p = u0 + perturb.*randn(dim)
## set parallel_integrator object: pintg
pintg = parallel_integrator(chaotic_ds,[u_0, u_p])
```

This is how I defined it

Please provide a complete example - what is `chaotic_ds`

?

hi ! here is the main part of my code

```
dim = 25
p = (G1 = randn(dim,dim), G2 = randn(dim,dim,dim), dim=dim)
tspan = (0., 10.)
function deff(dx, x, p, t)
for j = 1:p.dim
dx[j] = p.G1[j,:]' * x + x' * p.G2[j,:,:] * x - x[j]^3
end
return nothing
end
chaotic_ds = ContinuousDynamicalSystem(deff,randn(dim) ,p );
# x0 = [randn(dim), randn(dim), randn(dim)]
# deffeq = [ODEProblem(deff, x0[i], tspan, p) for i in 1:length(x0)]
```

```
# parallel_integrator(chaotic_ds,[u0, u1])
## set random initial-config: u_0, perturbation: perturb, perturbed-config: u_p
u_0 = randn(dim)
perturb = 10^(-5)
u_p = u0 + perturb.*randn(dim)
## set parallel_integrator object: pintg
pintg = parallel_integrator(chaotic_ds,[u_0, u_p])
```

Hello,

thanks for the help @Sukera !

Here is a full MWE (which also defines `rescaled`

as its mandatory to identify the problem):

```
using DynamicalSystems
dim = 25
p = (G1 = randn(dim,dim), G2 = randn(dim,dim,dim), dim=dim)
tspan = (0., 10.)
function deff(dx, x, p, t)
for j = 1:p.dim
dx[j] = p.G1[j,:]' * x + x' * p.G2[j,:,:] * x - x[j]^3
end
return nothing
end
chaotic_ds = ContinuousDynamicalSystem(deff,randn(dim) ,p );
u_0 = randn(dim)
perturb = 10^(-5)
u_p = u_0 + perturb.*randn(dim)
pintg = parallel_integrator(chaotic_ds,[u_0, u_p])
rescaled = u_p .* 2
set_state!(pintg, rescaled, 2)
```

Which indeed errors.

Thanks @pafloxy you have identified a bug. I’ve opened a PR to fix it: Fix `set_state!` for in-place parallel integrator by Datseris · Pull Request #123 · JuliaDynamics/DynamicalSystemsBase.jl · GitHub After the PR is merged your code will work normally. Sorry about that!