(
)
cost parts
2
+
+
+
+
146 additions
385 multiplications
32 divisions
26 functions
188 subscripts
(
)
cost parts
3
+
+
+
+
117 additions
333 multiplications
32 divisions
26 functions
129 subscripts
(
)
cost parts
4
+
+
+
+
87 additions
258 multiplications
32 divisions
26 functions
37 subscripts
This doesn't look all that bad. There's one round more of tweaking to do.
We can pretty easily further simplify the last integral, parts[4], by collecting on the factors that are
common to the "
1
" sines and cosines and the "
2
" sines and cosines. Here is a sequence of
Maple commands to accomplish this.
time0 := time():
verbosity := 1:
debug_print(``,`Here we go...`,0);
# use a temporary for safety
tmp4 := parts[4]:
# select the denominators we're interested in
Set_trig := select( has, indets(tmp4), {sin,cos} ):
Set_A := select( has, indets(tmp4), {nu[1]} ):
Set_A_trig := Set_trig intersect Set_A:
Set_denoms := {}:
for p in Set_A_trig do
Set_denoms := Set_denoms union {select(has,coeff(tmp4,p,1),{s,g})};
od:
Set_denoms := Set_denoms minus {0,1}:
debug_print(``,`Set of denominators for parts[4]:`,0,Set_denoms);
# substitute temporaries for the denominators
debug_print(``,`simplifying...`,0);
Tlist := []:
denoms := convert(Set_denoms,list):
for k from 1 to nops(denoms) do
tmp4 := subs( denoms[k]=T.k, tmp4 );
Tlist := [op(Tlist),T.k]:
od:
debug_print(``,`expression with placeholders:`,2,tmp4);
# now collect on the denominators
tmp4 := collect( tmp4, [a[4],op(Tlist)], factor ):
# replace the denominator placeholders
for k from 1 to nops(denoms) do
tmp4 := subs( T.k=denoms[k], tmp4 );
od:
debug_print(``,`simplified expression:`,1,tmp4);
debug_print(``,`cost before simplification:`,0,cost(parts[4]));
debug_print(``,`cost after simplification:`,0,cost(tmp4));
Page 14