[Date Index]
[Thread Index]
[Author Index]
Simplifying Problems
*To*: mathgroup at smc.vnet.net
*Subject*: [mg22392] Simplifying Problems
*From*: "Jordan Rosenthal" <jr at ece.gatech.edu>
*Date*: Sun, 27 Feb 2000 18:55:32 -0500 (EST)
*Organization*: Georgia Institute of Technology, Atlanta GA, USA
*Sender*: owner-wri-mathgroup at wolfram.com
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
Prev by Date:
**Re: linux question**
Next by Date:
**Re: Visualization of Intersections**
Previous by thread:
**Creation of file.m**
| |