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: summing a series in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64172] Re: summing a series in mathematica
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 3 Feb 2006 01:04:04 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <drf72r$ekh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <drf72r$ekh$1 at smc.vnet.net>, Patrik <hosanagar at gmail.com> 
wrote:

> I am trying to sum a function f(R) but want to specify an assumption for 
> values one of the parameters can take. Specifically :
> 
> f = Q!/(R! (Q - R)!) (g ^ R) ((1 - g)^(Q - R)) (P(1 + 2 R d - P)/(1 + R d))
> 
> where g is a CDF and thus lies between 0 and 1. I wanted to get a simplified 
> expression for Sum(f) where R goes from 1 to Q but want the system to account 
> for the constraint on g. I tried:
> 
> FullSimplify[Sum[f,{R,Q}], {R, Q}], {g < 1, g > 0}]

You have repeated {R,Q} here and this code does not work as written. 
Entering the following does work (it is safer to use lowercase symbols):

  $Assumptions = {0 < g < 1}; 

  Sum[q!/(r! (q - r)!) (g ^ r) ((1 - g)^(q - r)) (p (1 + 2 d r - p)/
   (1 + d r)), {r, 1, q}]

an expression involving a Hypergeometric2F1.

Now using Collect and Simplify,

 s[d_, p_, q_][g_] = Collect[% /. Gamma[q + 1] -> q!, 
    Hypergeometric2F1[a_, b_, c_, d_], Simplify]

one has an expression involving a Hypergeometric2F1 that does _not_ 
produce complex values for reasonable parameter values, and also 
evaluates immediately (as a polynomial) for any integer q >= 1. For 
example

  s[d, p, 2][g] // Factor

> But the simplification that mathematica gives has the following term in it:
> 
>  Beta[g/g-1, 1/d + 1, Q]

Using FullSimplify (or FunctionExpand) causes the Hypergeometric2F1 to 
be rewritten as a Beta function -- but also gives rise to terms such as

  (-g)^(-d^(-1))

that are complex for 0 < g < 1 and d > 0.

>  Note that g/(g-1) is actually a negative number & the incomplete beta 
>  function is not defined for negative parameter. 

Yes it is! E.g.,

  Beta[-1, 1, 2]

> My ultimate goal is to take the derivative of the final expression 
> (output of fullsimplify), so I don't mind an approximation if it 
> makes the derivative look simple.

Derivative with respect to what? Computing the derivative with respect 
to g is straightforward and not all that complicated. I assume that you 
are interested in derivatives with respect to g?

 Collect[s[d, p, q]'[g], Hypergeometric2F1[a_, b_, c_, d_], Simplify]

(Note that by separating the parameters [d,p,q] from the argument [g], 
one can compute the derivative using '. Generally, this separation of 
parameters and arguments is a good idea.)

> When I set P=12, you'll see that you get a complex number. 

No. E.g.,

  s[15, 12, 17][1/2]

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Singularities at end point in integrations...
  • Next by Date: Re: Package for calling IMSL and/or NAG Fortran routines
  • Previous by thread: Re: Solve, D, and summations
  • Next by thread: Re: Package for calling IMSL and/or NAG Fortran routines