Difference between revisions of "LChrisman/Computing Derivatives for MetaLog"
(Created page with "This page outlines an algorithm for computing the <math>i^{th}</math> derivative of a Keelin MetaLog. == Algorithm == #For each <math>j=0 \mbox{to} i</math> #* Compute <math...") |
|||
Line 1: | Line 1: | ||
This page outlines an algorithm for computing the <math>i^{th}</math> derivative of a Keelin MetaLog. | This page outlines an algorithm for computing the <math>i^{th}</math> derivative of a Keelin MetaLog. | ||
+ | |||
+ | From Eq(6) in the Baucells, Chrisman, Keelin paper draft: | ||
+ | :<math>M^{(i)}(y) = \mu^{(i)}(y) + s^{(i)} \ell(y) + \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y)</math> | ||
+ | thus in | ||
+ | :<math>y^i (1-y)^i M^{(i)}(y) = y^i (1-y)^i \mu^{(i)}(y) + y^i (1-y)^i s^{(i)} \ell(y) + y^i (1-y)^i \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y)</math> | ||
+ | |||
+ | the first and third term are polynomials, and the middle term is a polynomial times a logit. Hence, this can always be written in the form: | ||
+ | |||
+ | :<math>y^i (1-y)^i M^{(i)}(y) = poly_1(y) + poly_2(y) \ell(y)</math> | ||
+ | |||
+ | The polynomials for the first term is easy, as is <math>poly_2(y)</math> Hence, we just need to obtain <math>T(y)</math> in the form of a polynomial, where | ||
+ | <math>T(y) = y^i (1-y)^i \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y)</math> | ||
+ | |||
+ | === Change of variable === | ||
+ | <math>u = y-0.5</math> | ||
+ | |||
+ | <math>T(u) = T(y-0.5)</math> | ||
== Algorithm == | == Algorithm == | ||
− | #For each <math>j=0 \mbox{to} i</math> | + | The algorithm uses arithmetic operations on a polynomial-coefficients data type. Here <math>T(u)</math>, <math>s^{(j)}</math>, <math>R(u)</math> and <math>N(u)</math> are all polynomials. The order of the derivative, <math>i</math> is given. |
+ | |||
+ | #For each <math>j=0 \mbox{ to } i</math> | ||
#* Compute <math>C_j = \left( \begin{array}{c}i \\ j\end{array}\right) ( i-j-1)!</math> | #* Compute <math>C_j = \left( \begin{array}{c}i \\ j\end{array}\right) ( i-j-1)!</math> | ||
#* Compute <math>s^{(j)}(u)</math> | #* Compute <math>s^{(j)}(u)</math> |
Revision as of 20:57, 15 November 2024
This page outlines an algorithm for computing the [math]\displaystyle{ i^{th} }[/math] derivative of a Keelin MetaLog.
From Eq(6) in the Baucells, Chrisman, Keelin paper draft:
- [math]\displaystyle{ M^{(i)}(y) = \mu^{(i)}(y) + s^{(i)} \ell(y) + \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y) }[/math]
thus in
- [math]\displaystyle{ y^i (1-y)^i M^{(i)}(y) = y^i (1-y)^i \mu^{(i)}(y) + y^i (1-y)^i s^{(i)} \ell(y) + y^i (1-y)^i \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y) }[/math]
the first and third term are polynomials, and the middle term is a polynomial times a logit. Hence, this can always be written in the form:
- [math]\displaystyle{ y^i (1-y)^i M^{(i)}(y) = poly_1(y) + poly_2(y) \ell(y) }[/math]
The polynomials for the first term is easy, as is [math]\displaystyle{ poly_2(y) }[/math] Hence, we just need to obtain [math]\displaystyle{ T(y) }[/math] in the form of a polynomial, where [math]\displaystyle{ T(y) = y^i (1-y)^i \sum_{j=0}^{i-1} s^{(j)}(y) \ell^{(i-j)}(y) }[/math]
Change of variable
[math]\displaystyle{ u = y-0.5 }[/math]
[math]\displaystyle{ T(u) = T(y-0.5) }[/math]
Algorithm
The algorithm uses arithmetic operations on a polynomial-coefficients data type. Here [math]\displaystyle{ T(u) }[/math], [math]\displaystyle{ s^{(j)} }[/math], [math]\displaystyle{ R(u) }[/math] and [math]\displaystyle{ N(u) }[/math] are all polynomials. The order of the derivative, [math]\displaystyle{ i }[/math] is given.
- For each [math]\displaystyle{ j=0 \mbox{ to } i }[/math]
- Compute [math]\displaystyle{ C_j = \left( \begin{array}{c}i \\ j\end{array}\right) ( i-j-1)! }[/math]
- Compute [math]\displaystyle{ s^{(j)}(u) }[/math]
- Compute [math]\displaystyle{ R(u) = (0.5+u)^j (0.5-u)^j }[/math]
- Compute [math]\displaystyle{ N(u) = (0.5+u)^{i-j} - (-1)^{i-j} ( 0.5-u)^{i-j} }[/math]
- Compute [math]\displaystyle{ T_j(u) = C_j \cdot s^{(j)}(u) \cdot R(u) \cdot N(u) }[/math]
- [math]\displaystyle{ T(u) = \sum_{j=0}^i T_j(u) }[/math]
Enable comment auto-refresher