Re: Evaluation of 1/(1/a + 1/b + 1/r)
- To: mathgroup at smc.vnet.net
- Subject: [mg70181] Re: [mg70129] Evaluation of 1/(1/a + 1/b + 1/r)
- From: "Diana Mecum" <diana.mecum at gmail.com>
- Date: Fri, 6 Oct 2006 01:59:37 -0400 (EDT)
- References: <3598859.1160047222554.JavaMail.root@eastrmwml01.mgt.cox.net>
Bob, thanks so much. Diana On 10/5/06, Bob Hanlon <hanlonr at cox.net> wrote: > > Clear[f]; > f[a_,b_,r_]:=0/;a==b==r==0; > f[a_,b_,r_]:=1/Total[ > 1/Select[{a,b,r},#=!=0&&#=!=0.&]]; > > {f[a,b,r],f[0,b,r],f[a,0,r],f[a,b,0],f[a,0.,0],f[0,b,0],f[0,0,r],f[0,0,0]} > > {1/(1/b + 1/r + 1/a), 1/(1/r + 1/b), 1/(1/r + 1/a), > 1/(1/b + 1/a), a, b, r, 0} > > Prior to version 5 use > > Clear[f]; > f[a_,b_,r_]:=0/;a==b==r==0; > f[a_,b_,r_]:=1/Plus@@ > (1/Select[{a,b,r},#=!=0&&#=!=0.&]); > > > Bob Hanlon > > ---- Diana <diana.mecum at gmail.com> wrote: > > Folks, > > > > I am trying to write a program to evaluate the sum of two continued > > fractions, written in polynomials of T. > > > > I would like a short routine to evaluate 1/(1/a + 1/b + 1/r), just > > working with a, b, and r if they are not equal to zero. > > > > So, if a = 0, then evaluate 1/(1/b + 1/r) > > > > If a, b, = 0, then evaluate 1/r > > > > If all of a, b, r = 0, give me 0 as output. > > > > If (1/a + 1/b + 1/r) = 0, give me 0 as output. > > > > Assume that a, b, r are arbitrary polynomials in T. > > > > Can someone help? > > > > Thanks, > > > > Diana > > > > -- > > Bob Hanlon > hanlonr at cox.net > > > -- "God made the integers, all else is the work of man." L. Kronecker, Jahresber. DMV 2, S. 19.