# How to deal with a differential equation that has integral expressions of other variables

**URL:** https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473
**Category:** Support
**Created:** [18 July 2025 12:29 UTC](https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473 "2025-07-18T12:29:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://brian.discourse.group/u/czx)
#### Post date: [18 July 2025 12:29 UTC](https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473/1 "2025-07-18T12:29:58Z")

</div>

# Description of problem

Hello everyone. I try to introduce a probability distribution to my model, and the model has integral terms just like:

 ![image](https://global.discourse-cdn.com/free1/uploads/brian/original/1X/a04b7759138ad55ae5e631c37cbc425d3620ae3f.png)

Where _ωD_ is the variable that has a probability density function _f(ωD)_, and _mD_, _hD_ and _nD_ are functions of _ωD_ too. They have HH-type dynamics. The other terms that have integration interval between 1 and ∞ can be solved. But terms like this cannot be simplified further. Does the  
`Equation` object of Brian support such integral expressions? I didn’t find any statement in the guide.

# Minimal code to reproduce problem

None

# What you have aready tried

I try to replace the integral term with the sum of discrete _ωD_ values, and functions related to it, just like the method of rectangular numerical integration. But state variables like _mD_ have dynamics like:

```auto
dmD/dt = alpha_mD*(1-mD) - beta_mD*mD : 1
alpha_mD = 1 / exprel( -(v + ωD*40*mV )/(10*mV) )/ms: Hz

```

Which is time-related and seems conflict to Brian’s integration method if I do it so.

# Expected output (if relevant)

# Actual output (if relevant)

# Full traceback of error (if relevant)

---

<div class="post-metadata">

### Author: ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)
#### Post date: [18 July 2025 13:13 UTC](https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473/2 "2025-07-18T13:13:07Z")

</div>

Hi @czx. I’m not familiar with this kind of model – do you have any reference to point me to? Brian’s equations do not support integrals, but there might be workarounds of the type you describe. But I’d like to understand the model better first.

---

<div class="post-metadata">

### Author: ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://brian.discourse.group/u/czx)
#### Post date: [19 July 2025 07:45 UTC](https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473/3 "2025-07-19T07:45:29Z")

</div>

Hi @mstimberg . Thanks for your reply. The model shown above is not exactly what it is. It is actually a modified version based on HH, assuming that for a macroscopic injured nerve bundle, the total membrane potential is given by the sum of ion currents of each microscopic axon. And each microscopic axon has an injury factor _ωD_, which follows a specific probability distribution, with the density distribution function _f(ωD)_. The reversal potentials and gate functions are related to _ωD_ as well. Thus for a microscopic axon with an injury factor _ωD_, its ion currents are given by:  
 ![image](https://global.discourse-cdn.com/free1/uploads/brian/original/1X/55411f9fb03b0c95e41bd32a955e4cf98cb5fede.png)  
And the total membrane potential is given by:

 ![image](https://global.discourse-cdn.com/free1/uploads/brian/original/1X/b1449c84626231cd8fbc0d5f550f58500420cefa.png)  
Expand the equation and simplified it we can get integral terms as shown in the above post. And I wonder how to solve it if Brian’s equations don’t support integrals.

---

<div class="post-metadata">

### Author: ![czx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@czx](https://brian.discourse.group/u/czx)
#### Post date: [7 August 2025 08:49 UTC](https://brian.discourse.group/t/how-to-deal-with-a-differential-equation-that-has-integral-expressions-of-other-variables/1473/4 "2025-08-07T08:49:08Z")

</div>

This question has been solved. Brian’s `synapse` can be useful to a certain extent. Later I will share a detailed solution of it.
