Subject: [interferometry] Digest Number 3155
From: interferometry@yahoogroups.com
Date: 7/23/2016, 2:55 AM
To: interferometry@yahoogroups.com

interferometry
Yahoo! Groups
interferometry Group

2 Messages

Digest #3155
1a
Re: R package update published by "Michael Peck" mikepeck5440
1b
Re: R package update published by "Stephen Koehler" steve_koehler

Messages

1a

Re: R package update published

Fri Jul 22, 2016 7:26 am (PDT) . Posted by:

"Michael Peck" mikepeck5440

On 7/22/2016 4:37 AM, astroelectronic@t-online.de [interferometry] wrote:
>
>
> Mike,
>
> you must have a totally different algorithm than mine, if you can
> calculate such high orders.
> Can you please show the formula for Z1680?
>
> Thanks,
> Michael
>
>
>
Michael:

There isn't a formula exactly. I use the second recurrence relation
given in equation 20 of the Mathworld article on Zernike polynomials:
http://mathworld.wolfram.com/ZernikePolynomial.html. Basically you just
start with the radial polynomials that you can write down, then fill in
the rest. There's a little extra code for cases that simplify to avoid
unnecessary calculations. The specific block of code that fills in the
radially symmetric polynomials is lines 51-60 in zpmC.cpp.

--
Michael Peck
http://wildlife-pix.com
mlpeck54 -at- earthlink.net

1b

Re: R package update published

Fri Jul 22, 2016 8:26 am (PDT) . Posted by:

"Stephen Koehler" steve_koehler

Michael,

To echo what Mike said, evaluation of arbitrary Zernike polynomials can be
done by implementing one of the many recurrence relations. I use a
different recurrence relation than Mike, one that makes the code as small
as possible, while still being fairly efficient.

The following pieces of code are a complete implementation in R of Zernike
polynomials of arbitrary size, limited by available runtime and arithmetic
precision. The only thing I didn't include is what the Zernike
specification variable, "s", contains, but basically it's a list of m and n
values for each index i. Q is a complete implementation of radial
polynomials, and zern.poly is a complete implementation of full zernike
polynomials. How many polynomials you use is determined by the
specification variable.

Q <- function (Rho, n, m)
# Evaluate a radial Zernike polynomial over Rho.
if (n == m) 1 else ((2*n-m)*Rho^2*Q(Rho,n,m+1) - n*Q(Rho,n-1,m)) / (n-m)

zern.poly <- function (Rho, Theta, i, s) {
# Evaluate the ith Zernike polynomial according to spec s over (Rho,
Theta).
Rho^s$m[i] * Q (Rho, s$n[i], s$m[i]) *
switch (s$s[i]+1, 1, cos (s$m[i] * Theta), sin (s$m[i] * Theta))
}

Steve Koehler

On Fri, Jul 22, 2016 at 9:21 AM, Michael Peck mpeck1@ix.netcom.com
[interferometry] <interferometry@yahoogroups.com> wrote:

>
>
> On 7/22/2016 4:37 AM, astroelectronic@t-online.de [interferometry] wrote:
>
> Mike,
>
> you must have a totally different algorithm than mine, if you can
> calculate such high orders.
> Can you please show the formula for Z1680?
>
> Thanks,
> Michael
>
> Michael:
>
> There isn't a formula exactly. I use the second recurrence relation given
> in equation 20 of the Mathworld article on Zernike polynomials:
> http://mathworld.wolfram.com/ZernikePolynomial.html. Basically you just
> start with the radial polynomials that you can write down, then fill in the
> rest. There's a little extra code for cases that simplify to avoid
> unnecessary calculations. The specific block of code that fills in the
> radially symmetric polynomials is lines 51-60 in zpmC.cpp.
>
>
> --
> Michael Peckhttp://wildlife-pix.com
> mlpeck54 -at- earthlink.net
>
>
>
>
>
Visit Your Group
Yahoo! Groups
PrivacyUnsubscribeTerms of Use