MathGroup Archive 2010

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

Search the Archive

Re: Weird vanishing syntax coloring

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107379] Re: [mg107201] Weird vanishing syntax coloring
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Thu, 11 Feb 2010 05:18:39 -0500 (EST)
  • Reply-to: jfultz at wolfram.com

Variables only show in dark blue if they have no value.  They show in black if 
they've been assigned a value of some sort.  This aspect of the syntax coloring 
is not static, as with many other editing systems, but dynamic based upon the 
state of the kernel.

As for your code, I didn't reproduce your exact problem, but there is a 
significant issue with your Manipulate.  The Manipulate defines many new 
symbols, and by default, each time one of these symbols gets redefined, it 
triggers the Manipulate to fire all over again.  What you want in this case is 
for the Manipulate to only be retriggered when you change the slider.  You can 
get this behavior by adding the option...

TrakcedSymbols->True

to the Manipulate command.  I suspect this will fix the problems you've been
having with it.  See the documentation for the TrackedSymbols option for more 
information on how this works.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Fri, 5 Feb 2010 03:23:35 -0500 (EST), James Taylor wrote:
> I have a notebook that fails to show my variables in dark blue most of
> the time--they all are black characters.  The code I am most interested
> in also fails to run a Manipulate statement most of the time--it then
> shows the Manipulate frame with "Abort" inside it instead of my plot.
> Any ideas?  Bug in version 7.0.0 for the Mac?
>
> Thanks!
> James
>
> The code:
> r = 0.25; infVar = .1;
> c = 0.2;
> P = 100000;
> rec = 0.01;
> infCenter = (r c)/P;
> infStart = infCenter/2;
> infEnd = infCenter*1.5;
> infIncrement = (infEnd - infCenter)/20;
> dt = 1;
>
> Manipulate[
> Clear[S, II];
> inf = infVar;
>
> S[t_] := S[t] = S[t - 1] - inf*S[t - 1]*II[t - 1]*dt;
> II[t_] := II[t] = II[t - 1] + inf*S[t - 1]*II[t - 1]*dt -
> rec*II[t - 1]*dt;
> R[t_] := R[t] = R[t - 1] + rec*II[t - 1]*dt;
>
> S[0] = P;
> II[0] = 100;
> II[-1] =
> 100; (* So that Round[II[n]]-Round[II[n-1]] has a value for t=-1 \
> the first time, when calculating new infections *)
> R[0] = 0;
>
> infTable =
> Table[{n, Round[S[n]], Round[II[n]],
> Max[0, Round[II[n]] - Round[II[n - 1]]], Round[R[n]]}, {n, 0,
> 500}] ;
>
> ListPlot[infTable[[All, {1, 2}]], PlotStyle -> PointSize[0.01],
> Joined -> True, PlotRange -> {0, 100000},
> PlotLabel -> "inf coeff " infVar], {infVar, infStart, infEnd,
> infIncrement}]
>
> May your trails be crooked, winding, lonesome, dangerous, leading to the
> most amazing view. May your mountains rise into and above the clouds.
> --Edward Abbey
>
> Nothing in the cry
> of cicadas suggests they
> are about to die
> --Basho
>
> First there is a mountain, then there is no mountain, then there is.
> --Donovan
>
> James C Taylor
> Computer Science & Technology Department
> Santa Fe Preparatory School
> 1101 Camino de la Cruz Blanca
> Santa Fe, NM  87505
> (505) 982-1829 x1241 (voice),  982-2897 (fax)
> www.sfprep.org/dept-computer
> jtaylor at sfprep.org




  • Prev by Date: manipulate plot
  • Next by Date: Re: Plotting two list variables
  • Previous by thread: Re: Weird vanishing syntax coloring
  • Next by thread: Re: Weird vanishing syntax coloring