MathGroup Archive 2005

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

Search the Archive

Re: Re: Some bugs in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59226] Re: Re: [mg59188] Some bugs in Mathematica
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 2 Aug 2005 03:14:31 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Looking at the sum in more detail:

s1[n_] :=
    Sum[x^k*(Gamma[n-k-1/2]*Gamma[k+1/2])/
          (Gamma[n-k-1]*Gamma[k+1]),{k,0,n-1}];

Calculating each term separately

TableForm[t=Table[(Gamma[n-k-1/2]*Gamma[k+1/2])/(Gamma[n-k-1]
*Gamma[k+1]),
      {n,5},{k,0,n-1}],
  TableHeadings->{Automatic,Table[i,{i,0,4}]}]

Summing each row of the table

Tr/@t

{0, Pi/2, Pi, (3*Pi)/2, 2*Pi}

For example, for n=2, the term for k=0 is

((Gamma[n-k-1/2]*Gamma[k+1/2])/(Gamma[n-k-1]*Gamma[k+1])/.
{n->2,k->0}) ==
  Gamma[3/2]*Gamma[1/2]/(Gamma[1]*Gamma[1])==
  (1/2)*Gamma[1/2]*Gamma[1/2]==Pi/2

True

and the term for k=1 is

((Gamma[n-k-1/2]*Gamma[k+1/2])/(Gamma[n-k-1]*Gamma[k+1])/.
{n->2,k->1})==
  Gamma[1/2]*Gamma[3/2]/(Gamma[0]*Gamma[2])==0

True

Alternatively, generalizing the sum

s1[n_,x_]=
  Sum[x^k*(Gamma[n-k-1/2]*Gamma[k+1/2])/
        (Gamma[n-k-1]*Gamma[k+1]),{k,0,n-1}]

(Sqrt[Pi]*Gamma[n - 1/2]*Hypergeometric2F1[1/2, 2 - n, 3/2 - n, x])/Gamma
[n - 1]

Table[s1[n,x],{n,5}]

{0, Pi/2, (1/4)*Pi*(x + 3), (3/16)*Pi*(x^2 + 2*x + 5), 
  (1/32)*Pi*(5*x^3 + 9*x^2 + 15*x + 35)}

%/.x->1

{0, Pi/2, Pi, (3*Pi)/2, 2*Pi}

And@@Table[(s1[n]==s1[n,x]==(n-1)*Pi/2)/.x->1,{n,25}]

True


Bob Hanlon

