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: [mg70166] Re: [mg70129] Evaluation of 1/(1/a + 1/b + 1/r)
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Fri, 6 Oct 2006 01:58:24 -0400 (EDT)
  • References: <200610050732.DAA06072@smc.vnet.net>

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



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