Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14015 > unrolled thread
| Started by | dougwangsaif@gmail.com |
|---|---|
| First post | 2013-04-02 07:24 +0000 |
| Last post | 2013-04-03 08:08 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
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
| From | dougwangsaif@gmail.com |
|---|---|
| Date | 2013-04-02 07:24 +0000 |
| Subject | what 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]
| From | psycho_dad <s.nesseris@gmail.com> |
|---|---|
| Date | 2013-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]
| From | Peter Pein <petsie@dordos.net> |
|---|---|
| Date | 2013-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