Skip to main content
copyedit: use MathJax instead of bitmap graphic for formula, use shorthand URL format for site‑internal links, fix typos, use present tense for linked challenge since it still exists, supply link titles, write edit summary, insert missing words “the”
Source Link

Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things like memory and integer size).

There wasis a previous challengeprevious challenge for the DFT, now letslet’s compute the DCT! ;-)

Use Use the DCT-II definition from WikipediaDCT‑II definition from Wikipedia:

DCT-II$$ X_{k} = \sum_{n \, = \, 0}^{N - 1} x_{n} \, \cos \left[ \frac{\pi}{N} \, \left( n + \frac{1}{2} \right) \, k \right] \quad\quad k = 0, \, \ldots, N - 1 $$

Your program takes a sequence xn as input, and must produce the corresponding sequence Xk. In this formula, the cosine is in radians.

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-pointFloating‐point inaccuracies will not be counted against you.
  • You don'tdon’t have to use the exact algorithm shown here, as long as you produce the same results.

Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things like memory and integer size).

There was a previous challenge for DFT, now lets compute DCT! ;-)

Use the DCT-II definition from Wikipedia:

DCT-II

Your program takes a sequence xn as input, and must produce the corresponding sequence Xk. In this formula, the cosine is in radians.

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.
  • You don't have to use the exact algorithm shown here, as long as you produce the same results.

Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things like memory and integer size).

There is a previous challenge for the DFT, now let’s compute the DCT! Use the DCT‑II definition from Wikipedia:

$$ X_{k} = \sum_{n \, = \, 0}^{N - 1} x_{n} \, \cos \left[ \frac{\pi}{N} \, \left( n + \frac{1}{2} \right) \, k \right] \quad\quad k = 0, \, \ldots, N - 1 $$

Your program takes a sequence xn as input, and must produce the corresponding sequence Xk. In this formula, the cosine is in radians.

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating‐point inaccuracies will not be counted against you.
  • You don’t have to use the exact algorithm shown here, as long as you produce the same results.
Post Reopened by ovs, CommunityBot, izzyg
edit for reopen
Source Link
user62131
user62131

Implement the Discrete Cosine Transform (DCT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things like memory and integer size).

There was a previous challenge for DFT, now lets compute DCT! ;-)

Use the DCT-II definition from Wikipedia:

DCT-II

Your program takes a sequence xn as input, and must produce the corresponding sequence Xk. In this formula, the cosine is in radians.

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.
  • You don't have to use the exact algorithm shown here, as long as you produce the same results.

Implement the Discrete Cosine Transform (DCT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input.

There was previous challenge for DFT, now lets compute DCT! ;-)

Use DCT-II definition from Wikipedia

DCT-II

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.

Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things like memory and integer size).

There was a previous challenge for DFT, now lets compute DCT! ;-)

Use the DCT-II definition from Wikipedia:

DCT-II

Your program takes a sequence xn as input, and must produce the corresponding sequence Xk. In this formula, the cosine is in radians.

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.
  • You don't have to use the exact algorithm shown here, as long as you produce the same results.
added 181 characters in body
Source Link
user69099
user69099

Implement the Discrete Cosine Transform (DCT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input.

There was previous challenge for DFT, now lets compute DCT! ;-)

Use DCT-II definition from Wikipedia

DCT-II

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.

Implement the Discrete Cosine Transform (DCT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input.

There was previous challenge for DFT, now lets compute DCT! ;-)

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.

Implement the Discrete Cosine Transform (DCT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input.

There was previous challenge for DFT, now lets compute DCT! ;-)

Use DCT-II definition from Wikipedia

DCT-II

Rules

  • This is so the shortest solution wins.
  • Builtins that compute the DCT in forward or backward (also known as inverse) directions are not allowed.
  • Floating-point inaccuracies will not be counted against you.
Post Closed as "Needs details or clarity" by xnor, Nathan Merrill, CommunityBot, Nick Clifford
edited tags
Link
user42649
user42649
Loading
Added rules
Source Link
user42649
user42649
Loading
Source Link
user69099
user69099
Loading