5

Consider the following code and its output:

Simplify[Sin[n Pi]/n, Assumptions -> Element[n, Integers]
(* 0 *)

However when I try

Simplify[Sin[n Pi]/n, Assumptions -> n == 0]

Simplify::infd: Expression Sin[n Pi]/n simplified to Indeterminate.

Indeterminate

I am wondering why didn't Simplify included the separate case n=0 in the first output, and how to avoid this type of errors.

pp.ch.te
  • 191
  • 6

2 Answers2

6

The Possible Issues section of the documentation for Simplify states: "The Wolfram Language evaluates zero times a symbolic expression to zero ... Because of this, results of simplification of expressions with singularities are uncertain."

For the case, n==0 you need to take the Limit

Limit[Sin[n Pi]/n, n -> 0]

(*  π  *)

A Plot shows that this Limit is consistent

Plot[Sin[n Pi]/n, {n, -3, 3}]

enter image description here

Alternatively,

Sin[n Pi]/n == Pi Sin[n Pi]/(n Pi) == Pi Sinc[n Pi] // FullSimplify

(*  True  *)

FullSimplify[Pi Sinc[n Pi], Element[n, Integers]]

(*  π KroneckerDelta[n]  *)

% // PiecewiseExpand

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
2

Reduce is usually careful, compared with Simplify or Solve. (Note that the desired result, here represented by ConditionalExpression, is not really "simpler" in the usual LeafCount/ Simplify`SimplifyCount sense used by Simplify.) One oddity is the mathematically redundant n == 0 in the condition Element[n, Integers] || n == 0 makes a difference: The case n == 0 is not overlooked as it is with just Element[n, Integers]. This is true for Simplify[Sin[n Pi]/n, Element[n, Integers] || n == 0], too, although it returns Sin[n Pi]/n.

Here is the result of Reduce, set up to work like Simplify:

x /. First@Solve[Reduce[(Element[n, Integers] || n == 0) && x == Sin[n Pi]/n], x]
(*  ConditionalExpression[0, (n ∈ Integers && n >= 1) || (n ∈ Integers && n <= -1)]  *)

Note it returns Undefined, as it should as a function of an integer variable, if 0 is subsituted for n:

% /. n -> 0
(*  Undefined  *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747