2
$\begingroup$

These two sequences are identical:

a[n_] := 1/Gamma[(1 - n)/2]

c[n_] := If[EvenQ[n], 1/Gamma[(1 - n)/2], 0]

Table[a[n], {n, 0, 1000}] == Table[c[n], {n, 0, 1000}]
(* True *)

Nevertheless, FullSimplify[a[n] == c[n], {n \[Element] Integers, n >= 0}] returns False. Why is this?

v12.0.0.0

$\endgroup$
1
  • $\begingroup$ The EvenQ problem aside: Is a[1] undefined or zero? Mathematically, 1 is not in the domain. Computationally, Gamma returns ComplexInfinity, and 1/ComplexInfinity evaluates to 0. Consider: Reduce[FunctionDomain[1/Gamma[(1 - n)/2], n] && n \[Element] Integers]. Also, this returns the "mathematical" result: c[n_] := If[(1 - n)/2 \[NotElement] Integers, 1/Gamma[(1 - n)/2], 0]; FullSimplify[a[n] == c[n], {n \[Element] Integers, n >= 0}] $\endgroup$
    – Michael E2
    Jul 18, 2020 at 20:16

1 Answer 1

4
$\begingroup$

EvenQ[n] is False for symbolic n. EvenQ will only return True for literal even integers, and False for everything else. It is a convention in Mathematica that any function ending in Q returns either True or False for any input.

Think of EvenQ as a function in the programming sense, not the mathematical sense.

You can detect this problem by looking at what c[n] evaluates to (as opposed to e.g. what c[2] evaluates to).

Generally, a possible solution could be c[n_] := Piecewise[{{1/Gamma[(1 - n)/2], Mod[n, 2] == 0}}, 0]. This won't quite work here. FullSimplify will return Mod[n,2] == 0 as it can't figure out that a[n] == 0 for any odd n.

$\endgroup$
3
  • $\begingroup$ Symbolic processing, Simplify and friends, cannot generally reason about things that are functions in the programming sense. $\endgroup$
    – John Doty
    Jul 18, 2020 at 19:58
  • $\begingroup$ @JohnDoty It's not that they cannot reason, but that FullSimplify never even sees that EvenQ. Evaluate c[n]. There is no EvenQ there. It's gone, evaluated to False. $\endgroup$
    – Szabolcs
    Jul 18, 2020 at 20:11
  • $\begingroup$ One might imagine an easy fix: define c[n_Integer] := .... But then, Simplify has no way to look inside the definition and reason about the algorithm. $\endgroup$
    – John Doty
    Jul 18, 2020 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.