Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Beginning syntax problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104550] Re: [mg104538] Beginning syntax problems
  • From: Larry Adelston <larrya at wolfram.com>
  • Date: Wed, 4 Nov 2009 01:30:48 -0500 (EST)
  • References: <200911030755.CAA01540@smc.vnet.net> <BCE0AE11-F412-4CC4-9544-C6E84B656CF2@wolfram.com>

Hi Michael,

With a little help from my colleagues I was also able to get the "b"  
value to update in the table by removing the list {b, 2, -2, -.5,  
ControlType -> None} and replacing {x, Dynamic[m]*x + 2} with {x,  
Dynamic[m]*x + Dynamic[b]} in your Table expression. The full code  
then becomes:

Grid[{{Manipulate[
     Graphics[{{Dotted, Line[{{1, 0}, {1, m + b}}]}, {Dotted,
        Line[{{0, m + b}, {1, m + b}}]},
       Annotation[Line[t = {Table[{x, m*x + b}, {x, -5, 5}]}], "Line",
        "Mouse"]}, Axes -> True, AxesLabel -> {x, "y=mx+b"},
      PlotRange -> {{-5, 5}, {-5, 5}}],
     Row[{"m",
       Manipulator[Dynamic[m], {2, -2, -.5}, Appearance -> "Labeled",
        ImageSize -> Small], "b",
       Manipulator[Dynamic[b], {2, -2, -.5}, Appearance -> "Labeled",
        ImageSize -> Small]}]],
    Grid[Prepend[
      Table[{x, Dynamic[m]*x + Dynamic[b]}, {x, -5, 5}], {Style["x",  
Bold],
       Style["y", Bold]}], Frame -> {All, False}]}}]



On Nov 3, 2009, at 11:02 AM, Larry Adelston wrote:

> Hi Michael,
>
> I am able to help you with the table formatting. I am not able to  
> determine why the right column, in particular, your "b" value is not  
> updating. But the following should help the formatting anyway.
>
> Grid[{{Manipulate[
>    Graphics[{{Dotted, Line[{{1, 0}, {1, m + b}}]}, {Dotted,
>       Line[{{0, m + b}, {1, m + b}}]},
>      Annotation[Line[t = {Table[{x, m*x + b}, {x, -5, 5}]}], "Line",
>       "Mouse"]}, Axes -> True, AxesLabel -> {x, "y=mx+b"},
>     PlotRange -> {{-5, 5}, {-5, 5}}], {b, 2, -2, -.5, ControlType ->  
> None},
>    Row[{"m",
>      Manipulator[Dynamic[m], {2, -2, -.5}, Appearance -> "Labeled",
>       ImageSize -> Small], "b",
>      Manipulator[Dynamic[b], {2, -2, -.5}, Appearance -> "Labeled",
>       ImageSize -> Small]}]],
>   Grid[Prepend[
>     Table[{x, Dynamic[m]*x + 2}, {x, -5, 5}], {Style["x", Bold],
>      Style["y", Bold]}], Frame -> {All, False}]}}]
>
>
> On Nov 3, 2009, at 1:55 AM, Michael Greene wrote:
>
>> Grid[{{Manipulate[
>>   Graphics[{{Dotted, Line[{{1, 0}, {1, m + b}}]}, {Dotted,
>>      Line[{{0, m + b}, {1, m + b}}]},
>>     Annotation[Line[t = {Table[{x, m*x + b}, {x, -5, 5}]}], "Line",
>>      "Mouse"]
>>     }, Axes -> True, AxesLabel -> {x, "y=mx+b"},
>>    PlotRange -> {{-5, 5}, {-5, 5}}], {b, 2, -2, -.5,
>>    ControlType -> None},
>>   Row[{"m",
>>     Manipulator[Dynamic[m], {2, -2, -.5}, Appearance -> "Labeled",
>>      ImageSize -> Small], "b",
>>     Manipulator[Dynamic[b], {2, -2, -.5}, Appearance -> "Labeled",
>>      ImageSize -> Small]}]],
>>  Grid[{"x", "y",
>>    Grid[Table[{x,  Dynamic[m]*x + 2}, {x, -5, 5}],
>>     Frame -> {All, False}]}]}}]
>



  • Prev by Date: Re: Set::setps error? Twitter.m's OOP-like approach?
  • Next by Date: Re: Re: dynamicmodule with f[x_] possible?
  • Previous by thread: Re: Beginning syntax problems
  • Next by thread: Re: Beginning syntax problems