Re: TELLING PROGRAM THAT A VARIABLE IS AN INTEGER
- To: mathgroup@smc.vnet.net
- Subject: [mg11605] Re: TELLING PROGRAM THAT A VARIABLE IS AN INTEGER
- From: "Stephen P Luttrell" <luttrell@signal.dra.hmg.gb>
- Date: Tue, 17 Mar 1998 10:43:40 -0500
- Organization: Defence Evaluation and Research Agency
- References: <199803131721.MAA03631@smc.vnet.net.> <6ekatp$jlt@smc.vnet.net>
>... >As it stands right now, you have to do these things manually and decide >that n is an integer yourself and then define Sin[n Pi]->0. What would >be really nice is if you could do something like Sin[_Integer Pi]->0 >and have that kind of a pattern stick, but that code doesn't work and I >don't know of any way to do that kind of thing without a lot of >programming. >... You could make the following definitions: Unprotect[Sin]; Sin[m_ \[Pi]]:=0/;IntegerQ[m]\[Equal]True Protect[Sin]; IntegerQ[n]^=True Then evaluate Sin[n \[Pi]] to obtain 0 ====================================================== Stephen P Luttrell luttrell@signal.dra.hmg.gb Adaptive Systems Theory 01684-894046 (phone) Room EX21, DERA 01684-894384 (fax) Malvern, Worcs, WR14 3PS, U.K. http://www.dra.hmg.gb/cis5pip/Welcome.html
- References:
- TELLING PROGRAM THAT A VARIABLE IS AN INTEGER
- From: blimbaum_jerry@ccmail.ncsc.navy.mil
- TELLING PROGRAM THAT A VARIABLE IS AN INTEGER