Document 10541083

advertisement
Least Squares by Iteration Wfit.wpj
Abstract
This document is about a fitting evenly spaced data at distances ri = iR/N to a
Fourier sine series at frequencies fm = m/R. Sine transform.doc Sinetran.htm

2
2  R  NR 1
H ( fm ) 
rh
(
r
)sin
2

f
r
dr




  rh
m
i (ri )sin  2 f m ri  (1)
f m 0
fm  NR  i 0

2
2  1  N R 1
h(ri )   fH ( f )sin  2 fri df     f m H  f m  sin  2 f m ri  (2)
ri 0
ri  R  m  0
The left hand parts of (1) and (2) can use any values of f and r, while the right hand parts are restricted to
fm=m/R and ri = iR/N. Note that r never quite makes it to R in the sum. This is not the place to worry about
the mathematics of this. For h  constant as r  0 and to zero as r  R, the right hand parts of (1) and (2)
can be simply regarded as trap rule approximations to the left hand integrals. Be aware however that for
large f and r, these approximations produce strange periodicities.
The 3-d version of this can be useful for theoretical considerations
H( f
L
, m, n )  

N
3
3
1
h(ri , j , k )   
L
N /2

i , j , k  N / 2
N /2

, m, n  N / 2

h  ri , j , k  exp ˆjf

H f
, m, n
, m, n
 exp   ˆjf
ri , j , k
, m, n

ri , j , k
(3)

(4)
The N and L in (3) and (4) are related to but not equal to the R and N in (1) and (2). In the appropriate
limits, the h and H in (3) and (4) are the same as those in (1) and (2). This will be used below.
Introduction
The function h is to be approximated by
hA (r )  c(r )    c(r ')hA (| r  r ' |)d 3r '
(5)
The integral in (5) is a 3-d convoution integral. Direct evaluation of this is
detailed in Convolution in 3d.doc. In this document c and hA are functions of |r| which
reduces the integrals to one dimensional integrals as detailed in Sine transform.doc. In
transform space ConvDetail.doc. In addition, we are using the grid fm=m/R and ri = iR/N to
reduce the transform integrals to the sum forms in (1) and (2). The function c(r) is a short range
function c(ri) = 0 for ri > r0 or i < i0.
(6)
H  f   C  f   C  f  H  f 
or
Hf 
C f  
(7)
1 H  f 
or
C f 
Hf 
(8)
1  C  f 
Where c. The values of c(ri) for r < r0 are to be determined by minimizing.
3
L
2   
N

wi h  ri , j , k   hA  ri , j , k , c 
M /2

i , j , k  M / 2

2
(9)
Or equivalently
2
RM
 2  4    wi ri 2  h  ri   hA  ri , c  
(10)
 N  i 0
In general im > i0 so that the values of c are determined. Newton-Raphson minimization
of 2 with respect to c requires accurate first derivatives of hA with respect to c
Extremal.htm .doc. Derivatives of h.doc discusses finding the first derivatives with
respect to k = c(rk).
H  f m ;  
h(ri ;  ) 2 N
  fm
sin  2 f m ri  (11)
 k
ri m 1
 k
Or
h(ri , j , k ; )
 k
1
 
L
3

H f
N / 2 1

, m, n
;
 k
, m , n  N / 2
 exp  ˆj 2 f

, m, n
ri , j , k

(12)
First Derivative array
Using the (9) form
3
hA  ri , j , k , c 
 2
 L  M /2
 2  
wi h  ri , j , k   hA  ri , j , k , c 

 k
 k
 N  i , j , k  M / 2
Then use the (12) form for the partial of hA with respect to k


 2
 L  M /2
1
 2  
wi h  ri , j , k   hA  ri , j , k , c   

 k
 N  i , j , k  M / 2
 L
(14)
Evaluate the sum on r first to form
3
 
L
H DW  f   
N
3
M /2

i , j , k  M / 2



 
3
(13)

H f
N / 2 1

 k
, m , n  N / 2
wi h  ri , j , k   hA  ri , j , k , c  exp  ˆj 2 f
, m, n
, m, n
;
 exp  ˆj 2 f


