# Partial Derivative for 3D function by FFTW

Started by October 29, 2006
```Dear FFTW experts,

I want to do the partial derivative for a 3D function by FFTW.

For example, I have a 3D function P(x,y,z), and I want to compute dP/dx
and dP/dy (I can not find the symbol for partial so I use "d" here). As I
remembered:
1. Determine dP/dx:(P is a 3D data)
(1)I should do fourier transfrom of P(x,y,z) with x direction(1D transform
for 3D data)
(2)multiply with i*Wx
(3)inverse transform also with x direction (1D transform for 3D data)

2. Determine dP/dx:(P is a 3D data)
(1)I should do fourier transfrom of P(x,y,z) with y direction(1D transform
for 3D data). This should be different from the fourier transfrom of
P(x,y,z) with x direction.
(2)multiply with i*Wy
(3)inverse transform with y direction (1D transform for 3D data)

I can not find a subrouine from FFTW to do this 1D fourier transform for
3D data.(From the FFTW document, I only find 1D tranform for 1D data, 3D
tranform in different dimension for a 3D data by FFTW?

Xiaoniu

```
```xiaoniu wrote:

> ... (I can not find the symbol for partial so I use "d" here). ...

Does '&delta;' show up on your computer? It doesn't on everyone's.

FWIW: &alpha; &beta; &gamma; &delta; &epsilon; &eta; &theta; &iota; &kappa; &lambda; &mu; &nu; &xi; &omicron; &pi; &rho; &sigma; (final: &sigmaf;) &tau; &upsilon; &phi; &chi; &psi; &omega;

Jerry
--
"The rights of the best of men are secured only as the
rights of the vilest and most abhorrent are protected."
- Chief Justice Charles Evans Hughes, 1927
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```xiaoniu wrote:
> Dear FFTW experts,
>
> I want to do the partial derivative for a 3D function by FFTW.
>
> For example, I have a 3D function P(x,y,z), and I want to compute dP/dx
> and dP/dy (I can not find the symbol for partial so I use "d" here). As I
> remembered:
> 1. Determine dP/dx:(P is a 3D data)
> (1)I should do fourier transfrom of P(x,y,z) with x direction(1D transform
> for 3D data)
> (2)multiply with i*Wx
> (3)inverse transform also with x direction (1D transform for 3D data)
>
> 2. Determine dP/dx:(P is a 3D data)
> (1)I should do fourier transfrom of P(x,y,z) with y direction(1D transform
> for 3D data). This should be different from the fourier transfrom of
> P(x,y,z) with x direction.
> (2)multiply with i*Wy
> (3)inverse transform with y direction (1D transform for 3D data)
>
> I can not find a subrouine from FFTW to do this 1D fourier transform for
> 3D data.(From the FFTW document, I only find 1D tranform for 1D data, 3D
> tranform in different dimension for a 3D data by FFTW?
>
> Xiaoniu
>
I'm no FFTW expert, but you should be able to do a 3D transform,
multiply by i*Wx, then do the inverse for the partial in the x
direction, with a similar operation for the y direction.  You will do a
bunch of extra computations, but that's life.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```xiaoniu wrote:

> I want to do the partial derivative for a 3D function by FFTW.
>
> For example, I have a 3D function P(x,y,z), and I want to
> compute dP/dx and dP/dy (I can not find the symbol for partial
> so I use "d" here).

Any such symbol would not be ASCII, hence not very suitable for NNTP
transmission.

> As I remembered:
> 1. Determine dP/dx:(P is a 3D data)
> (1)I should do fourier transfrom of P(x,y,z) with x direction(1D
> transform for 3D data)
> (2)multiply with i*Wx
> (3)inverse transform also with x direction (1D transform for 3D
> data)

> I can not find a subrouine from FFTW to do this 1D fourier
> transform for 3D data.(From the FFTW document, I only find 1D
> tranform for 1D data, 3D transform for 3D data).

Apply the 1D transform to each slice P(0..n_x-1, y,z) separately,
looping over all index pairs (y,z). Proceed analogously for other
directions.

Martin

--
Quidquid latine scriptum sit, altum viditur.
```
```>xiaoniu wrote:
>> Dear FFTW experts,
>>
>> I want to do the partial derivative for a 3D function by FFTW.
>>
>> For example, I have a 3D function P(x,y,z), and I want to compute
dP/dx
>> and dP/dy (I can not find the symbol for partial so I use "d" here). As
I
>> remembered:
>> 1. Determine dP/dx:(P is a 3D data)
>> (1)I should do fourier transfrom of P(x,y,z) with x direction(1D
transform
>> for 3D data)
>> (2)multiply with i*Wx
>> (3)inverse transform also with x direction (1D transform for 3D data)
>>
>> 2. Determine dP/dx:(P is a 3D data)
>> (1)I should do fourier transfrom of P(x,y,z) with y direction(1D
transform
>> for 3D data). This should be different from the fourier transfrom of
>> P(x,y,z) with x direction.
>> (2)multiply with i*Wy
>> (3)inverse transform with y direction (1D transform for 3D data)
>>
>> I can not find a subrouine from FFTW to do this 1D fourier transform
for
>> 3D data.(From the FFTW document, I only find 1D tranform for 1D data,
3D
the
>> tranform in different dimension for a 3D data by FFTW?
>>
>> Xiaoniu
>>
>I'm no FFTW expert, but you should be able to do a 3D transform,
>multiply by i*Wx, then do the inverse for the partial in the x
>direction, with a similar operation for the y direction.  You will do a
>bunch of extra computations, but that's life.
>
>--
>
>Tim Wescott
>Wescott Design Services
>http://www.wescottdesign.com
>