# ODE-BVP's with Unknown Parameter

**URL:** https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873
**Category:** Numerics
**Tags:** diffeq
**Created:** [September 18, 2019, 12:47am UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873 "2019-09-18T00:47:04Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![anodos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/anodos/32/212778_2.png) [@anodos](https://discourse.julialang.org/u/anodos)
#### Post date: [September 18, 2019, 12:47am UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/1 "2019-09-18T00:47:04Z")

</div>

Matlab’s bvp4c allows the user to specify ODE-BVP problems which contain an unknown parameter, and then to specify the problem by providing an extra boundary condition. E.g. for a second order ODE, we might have an extra unknown parameter, lambda, in the ODE, but then specify 3 boundary conditions rather than the usual two. This is handy for a wide range of problems.

Is there any functionality like this in DifferentialEquations.jl?

Thanks!

---

<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: [September 18, 2019, 1:50am UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/2 "2019-09-18T01:50:42Z")

</div>

Right now we don’t handle that, but it’s something we do plan on adding.

---

<div class="post-metadata">

### Author: ![DrPapa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drpapa/32/6835_2.png) [@DrPapa](https://discourse.julialang.org/u/DrPapa)
#### Post date: [September 18, 2019, 1:24pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/3 "2019-09-18T13:24:46Z")

</div>

Would it be possible to do this currently if the OP extended the state-space to include the unknown parameter with no dynamics?

---

<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: [September 18, 2019, 3:32pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/4 "2019-09-18T15:32:20Z")

</div>

Yes. Just to clarify to other users, instead of having a parameters, you can add

```julia
du[i] = 0

```

and then extend `u` to include the parameters. Since they are constant you’d get the same result, and since it’s now just another value it would act the same. Maybe this is how MATLAB supports it behind the scenes (it would mention it in the docs).

---

<div class="post-metadata">

### Author: ![anodos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/anodos/32/212778_2.png) [@anodos](https://discourse.julialang.org/u/anodos)
#### Post date: [September 18, 2019, 9:07pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/5 "2019-09-18T21:07:37Z")

</div>

Of course 🙂 I’ll give that a go!

---

<div class="post-metadata">

### Author: ![bilderbuchi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bilderbuchi/32/13562_2.png) [@bilderbuchi](https://discourse.julialang.org/u/bilderbuchi)
#### Post date: [May 14, 2020, 7:14pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/6 "2020-05-14T19:14:35Z")

</div>

Would there be a significant performance impact, as the computation would have to carry along a vector of param(x) when it’s actually only one value (i.e. your state space size would grow by 50% in this example), or can Julia take advantage of the fact that all values are identical, under the hood?

---

<div class="post-metadata">

### Author: ![psillano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/psillano/32/211177_2.png) [@psillano](https://discourse.julialang.org/u/psillano)
#### Post date: [August 8, 2024, 4:34pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/7 "2024-08-08T16:34:49Z")

</div>

Is this solution working? Could you provide an example?

---

<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: [August 9, 2024, 11:17pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/8 "2024-08-09T23:17:14Z")

</div>

Did you give it a try?

> [@bilderbuchi](#):
>
> Would there be a significant performance impact, as the computation would have to carry along a vector of param(x) when it’s actually only one value (i.e. your state space size would grow by 50% in this example), or can Julia take advantage of the fact that all values are identical, under the hood?

It will increase the Jacobian size so it will increase the cost. The other way of doing this via NonlinearLeastSquaresProblem also has to increase the cost a bit too, it’s just somewhat required.

---

<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: [August 9, 2024, 11:17pm UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/9 "2024-08-09T23:17:29Z")

</div>

> [@psillano](#):
>
> Is this solution working? Could you provide an example?

Did you try what was mentioned above?

---

<div class="post-metadata">

### Author: ![psillano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/psillano/32/211177_2.png) [@psillano](https://discourse.julialang.org/u/psillano)
#### Post date: [August 12, 2024, 9:50am UTC](https://discourse.julialang.org/t/ode-bvps-with-unknown-parameter/28873/10 "2024-08-12T09:50:59Z")

</div>

> [@ChrisRackauckas](#):
>
> NonlinearLeastSquaresProblem

Yes, but I get a Rank deficiency matrix error! I opened a new post explaining a bit better my problem: [here](https://discourse.julialang.org/t/bvp-shooting-method-with-free-parameters/117955/3)
