Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14035

Re: what is wrong with this code?

From James Stein <mathgroup@stein.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: what is wrong with this code?
Date 2013-04-03 08:07 +0000
Message-ID <kjgnvr$pst$1@smc.vnet.net> (permalink)
References <20130402072448.3AA276A87@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@gmail.com> wrote:

> f[x_] := If[EvenQ[IntegerPart[x]], 0.4, 0.8];
> Plot[f[x], {x, 1, 101}]
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: what is wrong with this code? James Stein <mathgroup@stein.org> - 2013-04-03 08:07 +0000

csiph-web