Re: Evaluation of 1/(1/a + 1/b + 1/r)
- To: mathgroup at smc.vnet.net
- Subject: [mg70170] 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:58:45 -0400 (EDT)
- References: <200610050732.DAA06072@smc.vnet.net> <EE660493-E706-4151-A2A2-B3CE6E70392F@jeol.com>
Sseziwa, thanks so much. Diana On 10/5/06, Sseziwa Mukasa <mukasa at jeol.com> wrote: > > > On Oct 5, 2006, at 3:32 AM, Diana 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? > > You can use pattern matching > > sumFractions[a_,b_,r_]:=1/(1/a+1/b+1/r) > > sumFractions[0,b_,r_]:=1/(1/b+1/r) > > sumFractions[0,0,r_]:=1/r > > sumFractions[0,0,0]:=0 > > As the number of patterns increases the typing can get tedious, you > can write an expression to generate these expressions automatically > but I don't see how 1/(1/a + 1/b + 1/r) -> 1/(1/b + 1/r) when a is > zero or 1/r when a and b are zero. If you know of an expression that > can generate that sequence you can use it to save some typing. > > Regards, > > Ssezi > > > -- "God made the integers, all else is the work of man." L. Kronecker, Jahresber. DMV 2, S. 19.
- References:
- Evaluation of 1/(1/a + 1/b + 1/r)
- From: "Diana" <diana.mecum@gmail.com>
- Evaluation of 1/(1/a + 1/b + 1/r)