MathGroup Archive 2007

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

Search the Archive

Re: Locator question


Hi,

> 1. Probably it would be more reasonable that the third, optional, 
> argument be not an {x,y} point, but instead the x-coordinate of that 
> point, since the point is supposed to be on the graph anyway. 

very good, obviously there is always ways to improve :-)

> The modification for that is trivial:
> 
>   trackPointOnPlot[f_, {a_, b_}, strt_: Automatic] :=
>      Module[{start = strt /. Automatic -> a},
>         DynamicModule[{p = {start, f[start]}},
>            Column[{LocatorPane[Dynamic[p, (p = {First@#, f[First@#]}) &],
>                    Plot[f[x], {x, a, b}]], Dynamic[p]}]]]
> 
> 2. Where/how did you discover the "trick" of using Automatic as a 
> default value for an argument?  I don't recall seeing that before.

Not a trick, really, I just needed a "tag" which tells me that I should 
"automatically" use a as starting value or not. The Symbol Automatic is 
an apparent choice, which is used in many Options for the same purpose, 
as you might well know...

albert


  • Prev by Date: CVS vs. SVN with Workbench
  • Next by Date: Re: style question
  • Previous by thread: Re: Re: Locator question
  • Next by thread: Re: Re: Re: Locator question