ri , j , k (15)
Note that this sum is not over all N
or
R 2 M
H DW  f m      wi r  h  ri   hA  ri , c   sin  2 f mri  (16)
 N  fm i 0
So that
 2
1
 2  
 k
L
3
N / 2 1

, m , n  N / 2

H f
, m, n
 k
;
H
Dw
  f  (17)
, m, n
Noting that the functions depend on |f| alone. Switch to the spherical coordinate
representation
 2
 1  N 1 H  f m ; 
(18)
 2   4  f m2
H Dw   f m 
 k
 k
 R  m0
Then from Derivatives of h.doc
, m, n
ri , j , k

 2
 1  2 N 1 1  2  C  f m ;  
 8 rk 2    f m 
H Dw  f m  sin  2 f m rk 
2
 k
 R  rk m  0 1   C  f m ;  
(19)
This is the sin transform of
1  2  C  f m ;  
H Dw  f m  (20)
2
1


C
f
;





m
Second Derivative array
Using the equation (12) form, an approximate second derivative array is
3
h  ri , j , k  h  ri , j , k 
2 2
 L  M /2
(21)
 2 
wi

 k  m
 k
 m
 N  i , j , k  M / 2
Substituting (12) into (21)
2 2
 L 1
 2   
 k  m
 N   L
3
6
M /2

H f
N /2

i , j , k  M / 2
wi

, m, n
 k
, m , n  N / 2
', m ', n '  N / 2
(22)
Replace wi by <w> and evaluate the sum over r first
2 2
 L 1
 2    w
 k  m
 N  L
3
6
3
1
 2  w
L

, m , n  N / 2
', m ', n '  N / 2

H f
N /2

, m , n  N / 2

H f
N /2
, m, n
, m, n
 k
 
; H f
 k
 
', m ', n '
 m
; H f 
,  m,  n
 
; H f
;
;
', m ', n '
;
 m
N 
3

 exp  ˆj 2

f

,  ' m,  m ' n,  n '
(23)

 m
Switch to spherical coordinates
H  f ;  H  f m ; 
2 2
1 N R 1
2 w
 4 fm2 m
 k  m
R m0
 m
k
(24)
Inserting the partial of H values
w
2 2
2
 k  k '
R
N R 1
 4 f
m0
2
m
1  2  C  f m ;   C  f m ;  1  2 C  f m ;   C  f m ; 
2
2
1  C  f m ;    k 1  C  f m ;    k '
Then the partial of C values
w
2 2
2
 k  k '
R
N R 1
 4 f
m0
2
m
1  2 C  f m ;   2rk sin  2 f m rk  1  2 C  f m ;  2rk ' sin  2 f m rk ' 
(26)
2
2
fm
fm
1  C  fm ;  
1  C  fm ;  
Simplify
w
2 2
2
 k  k '
R
2
 1  2  C  f ;   
m
  sin 2 f r sin 2 f r
16 rk rk '  
 m k'  m k 

2


m0
1


C
f
;





m


N R 1
(25)
(27)
This is a decided maximum for k = k', thus the matrix is nearly orthogonal.
N R 1 
1  2  C  f m ;   
w
2 2

 16 rk2
 k ,k '   
2
 k  k '
R
m  0  1   C  f ;   
m


2
(28)
, m, n
f
', m ', n '
r 
i, j ,k
Change in alpha
k  k 0 
 1  2 N 1 1  2  C  f m ;  
8 rk 2    f m 
H Dw  f m  sin  2 f m rk 
2
 R  rk m  0 1   C  f m ;  
16 rk2
Or
k  k 0 
1
rk
N 1
f
m0
m
 1  2  C  f ;   
w
m



2
R m  0  1   C  f m ;   


N R 1
2
1  2  C  f m ;  
H Dw  f m  sin  2 f m rk 
2
1


C
f
;

 m 

 1  2  C  f ;   
m

w  
2
m  0  1   C  f m ;   


N R 1
2
(30)
(29)
Download