Astronomical Applications Department, U.S. Naval Observatory Linear Least Squares Page 16
16 T
2
2
S
0
2
4 T
2
2
S
1
2
4 T
3
2
S
0
2
T
3
2
S
1
2
8 S
2
N T
2
S
0
4 T
3
2
S
2
2
16 S
0
2
T
4
2
+
+
+
+
-
+
+
4 S
1
2
T
4
2
+
2
_Z
+
leastsqrs[31]: Solution 3 substituted into normal eqs
8
( )
cos
2
T
0
8
( )
cos
2
T
1
16
( )
cos
( )
sin
T
2
2
( )
cos
2
N 8
( )
cos
( )
sin
T
3
-
-
+
+
(
[
8
( )
sin
2
T
4
+
) A 4
( )
cos
S
0
2
( )
cos
S
1
4
( )
sin
S
2
-
+
+
0
=
2
( )
cos
( )
sin
N
-
(
,
8
( )
cos
( )
sin
T
0
4
( )
cos
2
T
3
8
( )
cos
2
T
2
8
( )
cos
( )
sin
T
4
8
( )
cos
( )
sin
T
1
-
+
-
+
+
4
( )
sin
2
T
3
8
( )
sin
2
T
2
-
+
) A2 (
)
-
+
+
2
( )
sin
S
1
4
( )
cos
S
2
4
( )
sin
S
0
A
+
0
=
]
leastsqrs[31]: Throwing out solution 3
leastsqrs[31]: Done!
,
=
A 0
=
+
arctan
1
2
-
2 S
0
S
1
S
2
_Z
As we can see,
=
Y A
(
)
cos
+
2
t
i
is not a particularly good choice of representation, since the
solution involves inverse trigonometric functions and is particularly useless (
=
A 0
). The next,
equivalent, example leads to a useful solution.
Sinusoid -- Representation 2
:=
printlevel
2
(
)
leastsqrs
, , ,
=
Y
+
A
(
)
cos 2
t
i
B
(
)
sin 2
t
i
t i [
]
,
A B
leastsqrs[0]: normal equations
=
+
-
+
(
)
-
+
+
8 T
1
2 N 8 T
0
A (
)
-
+
4 T
3
8 T
2
B 4 S
2
2 S
0
0
=
-
+
(
)
-
+
4 T
3
8 T
2
A 4 S
1
8 B T
4
0
leastsqrs[0]: Solving the normal equations...
leastsqrs[1]: substitution list
4
=
i 1
N
(
)
cos
t
i
4
=
i 1
N
(
)
sin
t
i
2
(
)
cos
t
i
2
=
4
=
i 1
N
(
)
cos
t
i
2
=
i 1
N
(
)
sin
t
i
2
(
)
cos
t
i
2
N
=
i 1
N
(
)
sin
t
i
2
(
)
cos
t
i
2
-
+
4
=
i 1
N
(
)
cos
t
i
3
(
)
sin
t
i
2
-
Page 16