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
(i.e., has head Integer).
The problem is that ChebyshevT does not always return the answer in
its simplest form:
In[1]:= ChebyshevT[x/2,x]/.x->7
Out[1]= Cos[(7 ArcCos[7])/2]
In[2]:= %//FullSimplify
Out[2]= 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[3]:= aa={};Do[If[IntegerQ[FullSimplify@ChebyshevT[x/
2,x]], ,AppendTo[aa,x]],{x,0,20}];aa
Out[3]= {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
> Some comments ?
>
> Best wishes
> Artur