2

I want to solve the following equation

Solve[Gamma[1 + x]/Gamma[x - 1/2] + 1 == 0, x]

I have answer x=-0.25, but I can not obtain this answer with Mathematica. Any suggestion?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Bahram Agheli
  • 504
  • 2
  • 12

3 Answers3

8
Gamma[1 + x]/Gamma[x - 1/2] + 1 /. x -> -0.25
0.746508
Plot[Gamma[1 + x]/Gamma[x - 1/2] + 1, {x, -2, 2}]

Mathematica graphics

FindRoot[Gamma[1 + x]/Gamma[x - 1/2] + 1, {x, -1.4}]

{x -> -1.35003}

Plot[Gamma[1 + x]/Gamma[x - 1/2] + 1, {x, -2, 2}, 
 Epilog -> {Red, PointSize[Large], Point[{-1.35, 0}]}]

Mathematica graphics

rhermans
  • 36,518
  • 4
  • 57
  • 149
8

Introduction

There should be a duplicate of this question somewhere on this site:

How does one solve a transcendental equation?

That is basically what this question comes down to.

@Artes has some great answers to this kind of question (see these search results), as do others, and his answer to Solving Inequalities with Gamma Function addresses the issue here, although that question is focused on proving an inequality. The problem in determining whether another question is a duplicate comes down to when niggling details are insignificant and when they distinctive.

Some transcendental equations can be solved outright by Solve and there are some cases where Reduce or NSolve will succeed where Solve fails. In cases where Reduce succeeds, the solutions can be expected to be obtained through Solve via the option Method -> Reduce. If all these solvers fail, then one is left with searching for roots with FindRoot or even Plot functions and NDSolve.

When the equation is not solved by Solve or NSolve, one can often find the solutions in given ranges for the variables by including inequalities for the variables in the system of equations. Sometimes this returns some but not all solutions. Often a warning message is issued if Mathematica could not prove it found all the solutions. This does not necessarily mean that it missed some, only that it might have missed some. (I do not know whether the lack of such a warning means it has found all solutions; barring bugs, I would be inclined to think so.) There are options that can change the effectiveness of solvers. See this Chat exchange about the following example.

With[{sysopts = SystemOptions["ReduceOptions"]},
 Internal`WithLocalSettings[
  SetSystemOptions["ReduceOptions" -> {"IntervalRootsOptions" -> {"MaxFailures" -> 500}}],
  NSolve[Tan[1/x] == x && -1 < x < 1, x],
  SetSystemOptions[sysopts]
  ]]

OP's example

In the present case, if we add an interval restriction for x to Solve or NSolve, we get the solutions in the interval. We also get the warning that Mathematica could not prove all solutions were found. (If you look at the graph, it seems highly unlikely that any were missed.)

Solve[Gamma[1 + x]/Gamma[x - 1/2] + 1 == 0 && -5 < x < 0, x]

Solve::incs: Warning: Solve was unable to prove that the solution set found is complete. >>

{{x -> Root[{Gamma[-(1/2) + #1] + Gamma[1 + #1] &, -4.46893828993129591992496474699}]},
 {x -> Root[{Gamma[-(1/2) + #1] + Gamma[1 + #1] &, -3.45541261687696656217049758405}]},
 {x -> Root[{Gamma[-(1/2) + #1] + Gamma[1 + #1] &, -2.42782741941729578989446499935}]},
 {x -> Root[{Gamma[-(1/2) + #1] + Gamma[1 + #1] &, -1.35003346091660385890507014012}]}}

Solve yields exact answers, often in the form of Root objects as above (see also this answer, How do I work with Root objects?). NSolve will return approximate solutions (of MachinePrecision by default):

NSolve[Gamma[1 + x]/Gamma[x - 1/2] + 1 == 0 && -5 < x < 0, x]
(*  {{x -> -4.46894}, {x -> -3.45541}, {x -> -2.42783}, {x -> -1.35003}}  *)

Example where Solve fails and NSolve succeeds

A slight tweak of the OP's equation cause Solve to fail. (I don't know why.)

Solve[Gamma[1 + x]/Gamma[x + 1/2] + 1 == 0 && -2 < x < 0, x]

Solve::nsmet: This system cannot be solved with the methods available to Solve. >>

Reduce also fails, but NSolve succeeds:

NSolve[Gamma[1 + x]/Gamma[x + 1/2] + 1 == 0 && -2 < x < 0, x]
(*{{x -> -4.64162}, {x -> -3.65785}, {x -> -2.68115}, {x -> -1.71854}, {x -> -0.791949}}*)
Michael E2
  • 235,386
  • 17
  • 334
  • 747
7
Solve[Gamma[1 + x]/Gamma[x - 1/2] + 1 == 0 && -10 < x < 0, x, 
Reals] // N // Quiet

 {x -> -9.48952, x -> -8.48767, x -> -7.4852, x -> -6.48176, 
  x -> -5.47676, x -> -4.46894, x -> -3.45541, x -> -2.42783,x -> -1.35003}

NSolve is 10 times faster :)

NSolve[Gamma[1 + x]/Gamma[x - 1/2] + 1 == 0 && -10 < x < 0, x, Reals]
Mariusz Iwaniuk
  • 13,841
  • 1
  • 25
  • 41