Re: what is wrong with this code?

*To*: mathgroup at smc.vnet.net*Subject*: [mg130323] Re: what is wrong with this code?*From*: James Stein <mathgroup at stein.org>*Date*: Wed, 3 Apr 2013 04:07:42 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <20130402072448.3AA276A87@smc.vnet.net>

An interesting plot! It appears that Mathematica does not evaluate 'f' at a sufficient number of points. In the documentation, i could not find a way to control that; perhaps others will. This code shows the problem: Clear[f, g, z]; z = {}; f[x_] := If[EvenQ[IntegerPart[x]], 0.4, 0.8]; g[x_] := (z = {z, x}; f[x]); Plot[g[x], {x, 1, 101}] z // Flatten // IntegerPart // DeleteDuplicates // Sort On Tue, Apr 2, 2013 at 12:24 AM, <dougwangsaif at gmail.com> wrote: > f[x_] := If[EvenQ[IntegerPart[x]], 0.4, 0.8]; > Plot[f[x], {x, 1, 101}] > >

**References**:**what is wrong with this code?***From:*dougwangsaif@gmail.com