# Solution Space of a Stability Equation

Written by Paul Bourke
April 1997

This note describes various approachs taken to understanding the position of the roots to a stability equation [Robinson, Rennie, Wright] as given below.

Derived from
```   Qe = 1 / (1 + exp(a[Ve - 3]))
Qi = 1 / (1 + exp(a[Vi - 3]))
Ve = g * {Bee * Qe - Bie * Qi + Mee * Qns + Aee * Qe}
Vi = g * {Bei * Qe - Bii * Qi + Mei * Qns + Aei * Qe}
```

Where

```   V1 = Aee + Bee
V2 = Aei + Bei
V3 = Bii / Bie
V4 = Mee * Qns
V5 = Mei * Qns
V6 = Bie
```
where Qe is the state variable and V1, V2, V3, V4, V5, Bie are structural parameters, a = -1.82, and g = 37.

The problem is to find the 6 dimensional volume(s) where roots exist. Of particular interest is the volume where there are 4,5 or more roots. (It turns out that in what follows whenever 4 roots are found there is another root at Qe = 1, such a value can't be evaluated using the above formulation due to the ln[1/Qe-1] term)

There are bounds on the range of physically sensible values for the structural parameters, they are [0,1] for all but V3 which can vary in the range [0,10].

The first exploration simply involved developing an interface which allows the user to interactively view the function while varying any of the 6 parameters.

While it can be useful to "play" with this, the real benefit was the ability to see that a simple zero crossing algorithm will be satisfactory for counting the number of roots. The interface also allows ready evaluation of the range of solutions in one or two variables after fixing the others, for example, testing the sensitivity of the roots to one or more parameters.

The next step was to write software which explores the 6 dimensional space calculating the number of roots for each point and reporting where there are 4 or more roots. This was initially performed exhaustively, varying each parameter in turn by 0.05 over the range [0,1]. On a relatively fast computer (Power Challenge) this took almost 10 hours. Since the processing time for such a technique will increase as the 6th power (the number of parameters) this approach was quickly abandoned. Instead, a random sampling was used.....inefficient, but it gives solutions immediately and for as long as one wishes to run the program. Further this approach can easily be run in parallel.

The first use of this growing database of roots is to look at the distribution of 4 or more roots for each parameter. The distributions after 12,000 successful points are shown below.

An obvious thing to note is the low ranges of V4 and V5 for which there are 4 or more roots.

Two dimensional versions of the above can be constructed for each pair of variables.

Statistics for each variable are:
``` Mean and variance
V1 :    0.76491 +-    0.02947
V2 :    0.43775 +-    0.03524
V3 :    0.26655 +-    0.00007
V4 :    0.01080 +-    0.00011
V5 :    0.01276 +-    0.03519
Bie:    0.38126 +-    0.76491

RMS
V1 :    0.78393
V2 :    0.47630
V3 :    0.34070
V4 :    0.01381
V5 :    0.01662
Bie:    0.42492

Median
V1 :    0.56650
V2 :    0.52700
V3 :    0.49950
V4 :    0.04950
V5 :    0.03300
Bie:    0.49700

Range
0.13400 <= V1  <=    0.99900
0.05500 <= V2  <=    0.99900
0.00000 <= V3  <=    0.99900
0.00000 <= V4  <=    0.09900
0.00000 <= V5  <=    0.06600
0.01700 <= Bie <=    0.97700 ```
An application was developed giving an interactive display of the points in V1, V2, V3 space where there are N roots. The interface is shown below.

All the parameters are explored in 0.05 steps, chosen as the finest resolution for which the solutions could be explored interactively on an Indigo Max Impact. The user can, in nearly real time, vary V4, V5, and Bie. The positions of the solutions in V1, V2, V3 space are drawn as boxes, the colour of which is the number of roots found at that point.

Another way of viewing the results from the random sampling is to map V1, V2, V3 onto the 3 dimensional coordinate axes as above, and map Bie to colour. V4 and V5 are collapsed (ignored) in the following diagram.

(Exploring this volume interactively gives more insight than the static views show here)

The standard blue through to red colour ramp is used for Bie. Blue is mapped to 0.0, red to 1.0. An alternative was to map Bie onto time and animate the above, this doesn't lead to any particular insight since the solution volumes for different values of Bie don't intersect.

Generating the samples at a higher resolution doesn't necessarily improve things, at least not until significantly more samples are acquired. The diagrams below show the volume for a 0.01 resolution for all parameters.

### Exploration - root distribution and density

An additional attribute of interest is the density of roots in Qe, that is, which solutions have roots that are close together. Considering as before only the solutions where there are 4 or 5 roots, the following shows the distribution of each root.

Using the same mapping to 3D as earlier with the axes V1, V2, V3 giving the user the ability to vary Bie the standard deviation of Qe of the first 4 roots was mapped to the blue to red colour ramp. Example screen shots are shown below.

The blue region indicates roots which are close together, red indicates roots with a larger variation.