# Convenient parameter change for remake ODEProblem made with ODESystem

**URL:** https://discourse.julialang.org/t/convenient-parameter-change-for-remake-odeproblem-made-with-odesystem/64537
**Category:** Modelling & Simulations
**Created:** [July 12, 2021, 10:07pm UTC](https://discourse.julialang.org/t/convenient-parameter-change-for-remake-odeproblem-made-with-odesystem/64537 "2021-07-12T22:07:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ograsdijk](https://avatars.discourse-cdn.com/v4/letter/o/d26b3c/32.png) [@ograsdijk](https://discourse.julialang.org/u/ograsdijk)
#### Post date: [July 12, 2021, 10:07pm UTC](https://discourse.julialang.org/t/convenient-parameter-change-for-remake-odeproblem-made-with-odesystem/64537/1 "2021-07-12T22:07:09Z")

</div>

I’m creating an `ODESystem` using `ModelingToolkit.jl` and was wondering if for `EnsembleProblems` there is an easier way to specify the parameters in `remake`.

Example, from the documentation of `ModelingToolkit`:

```nohighlight
using ModelingToolkit
using DifferentialEquations

@variables t x(t) RHS(t)
@parameters τ 
D = Differential(t)

@named fol_separate = ODESystem([ RHS ~ (1 - x)/τ,
                                  D(x) ~ RHS ])

tspan = (0.0, 10.0)
u0 = [x => 0.0]
p = [τ => 3.0]

prob = ODEProblem(structural_simplify(fol_separate), u0, tspan, p)

τs = range(0.1,10,length = 10)

```

For an `EnsembleProblem` I create a function to modify the problem with `remake`

```nohighlight
function prob_func(prob,i,repeat)
   remake(prob, p = [τs[i]])
end

```

And then specify and solve the `EnsembleProblem`

```nohighlight
ens_prob = EnsembleProblem(prob, prob_func = prob_func)
sim = solve(ens_prob, Tsit5(), EnsembleThreads(), trajectories = size(τs)[1])

```

This is fine for smaller problems, but for systems with more parameters I first have to check the order with `parameters(fol_separate)` and then manually type it out in the correct order in `prob_func`. This is rather cumbersome and prone to errors for systems with more parameters.  
Is there some more convenient method to assign the changed parameters for `remake`?  
E.g. something like `remake(prob, p = [τ => 0.1])`; which I know doesn’t work because `p` can’t be a `vector{Pair}`.

Summarizing:  
I’m looking for a way to `remake` an `ODEProblem` created with an `ODESystem` where in `remake` I can specify which parameter to change, instead of typing out the `p = [...]` array

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [July 12, 2021, 11:26pm UTC](https://discourse.julialang.org/t/convenient-parameter-change-for-remake-odeproblem-made-with-odesystem/64537/2 "2021-07-12T23:26:43Z")

</div>

[https://mtk.sciml.ai/dev/basics/FAQ/#Transforming-value-maps-to-arrays](https://mtk.sciml.ai/dev/basics/FAQ/#Transforming-value-maps-to-arrays)

---

<div class="post-metadata">

### Author: ![ograsdijk](https://avatars.discourse-cdn.com/v4/letter/o/d26b3c/32.png) [@ograsdijk](https://discourse.julialang.org/u/ograsdijk)
#### Post date: [July 12, 2021, 11:34pm UTC](https://discourse.julialang.org/t/convenient-parameter-change-for-remake-odeproblem-made-with-odesystem/64537/3 "2021-07-12T23:34:39Z")

</div>

That clears that up, thanks.
