**Documentation Home Page** ◇ **eHS Toolbox Home Page**

Pour la **documentation en FRANÇAIS**, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

# How to choose discretization Method (Pade5 and Backward Euler)

There are two types of discretization methods available in Gen5 solver: **Backward Euler** and **Pade5**. Each of them has its own feature in terms of accuracy and stability. These methods are not always fit for a given circuit, so sometimes we have to choose a specific one. Before we make the decision, it is better to know some knowledges behind these methods to help us understand what is happening in the backend.

#### 1. Background

Keep in mind that all discretization methods are trying to use(usually a rational function) to approximate , where is the continuous matrix we are trying to discretize and is the time-step. We know that can be expressed as Tylor series in the following form:

If the expression of matches the Tylor series till to the th order, then we say is th order accurate and this method is a th order method. For example: if (which is the expression of Forward Euler), it matches the Tylor series till to the first order, then we say the Forward Euler is a first order method.

#### 2. Backward Euler

Backward Euler is a well-known discretization method that is commonly used in many software packages. The expression of Backward Euler is as follows:

It can be seen that it matches the Tylor series till to the first order. Therefore, Backward Euler is also a first order method, like Forward Euler. However, the advantage of Backward Euler over Forward Euler is that the former method is more numerical stable than the later method (another topic that will not be covered in this page).

All we have to remember is that in order to find its approximation, we need to use the identity matrix and matrix, which does not pose too much pressure on numerical accuracy when doing matrix inverse. It is not very hard to calculate and not a high order method.

#### 3. Pade5 (ART5) Method

Pade5, as its name implies, is a higher order (5th) method, which means the expression of matches the Tylor series till to the 5th order. In order to do so, we have to introduce more terms in the rational function of. We are not going into the details of how we find those terms. All we have to keep in mind is that in order to match the 5th coefficient, 5 parameters have to be introduced. The expression of is shown as follows.

We can see that there are 2 terms (except identity matrix) on the numerator and 3 terms (except identity matrix) on the denominator. By suitably choosing those parameters , we can make matches the Tylor series till to the 5th order.

On the other hand, the cost to achieving higher order accuracy is that we have to compute higher order of, where could be 3. Usually the time-step we are using in our simulation is very small, for example 100 ns. Higher order of time-step could be an extremely small value. For example, for 100 ns. Let alone the fact that some values in matrix could also be very small. All of those factors add pressure into the numerical accuracy of matrix operations. We may reach the numerical limit of the data format in our computer or FPGA. That’s the reason why Pade5 is more accurate than Backward Euler but less numerical stable.

#### 4. Some options to resolve this issue

We can see that the reason why Pade5 is more prone to numerical instability is coming from the numerical computation parts, not the equations or circuit itself. Some options we can consider to resolve this issue could be:

**Changing the time-step a little bit**. Sometimes a little change in time-step would affect the numerical results a lot because at some specific time-steps the numerical error will arise, for example, big value eats small value so that small value is totally discarded. Changing time-step will change the numerical pattern of those matrix values so that could be helpful.**Changing the parameters in the circuit**. This option is similar to the first one except the changes are made in the matrix .**Using lower order method such Backward Euler**. If none of those options is possible or working, we can use a lower order method instead since lower order method has less pressure on numerical accuracy of computation.

These three options are not mutually exclusive to each other. Sometimes we can combine two or even three of them to achieve numerical stability.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323

Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter