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


Groups > comp.soft-sys.math.mathematica > #14015 > unrolled thread

what is wrong with this code?

Started bydougwangsaif@gmail.com
First post2013-04-02 07:24 +0000
Last post2013-04-03 08:08 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  what is wrong with this code? dougwangsaif@gmail.com - 2013-04-02 07:24 +0000
    Re: what is wrong with this code? psycho_dad <s.nesseris@gmail.com> - 2013-04-03 08:07 +0000
    Re: what is wrong with this code? Peter Pein <petsie@dordos.net> - 2013-04-03 08:08 +0000

#14015 — what is wrong with this code?

Fromdougwangsaif@gmail.com
Date2013-04-02 07:24 +0000
Subjectwhat is wrong with this code?
Message-ID<kje13u$grc$1@smc.vnet.net>
f[x_] := If[EvenQ[IntegerPart[x]], 0.4, 0.8];
Plot[f[x], {x, 1, 101}]

[toc] | [next] | [standalone]


#14028

Frompsycho_dad <s.nesseris@gmail.com>
Date2013-04-03 08:07 +0000
Message-ID<kjgo06$pu2$1@smc.vnet.net>
In reply to#14015
You're just seeing some artifacts. Increasing the plotpoints gives a better looking plot:

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

BTW, next time try to be a bit more descriptive than just "what's wrong with this", OK? 

[toc] | [prev] | [next] | [standalone]


#14039

FromPeter Pein <petsie@dordos.net>
Date2013-04-03 08:08 +0000
Message-ID<kjgo23$pva$1@smc.vnet.net>
In reply to#14015
Am 02.04.2013 09:24, schrieb dougwangsaif@gmail.com:
> f[x_] := If[EvenQ[IntegerPart[x]], 0.4, 0.8];
> Plot[f[x], {x, 1, 101}]
>
nothing wrong

and this is correct too:

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

Peter

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web