       Re: May we trust IntegerQ ?

• To: mathgroup at smc.vnet.net
• Subject: [mg107510] Re: May we trust IntegerQ ?
• From: Simon <simonjtyler at gmail.com>
• Date: Mon, 15 Feb 2010 05:47:32 -0500 (EST)
• References: <hl8t3l\$26h\$1@smc.vnet.net>

```Hi Artur,

The problem is not with IntegerQ -- which if you look at the
documentation says that
IntegerQ[expr] returns False unless expr is manifestly an integer

The problem is that ChebyshevT does not always return the answer in
its simplest form:

In:= ChebyshevT[x/2,x]/.x->7
Out= Cos[(7 ArcCos)/2]
In:= %//FullSimplify
Out= 5042

The Cos[x ArcCos[x] / 2]  (which is the general form for the
polynomial) does not have Head[%1] == Integer
The following gives the correct (I hope) result.  Note the
FullSimplify (which might be overkill)

In:= aa={};Do[If[IntegerQ[FullSimplify@ChebyshevT[x/
2,x]], ,AppendTo[aa,x]],{x,0,20}];aa
Out= {3,5,9,11,13,15,17,19}

Simon

On Feb 14, 9:16 pm, Artur <gra... at csl.pl> wrote:
> Procedure: find such x that ChebyshevT[x/2, x] isn't integer
> aa = {}; Do[ If[IntegerQ[ChebyshevT[x/2, x]], , AppendTo[aa, x]], {x, 0,
> 20}]; aa
> and answer Mathematica is set:
> {3, 5, 7, 9, 11, 13, 15, 17, 19}
> where occered e.g. number 7
> N[ChebyshevT[7/2, 7],100]
> 5042.00000000000000000000000000000000000000000000000000000000000000000\
> 0000000000000000000000000000000
> evidently is integer 5042