14
$\begingroup$

As a programmer who hasn't had any higher mathematical training, I sometimes find mathematical equations described in books or online that I'd like to implement in my programs, but they have symbols in them that I'm unfamiliar with. Or they use symbols that I'm familiar with in an unfamiliar way. It's very frustrating, especially as I can't even tell what area of mathematics to start hunting for them in.

Right now, I'm trying to figure out this:

lpcc
(source: oakcircle.com)

I've mostly figured out the actual equations shown there (the summation symbol wasn't too hard to find via Wikipedia, and I finally figured out that the big open-brace was a way of showing if-then equations), but I'm stuck on the two things in the initial paragraph. The first one, between "The cepstrum coefficients" and "can be estimated"... what do the "Q" and "q=0" mean in that? And in the one between "from the LPC coefficients" and "using a recursion procedure:", the "p" and "q=1"?

$\endgroup$
  • 2
    $\begingroup$ The most frustrating part about all of this is that usually before one of these equations ends up in someone's paper, the author has already prototyped the algorithm by writing an actual program. Once they're sure it works, they convert it into greek for the paper because apparently the more greek you have the more likely your paper is to be accepted and published. $\endgroup$ – MooseBoys Feb 4 '16 at 8:44
13
$\begingroup$

The $Q$ is a parameter, and $q$ is a variable ranging from $0$ to $Q$: basically, you have $Q+1$ parameters $\textrm{ceps}_0,\dots, \textrm{ceps}_Q$; or, in programming terms, you have an array $\textrm{ceps}[0\dots Q]$.

Similarly, the LPC coefficients are a list of $p$ values $a_1,\dots, a_p$ (i.e., $a_q$ for $q=1\dots p$), where $p$ is another parameter.

The recursion procedure explains how to compute value $Q+1$ values in $\textrm{ceps}[0\dots Q]$, recursively, starting with $\textrm{ceps}[0]$ and then applying the formula: $$ \textrm{ceps}[1] = a_1 + \sum_{k=1}^0 \frac{k-1}{1}a_k \textrm{ceps}[1-k] = a_1 $$ then $$ \textrm{ceps}[2] = a_2 + \sum_{k=1}^1 \frac{k-2}{2}a_k \textrm{ceps}[2-k] = a_2 - \frac{1}{2}a_1 \textrm{ceps}[1] = a_2-\frac{a_1^2}{2} $$ etc.

$\endgroup$
  • $\begingroup$ Are the extra cases where $q=0$ and $q>p$ included in your answer? $\endgroup$ – Roland Feb 3 '16 at 23:40
  • $\begingroup$ @Roland What do you mean? From what I can read in the question, the tuple $(a_q)_{1\leq q \leq p}$ only includes $a_1,\dots, a_p$. There is not $a_q$ defined for $q=0$ or $q> p$. $\endgroup$ – Clement C. Feb 3 '16 at 23:42
  • $\begingroup$ Not for $a_q$, but for $\operatorname{ceps}[0] = \ln(Q)$ and $\operatorname{ceps}[q]$ for $p<q\leq Q$, you need a different formula. $\endgroup$ – Roland Feb 3 '16 at 23:47
  • 1
    $\begingroup$ Yes. i didn't spell it out: see the "etc.". $\endgroup$ – Clement C. Feb 3 '16 at 23:56
10
$\begingroup$
Number[] a = new Number[p + 1]; // range from 1 to p

... some stuff to initialize a ...

Number[] ceps = new Number[Q + 1]; // range from 0 to Q

ceps[0] = ln(G);
for (int q = 1; q <= p; q++) {
  Number sum = a[q];
  for (k = 1; k <= q - 1; k++) {
    sum += (k - q) / q * a[k] * ceps[q - k];
  }
  ceps[q] = sum;
}

for (int q = p + 1; q <= Q; q++) {
  Number sum = 0;
  for (int k = 1; k <= p; k++) {
    sum += (k - q) / q * a[k] * ceps[q - k];
  }
  ceps[q] = sum;
}

Edit:

(k - q) / q * a[k] * ceps[q - k]

should really be

((Number)(k - q))/((Number)q) * a[k] * ceps[q - k]

or

a[k] * ceps[q - k] * (k - q) / q

To avoid integer division.

$\endgroup$
7
$\begingroup$

$\{ceps_q\}_{q=0}^Q$ is the finite sequence (or array or vector in programmese) $$ceps_0,ceps_1,\ldots, ceps_Q.$$

Likewise, $\{a_q\}_{q=1}^p$ denotes $$a_1,a_2,\ldots, a_p.$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.