MathGroup Archive 2000

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

Search the Archive

Re: Simplifying Problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22401] Re: [mg22392] Simplifying Problems
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Wed, 1 Mar 2000 00:39:50 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

on 2/28/00 12:55 AM, Jordan Rosenthal at jr at ece.gatech.edu wrote:

> Hi all,
> 
> Two questions:
> 
> ------------------------
> First question:
> ------------------------
> I have an expression which has a sum of a number of sinc-like terms.  For
> example,
> 
> f[k] = Sin[k Pi] / k
> 
> If I try using simplify with the assumption that k is an integer I get
> 
> In[2]:=
> Simplify[f[k], k \[Element] Integers]
> 
> Out[2]=
> 0
> 
> Although this is true for most integers, it is incorrect for the integer
> k==0 since f[0] = Pi.  So why is this happening?  I would have expected it
> to either leave the expression untouched or to give me an If expression.
> 
> What I would like is to be able to convert the expression to
> 
> If[ k==0, Pi, 0]
> 
> What is the best way to do this?  I can setup a rule like:
> 
> f[k] /. Sin[k_*Pi]/k_ -> If[k == 0, Pi, 0]
> 
> but my problem is that this does not account for the fact that the pattern
> k_ must be an integer.  How do I include that information?  (See my second
> question for why I can't just use k_?IntegerQ).
> 
> ------------------------
> Second question:
> ------------------------
> Let's say I declare a variable to be an Integer with
> 
> j \[Element] Integers
> 
> Now I set up a function which should only work on integers
> 
> f[x_?IntegerQ] = x+2
> 
> This, however, does not recognize that the variable j has been declared an
> integer:
> 
> In[3]:=
> f[2]
> 
> Out[3]=
> 4
> 
> In[4]:=
> f[j]
> 
> Out[4]=
> f[j]
> 
> Is there a way I can get the function to work for variables declared as
> integers with the Element function?
> 
> 
> Any help is appreciated.  Thanks,
> 
> Jordan
> 
> 
> 
> 
> 
> 
First question. Actually, though this may sound pedantic, it is not strictly
true that Sin[0]/0 is 1. The expression is undefined: what is true that the
limit of Sin[x]/x is 1 as x ->0. This distinction is often ignored by
applied mathematicians, but convenience is not quite the same as
mathematical correctness! Still, there are good rounds for arguing that in a
program like Mathematica convenience should take precedence. Moreover, the
answer given by Simplify[Sin[Pi*k]/k,Element[k,Integers]
is definitely incorrect for k=0. So some time ago I made exactly your point
on this list and received and received the following reply from David
Withoff <withoff at wolfram.com>:

> You may be interested to know that this is not currently considered a
> bug in Simplify.  The Simplify function only adds transformations.  It
> does not disable transformations that would already have been done by
> the system without Simplify.
> 
> To underscore this point, consider
> 
> In[1]:= Simplify[0/x, x==0]
> 
> Out[1]= 0
> 
> To behave otherwise the Simplify function would need to implement its
> own system of algebra.  There are not currently any plans to do that.
> 
> Similar observations apply to a wide variety of calculations.
-- 
-- 




  • Prev by Date: Re: Simplifying Problems
  • Next by Date: Re: Transformation Methods for Pi
  • Previous by thread: Re: Simplifying Problems
  • Next by thread: Re: Simplifying Problems