Astronomical Applications Department, U.S. Naval Observatory Linear Least Squares Page 13
+
+
+
21 additions 50 multiplications divisions assignments,
[
+
+
+
22 additions 48 multiplications divisions assignments,
+
+
+
22 additions 48 multiplications divisions assignments,
+
+
+
21 additions 47 multiplications divisions assignments ]
The following commands produce an optimized procedure, which we will not show here.
:=
tmp
(
)
array
(
)
map
,
x
( )
rhs x
(
)
eval
,
%% _subslist
(
)
optimize
(
)
makeproc
,
tmp
=
parameters [
]
, ,
N Y t
Sinusoid -- Representation 1
:=
printlevel
1
(
)
leastsqrs
, , ,
=
Y A
(
)
cos
+
2
t
i
t i [
]
,
A
leastsqrs[0]: normal equations
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[0]: Solving the normal equations...
leastsqrs[2]: There are 3 solutions
leastsqrs[4]: Verifying the 3 solutions...
leastsqrs[18]: Solution 2 is invalid!
A
1
2
sqrt 16 T
2
S
2
S
1
T
4
16 T
3
S
2
S
0
T
4
8 T
3
S
2
S
1
T
4
32 T
2
S
2
S
0
T
4
16 T
2
S
2
2
T
3
+
-
-
-
=
16 S
0
T
4
2
S
1
16 T
2
2
S
2
2
4 T
2
S
1
2
T
3
4 T
3
2
S
0
S
1
16 T
2
S
0
T
3
S
1
8 S
2
T
1
T
3
S
1
-
+
-
-
+
+
8 S
2
T
0
T
3
S
1
32 S
2
T
1
T
2
S
0
16 S
2
T
1
T
2
S
1
16 S
2
T
1
T
3
S
0
16 T
2
2
S
0
S
1
-
+
-
-
-
2 S
2
N T
3
S
1
32 S
2
T
0
T
2
S
0
16 S
2
T
0
T
2
S
1
16 S
2
T
0
T
3
S
0
4 S
2
N T
2
S
1
-
-
+
+
+
4 S
2
N T
3
S
0
16 T
2
S
0
2
T
3
8 S
2
2
N T
0
8 S
2
2
N T
1
32 S
2
2
T
0
T
1
S
2
2
N2
+
-
+
-
-
+
16 S
2
2
T
0
2
16 S
2
2
T
1
2
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
+
+
+
+
+
+
-
Page 13