> 
> From: "Alex Khmelnitsky" <akhmel at hotmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/08/01 Mon AM 10:07:41 EDT
> To: "Bob Hanlon" <hanlonr at cox.net>
> Subject: [mg59226] Re: [mg59188] Some bugs in Mathematica
> 
> 1) You are wrong. My sum is equal to 1 for any n and the respectable 
program
> like Mathematica claims to be should know it.
> 
> 2) The integral is elementary, a doesn't have to be equal to b to give a
> logarithm.
> 
> 3) I had enough patience, so you better trust me.
> 
> Alex
> 
> ----- Original Message ----- 
> From: "Bob Hanlon" <hanlonr at cox.net>
To: mathgroup at smc.vnet.net
> To: <akhmel at hotmail.com>; <mathgroup at smc.vnet.net>
> Cc: <hanlonr at cox.net>
> Sent: Monday, August 01, 2005 7:08 AM
> Subject: [mg59226] Re: [mg59188] Some bugs in Mathematica
> 
> 
> > $Version
> >
> > 5.2 for Mac OS X (June 20, 2005)
> >
> > Question 1:
> >
> > s1[n_]:=Sum[(Gamma[n-k-1/2]*Gamma[k+1/2])/
> >        (Gamma[n-k-1]*Gamma[k+1]),
> >       {k,0,n-1}];
> >
> > For arbitrary n, this sum is unevaluated
> >
> > s1[n]
> >
> > Sum[(Gamma[k + 1/2]*Gamma[-k + n - 1/2])/
> >    (Gamma[k + 1]*Gamma[-k + n - 1]),
> >   {k, 0, n - 1}]
> >
> > For specific nonnegative integer values of n
> >
> > Table[s1[n],{n,5}]
> >
> > {0, Pi/2, Pi, (3*Pi)/2, 2*Pi}
> >
> > For nonnegative integer values of n, this sum appears to be (n-1)*Pi/2
> >
> > And@@Table[s1[n]==(n-1)*Pi/2,{n,25}]
> >
> > True
> >
> > Question 2:
> >
> > int1=Integrate[1/(r*Sqrt[r^2-a^2]*
> >          Sqrt[r^2-b^2]),r]
> >
> > -((Sqrt[1 - a^2/r^2]*Sqrt[1 - b^2/r^2]*
> >    AppellF1[1, 1/2, 1/2, 2, a^2/r^2,
> >     b^2/r^2])/(2*Sqrt[r^2 - a^2]*
> >    Sqrt[r^2 - b^2]))
> >
> > int2=Simplify[int1,Element[r, Reals]]
> >
> > -(AppellF1[1, 1/2, 1/2, 2, a^2/r^2,
> >    b^2/r^2]/(2*r^2))
> >
> > These simplify to a log if b equals a
> >
> > Simplify[int1/.b->a]
> >
> > Log[1 - a^2/r^2]/(2*a^2)
> >
> > int2 /. b->a
> >
> > Log[1 - a^2/r^2]/(2*a^2)
> >
> > Question 3:
> >
> > Your last integral did not return in the amount of time I was willing to
> > wait.
> >
> >
> > Bob Hanlon
> >
> > On 8/1/05 1:05 AM, "akhmel at hotmail.com" <akhmel at hotmail.com> 
wrote:
> >
> > > Dear Mr. Lichtblau,
> > >
> > > I attach hereby Mathematica file with 3 examples, which you might be
> > > interested to look at.
> > >
> > > 1) Example of summation which gives an obviously wrong result, 0
> > > instead of
> > > 1.
> > > 2) Example of indefinate integration, which gives appel function
> > > instead of
> > > elementary logarithm.
> > > 3) Definite integration which doesn't give any result at all, though
> > > again,
> > > it is nothing but elementary function.
> > >
> > > Your comments will be appreciated.
> > >
> > > Thanks,
> > >
> > > Alex
> > >
> > >
> > > Notebook[{
> > >
> > > Cell[CellGroupData[{
> > > Cell[BoxData[
> > >     \(Sum[\(Gamma[n - k - 1/2] Gamma[k + 1/2]\)\/\(Gamma[n - k - 
1]
> > > Gamma[k + \
> > > 1]\), {k, 0, n - 1}]\)], "Input"],
> > >
> > > Cell[BoxData[
> > >     \(0\)], "Output"]
> > > }, Open  ]],
> > >
> > > Cell[CellGroupData[{
> > >
> > > Cell[BoxData[
> > >     \(Integrate[1\/\(r \(\@\( r\^2 - a\^2\)\) \@\(r\^2 - b\^2\)\),
> > >       r]\)], "Input"],
> > >
> > > Cell[BoxData[
> > >     \(\(-\(\(\@\(1 - a\^2\/r\^2\)\ \@\(1 - b\^2\/r\^2\)\ AppellF1[1,
> > > 1\/2,
> > >               1\/2, 2, a\^2\/r\^2,
> > >               b\^2\/r\^2]\)\/\(2\ \@\(\(-a\^2\) + r\^2\)\ \@\(\(-b\^2\)
> > > + \
> > > r\^2\)\)\)\)\)], "Output"]
> > > }, Open  ]],
> > >
> > > Cell[BoxData[
> > >     \(\(\(-\(\(\@\(1 - a\^2\/r\^2\)\ \@\(1 - b\^2\/r\^2\)\ AppellF1[1,
> > > 1\/2,
> > >               1\/2, 2, a\^2\/r\^2,
> > >               b\^2\/r\^2]\)\/\(2\ \@\(\(-a\^2\) + r\^2\)\ \@\(\(-b\^2\)
> > > + \
> > > r\^2\)\)\)\)\(\[IndentingNewLine]\)
> > >     \)\)], "Input"],
> > >
> > > Cell[CellGroupData[{
> > >
> > > Cell[BoxData[
> > >     \(Integrate[
> > >       1\/\(\(r\^3\) \(\@\(r\^2 - a\^2\)\) \@\(r\^2 - b\^2\)\), {r, x,
> > >         a}]\)], "Input"],
> > >
> > > Cell[BoxData[
> > >     \(Integrate::"gener" \(\(:\)\(\ \)\)
> > >       "Unable to check convergence."\)], "Message"],
> > >
> > > Cell[BoxData[
> > >     \(\[Integral]\_x\%a\(
> > >             1\/\(r\^3\ \@\(\(-a\^2\) + r\^2\)\ \@\(\(-b\^2\) +
> > > r\^2\)\)\) \
> > > \[DifferentialD]r\)], "Output"]
> > > }, Open  ]]
> > > },
> > > FrontEndVersion->"4.2 for Microsoft Windows",
> > > ScreenRectangle->{{0, 720}, {0, 407}},
> > > WindowSize->{496, 249},
> > > WindowMargins->{{0, Automatic}, {Automatic, 0}}
> > > ]
> > >
> > > (*******************************************************************
> > > Cached data follows.  If you edit this Notebook file directly, not
> > > using Mathematica, you must remove the line containing CacheID at
> > > the top of  the file.  The cache data will then be recreated when
> > > you save this file from within Mathematica.
> > > *******************************************************************)
> > >
> > > (*CellTagsOutline
> > > CellTagsIndex->{}
> > > *)
> > >
> > > (*CellTagsIndex
> > > CellTagsIndex->{}
> > > *)
> > >
> > > (*NotebookFileOutline
> > > Notebook[{
> > >
> > > Cell[CellGroupData[{
> > > Cell[1776, 53, 127, 2, 44, "Input"],
> > > Cell[1906, 57, 35, 1, 29, "Output"]
> > > }, Open  ]],
> > >
> > > Cell[CellGroupData[{
> > > Cell[1978, 63, 103, 2, 48, "Input"],
> > > Cell[2084, 67, 228, 4, 71, "Output"]
> > > }, Open  ]],
> > > Cell[2327, 74, 259, 5, 98, "Input"],
> > >
> > > Cell[CellGroupData[{
> > > Cell[2611, 83, 126, 3, 48, "Input"],
> > > Cell[2740, 88, 107, 2, 24, "Message"],
> > > Cell[2850, 92, 148, 3, 46, "Output"]
> > > }, Open  ]]
> > > }
> > > ]
> > > *)
> > >
> >
> >
> >
> 


  • Prev by Date: Re: Re: NIntegrate::inum continued
  • Next by Date: Visualizing the "10th planet"
  • Previous by thread: Re: Some bugs in Mathematica
  • Next by thread: Re: Some bugs in Mathematica