Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Evaluation of 1/(1/a + 1/b + 1/r)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70165] Re: [mg70129] Evaluation of 1/(1/a + 1/b + 1/r)
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 6 Oct 2006 01:58:22 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

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



  • Prev by Date: Re: Beginner--[Please Help]How to get coefficient list issued from a Series Command
  • Next by Date: Re: Beginner--[Please Help]How to get coefficient list issued from a Series Command
  • Previous by thread: Re: Evaluation of 1/(1/a + 1/b + 1/r)
  • Next by thread: Re: Evaluation of 1/(1/a + 1/b + 1/r)