Re: 0.0 is different with 0?
- To: mathgroup at smc.vnet.net
- Subject: [mg90053] Re: 0.0 is different with 0?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Fri, 27 Jun 2008 06:18:10 -0400 (EDT)
- References: <g3vkss$kfs$1@smc.vnet.net>
damayi wrote:
> Dear all
> Here is an example to show my question.
> SF[N_Integer, a_Real, fs_Real] :=
> Table[Sin[(1 + fs)*k*2 Pi/N + a], {k, 0, N - 1}]
>
> SF[32, 0.1, 0.0] can show the table contents, however, SF[32, 0.1, 0]
> cannot show the result. Why?
>
> Best Regards
> mayi
> 2008-06-26
>
Because by using the pattern fs_Real, you have specified a pattern that
can only match a real number - not the integer 0 - indeed the title of
your query says it all!
If you want a pattern that can match any number, try fs_?NumericQ
David Bailey
http://www.dbaileyconsultancy.co.uk