Find Docs

Astronomical Applications Department, U.S. Naval Observatory - Linear Least Squares (Page 7)

Wodocs >> Science : Astronomy >> Astronomical Applications Department, U.S. Naval Observatory Linear Least Squares Page 7
Astronomical Applications Department, U.S. Naval Observatory - Linear Least Squares
# solve the normal equations
#---------------------------
debug_print(procname,"Solving the normal equations...",1);
_EnvAllSolutions := true;
map( allvalues, [solve( convert(eqs,set), convert(params,set) )] );
map( sortsols, %, params );
if nops(%)=1 then
solset := op(%);
else
solset := %;
debug_print(procname,"There are ".(nops(solset))." solutions",1);
fi;
debug_print(procname,"raw solution(s)",4,solset);

#---------------------------------------------------
# replace the denominators with another substitution
#---------------------------------------------------

#first define a workhorse procedure
replace_denominators := proc( expr, N, nmax, S, Delta )

local k, p, d;
global _subslist;

#---------------------------------
# determine the common denominator
#---------------------------------
#grab and filter denominators from solution parameter expressions
map( denom, { seq(op(rhs(expr[k])),k=1..nops(expr)) } );
map( (x)->if type(x,{integer,fraction}) then 0 else x fi, % );
d := % minus {0};
if nops(d) > 1 then
debug_print(procname,"denominator set",0,d);
ERROR("Unable to determine a unique denominator!");
elif d={} then
debug_print(procname,"no denominator for solution",2,expr);
RETURN(expr);
else
d := op(d);
fi;

#--------------------------------------
# make the substitution in the solution
#--------------------------------------
_subslist := [ Delta=eval(d,_subslist), op(_subslist) ];
collect( algsubs(d=Delta,expr), [Delta,seq(S[k],k=0..nmax),N], factor );
end;

#now make the substitutions
if type(solset,list(list)) then #multiple solutions
for k from 1 to nops(solset) do
subsop(k=replace_denominators(solset[k],N,nmax,S,Delta),solset);
solset := subs( Delta=delta[k], % );
_subslist := subs( Delta=delta[k], _subslist );
od;
else #only one solution
solset := replace_denominators(solset,N,nmax,S,Delta);
Page 7

<< Previous       1 2 3 4 5 6 7 8 9 10 11 12 13 14 15       Next >>



Other Documents:
Sensitivity Integral, 3 D plot fits, lyap2, NAO 150, Rotate Vector, lyapcalc, wedges, Scifull, Precession Memo, Precession Maple, Curves 3 D, NOVAS 2004 Overview, NOVAS 2006 Overview, thesis, Ranson,


WODocs | |
All rights reserved. wodocs.com© 2009
WODocs


New Docs

Documents Category:
Arts (Design, Movies, Music, Radio, Television)
Automotive (Cars, Marine, Motorcycle, ATV, Snowmobiles)
Business (Biotechnology and Pharmaceuticals, Chemicals, Construction and Maintenance, Materials, Real Estate, Services)
Electronics (Computers, Motion Control, Power Supply)
Games (Board, Family, Party, Card, Construction, RC Toys)
Health (Animalm, Beauty, Healthcare, Medicine, Pharmacy, Surgery, Weight Loss)
Home (Accessories, Cooking, Decor and Design, Electrical, Family, Pets)
News (Newspapers, Sports, Television)
Recreation (Collecting, Hiking, Scouting, Survival, Travel)
Reference (Education, Libraries and Archives, Museums)
Science (Agriculture, Astronomy, Biology, Chemistry)
Shopping (Antiques and Collectibles, Clothing, Flowers, Food, Home and Garden)
Sports (Bicycle, Snowboard, Skiing, Other)