Re: Locator question
- To: mathgroup at smc.vnet.net
- Subject: [mg79516] Re: Locator question
- From: Albert <awnl at arcor.net>
- Date: Sat, 28 Jul 2007 05:35:09 -0400 (EDT)
- References: <f86r55$pc7$1@smc.vnet.net> <200707250930.FAA26363@smc.vnet.net> <f89pve$5jn$1@smc.vnet.net> <200707261030.GAA09683@smc.vnet.net> <f8cfgv$31j$1@smc.vnet.net>
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
- References:
- Re: Locator question
- From: Albert <awnl@arcor.net>
- Re: Locator question
- From: Albert <awnl@arcor.net>
- Re: Locator question