TransWikia.com

Is simplify giving a "not always" correct answer here?

Mathematica Asked by Craig Carter on February 4, 2021

A result like this appears as one of the terms when I compute coefficients in a Fourier Series:

expr =(Sin[n*Pi])/((-4 + n^2))

If I simplify all my terms, this happens:

Simplify[expr, Assumptions -> Element[n, Integers]] (*returns a zero*)

Which is true except if n=-2 or 2:

Limit[expr, n -> 2] (*give Pi/4*)

Shouldn’t Simplify catching that?

One Answer

$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

Clear["Global`*"]

From the "Possible Issues" section of the documentation for Simplify, "results of simplification of expressions with singularities are uncertain"

expr = (Sin[n*Pi])/((-4 + n^2));

The general result would be

expr = Module[{
   roots = n /. Solve[Denominator[expr] == 0, n]},
  Simplify[
   Piecewise[{
     {expr, And @@ Thread[roots != n]},
     Sequence @@ ({Limit[expr, n -> #], n == #} & /@ roots)}],
   Element[n, Integers]]]

enter image description here

Answered by Bob Hanlon on February 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP