newbie question, forcing numeric result





On Sat, 23 Dec 2006, Barton Willis wrote:

> Try *something* like
>
> (%i1) mypow(a,b) := if a=0 and b= 0 then 1 else a^b;
> paldn(m,s) :=
> (sum(binomial(2*m-i,i)*mypow(s,i),i,0,m-1))/(sum(binomial(2*m-i,i)*mypow(s,i),i,0,m));
>
> gain(m,s) := abs(paldn(m,s));
> pairs: makelist([0.1*omega, gain(2,%i*omega)],omega,0,5);
>
> (%o1) mypow(a,b):=if a=0 and b=0 then 1 else a^b
> (%i2)
> (%o2)
> paldn(m,s):=sum(binom(2*m-i,i)*mypow(s,i),i,0,m-1)/sum(binom(2*m-i,i)*mypow(s,i),i,0,m)
>
> (%i3)
> (%o3) gain(m,s):=abs(paldn(m,s))
> (%i4)
> (%o4)
> [[0,1],[0.1,sqrt(10)/3],[0.2,sqrt(37)/(3*sqrt(5))],[0.3,sqrt(82)/sqrt(145)],[0.4,sqrt(145)/(3*sqrt(41))],[0.5,sqrt(226)/(3*sqrt(89))]]
>
> (%i5)
>
> Notes:
thanks for the instructive reply, strange enough I am confronted now with 
another problem. The above defined function gain(m,s) stops functioning 
correctly when m>=60 as you can see below. It is a complete mystery to me 
why this happens:

(%i19) float(gain(59,%i*2*%pi*60));

(%o19) 			       1.14706260261368

(%i18) float(gain(60,%i*2*%pi*60));

(%o18) 				      0.0

(%i20) float(gain(61,%i*2*%pi*60));

(%o20) 				      0.0