Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: IntegerPart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130303] Re: IntegerPart
  • From: "Dave Snead" <dsnead6 at charter.net>
  • Date: Tue, 2 Apr 2013 03:25:08 -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: <20130401045851.848996A96@smc.vnet.net>

There's nothing wrong with the IntegerPart function.
Use ListLinePlot instead of Plot:

ListLinePlot[prefstate, AxesOrigin -> {0, 0},
TicksStyle -> Directive[18], PlotStyle -> {Black}]

Cheers,
Dave Snead


-----Original Message----- 
From: dougwangsaif at gmail.com
Sent: Sunday, March 31, 2013 9:58 PM
To: mathgroup at smc.vnet.net
Subject: [mg130303] IntegerPart

can anyone help with this. There seems to be something wrong with the 
IntegerPart function. Please help!

Clear["Global`*"]
nSize = 100;

prefstate = Table[0, {i, 1, nSize}];
Do[
  {prefstate[[i]] = If[EvenQ[i], 0.8, 0.4]},
  {i, 1, nSize}
  ];

Plot[{prefstate[[IntegerPart[x]]]}, {x, 1, nSize + 1},
AxesOrigin -> {0, 0}, TicksStyle -> Directive[18],
PlotStyle -> {Black}]





  • Prev by Date: what is wrong with this code?
  • Next by Date: smp: does Mathematica use Lisp ?
  • Previous by thread: Re: what is wrong with this code?
  • Next by thread: Re: IntegerPart