MathGroup Archive 2009

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

Search the Archive

Re: Beginning syntax problems


Something like this?

Manipulate[
  Row@{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 = m x + b"},
     PlotRange -> {{-5, 5}, {-5, 5}}, ImageSize -> 400],
    Grid[Prepend[Table[{x, m*x + b}, {x, -5, 5}], {x, y}],
     Frame -> {All, 1 -> True}]}, {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]}]]

Bobby

On Tue, 03 Nov 2009 01:55:53 -0600, Michael Greene <mgreene at csumb.edu>  
wrote:

> I'm coaching a middle school Mathcounts program and am attempting to use
> Mathematica to illustrate some simple ideas.  I've created the following
> script to illustrate slope and intercept.
>
> 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}]}]}}]
>
> My problems with the script are twofold. First, I can't get the table on  
> the
> right side to dynamically update its values as I adjust the slope and
> intercept. The second problem is I'm having a heck of a time placing  
> labels
> on top of their respective columns in the same table. I'm just trying to  
> put
> an x and a y above the two table columns but can't figure out the correct
> Mathematica syntax to make it happen.
>
> Can anyone correct the above script so it exhibits those two features?
>
> Thanks,
>
> Michael green
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Beginning syntax problems
  • Next by Date: Re: Set::setps error? Twitter.m's OOP-like approach?
  • Previous by thread: Re: Beginning syntax problems
  • Next by thread: Re: Beginning syntax problems