# DifferentialEquations.jl -- change in \`remake\`?

**URL:** https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283
**Category:** Modelling & Simulations
**Created:** [February 16, 2024, 9:16am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283 "2024-02-16T09:16:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [February 16, 2024, 9:16am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/1 "2024-02-16T09:16:13Z")

</div>

Has there been a change in the `remake` function recently?

The following code worked one month ago:

```julia
prob_rm = remake(prob, u0=[], p=p_modify)
sol = solve(prob_rm, QBDF(), reltol=1e-5,tstops=t_u_switch)

```

Now, I get an error message:

```julia
Mass matrix size is incompatible with initial condition
sizing. The mass matrix must represent the `vec`
form of the initial condition `u0`, i.e.
`size(mm,1) == size(mm,2) == length(u)`

size(prob.f.mass_matrix,1): 6
length(u0): 

```

---

<div class="post-metadata">

### Author: ![vettert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vettert/32/30599_2.png) [@vettert](https://discourse.julialang.org/u/vettert)
#### Post date: [February 16, 2024, 9:48am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/2 "2024-02-16T09:48:28Z")

</div>

What do you want to express by providing an empty initial condition? I mean, that can’t really make sense?

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [February 16, 2024, 9:56am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/3 "2024-02-16T09:56:39Z")

</div>

> [@vettert](#):
>
> What do you want to express by providing an empty initial condition?

In the past, this has meant “keep default initial states”, and has made sense.

Has that been changed?

---

<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: [February 16, 2024, 11:33am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/4 "2024-02-16T11:33:31Z")

</div>

It only does if it’s a dictionary. `prob_rm = remake(prob, u0=Dict(), p=p_modify)` might do it? I’m surprised the first one ever worked.

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [February 16, 2024, 3:45pm UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/5 "2024-02-16T15:45:16Z")

</div>

I probably carried over the`remake` syntax pre-MTK. Setting `u0=[]` worked at least until late December 2023 for MTK based models; I think also until early January 2024 (I used the syntax in a notebook for a paper with revised sumbission ca Jan 12 2024.)

Since this is a `kwarg`, I’d perhaps think the default was an empty dictionary… Will check later

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [February 18, 2024, 10:03am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/6 "2024-02-18T10:03:43Z")

</div>

@ChrisRackauckas : Another change in `remake`…

```julia
ModelingToolkit.setp(prob,A)(prob,_A) #prob[A] = _A

```

Hm. This new syntax looks complex compared to the old one, but there is probably a reason for it.

However, the following does _not_ work:

```julia
ModelingToolkit.setp(prob,A)(prob,_A) #prob[A] = _A
ModelingToolkit.setp(prob,m)(prob,_m) #prob[m] = _m

```

Why? Is this because one cannot have two statements in sequence (unlikely), or because `m` is a state (while `A` is a parameter)? Note that `prob[m] = _m` did work with the deprecated syntax.

---

<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: [February 18, 2024, 10:36am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/7 "2024-02-18T10:36:15Z")

</div>

You can use the simplified forms if you want, i.e. `prob.ps[m] = _m`.

The reason is because the previous form could never be type stable or fast, so people were bypassing the system with homebrewed solutions that were type-stable. So we changed the core syntax to something that is allowed to be optimal, with some syntactic sugar for simplifications that lose performance.

---

<div class="post-metadata">

### Author: ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)
#### Post date: [February 18, 2024, 10:46am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/8 "2024-02-18T10:46:00Z")

</div>

Would that work with states, too (like in the past), or does `.ps` mean ParameterS?

---

<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: [February 18, 2024, 10:48am UTC](https://discourse.julialang.org/t/differentialequations-jl-change-in-remake/110283/9 "2024-02-18T10:48:07Z")

</div>

> [@BLI](#):
>
> or does `.ps` mean ParameterS?

It means parameters. `prob[x] = _x` works for states, and is optimal because it’s now type-stable.
