MathGroup Archive 2014

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

Search the Archive

Re: Plot in manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132169] Re: Plot in manipulate
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 9 Jan 2014 01:50:30 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20140108084208.473A06A08@smc.vnet.net>

Manipulate[
 TT = (initialvelocity +
     Sqrt[initialvelocity^2 + 2 gravity height])/gravity;
 Potential[t_] = gravity*
   (-.5 gravity t^2 + initialvelocity t + height)*mass;
 Kinetic[t_] = .5 mass (-gravity t + initialvelocity)^2;
 If[time > TT, time = TT];
 Plot[{
   -.5 gravity tt^2 + initialvelocity tt + height,
   Potential[tt], Kinetic[tt]},
  {tt, 0, TT + .005},
  Epilog -> {LightGray, AbsoluteDashing[{5, 5}],
    Line[{{time, 0},
      {time, Max[Potential[time], Kinetic[time]]}}],
    RGBColor[.49, 0, 0],
    Disk[
     {time, -.5 gravity time^2 + initialvelocity time + height},
     5 mass]},
  PlotRange -> {{-.5, 12.5}, {-.5, 23}},
  AspectRatio -> 23.5/13,
  PlotLegends -> {"Position", "Potential", "Kinetic"}],
 {{time, .0, "Time"}, 0.000, Round[Dynamic[(initialvelocity +
       Sqrt[initialvelocity^2 + 2 gravity height])/gravity], .001], .01,
  Appearance -> "Labeled",
  ControlPlacement -> Bottom,
  ImageSize -> Large},
 {{mass, .07, "Mass"}, .001, .1, .001,
  ImageSize -> Tiny,
  Appearance -> "Labeled"},
 {{gravity, 9.8, "Gravity"}, 1, 20, .01,
  ImageSize -> Tiny,
  Appearance -> "Labeled"},
 {{initialvelocity, 5, "Initial Velocity"},
  0, 5, .01,
  ImageSize -> Tiny,
  Appearance -> "Labeled"},
 {{height, 5., "Height"}, 0, 10, .01,
  ImageSize -> Tiny,
  Appearance -> "Labeled"},
 ControlPlacement -> Left,
 TrackedSymbols -> True]



Bob Hanlon




On Wed, Jan 8, 2014 at 3:42 AM, Jenhow <jenh0w at hotmail.com> wrote:

> How do I add a plot that would be manipulated by the variables in the
> following code?
>
>
> Manipulate[
>  TT = (initialvelocity + Sqrt[initialvelocity^2 + 2 gravity height])/
>    gravity;
>  Potential =
>   gravity*(-.5 gravity time^2 + initialvelocity time + height)*mass;
>  Kinetic = (.5 mass (((-gravity)*time) + initialvelocity)^2);
>  If[time > TT, time = TT];
>
>  Graphics
>   [{
>    Blue, Line[
>     Table[{tt, -.5 gravity tt^2 + initialvelocity tt + height}, {tt,
>       0, TT, .01}]],
>    RGBColor[.49, 0, 0],
>    Disk[{time, -.5 gravity time^2 + initialvelocity time + height},
>     5 mass], RGBColor[.25, .43, .82],
>    }],
>
>  {{time, .0, "Time"}, 0.000,
>   Round[Dynamic[ (initialvelocity + Sqrt[
>        initialvelocity^2 + 2 gravity height])/gravity ], 10.^-3], .01,
>    Appearance -> "Labeled", ControlPlacement -> Top},
>  {{mass, .07, "Mass"}, .001, .1, .001, ImageSize -> Tiny,
>   Appearance -> "Labeled"},
>  {{gravity, 9.8, "Gravity"}, 1, 20, .01, ImageSize -> Tiny,
>   Appearance -> "Labeled"},
>  {{initialvelocity, 5., "Initial Velocity"}, 0, 5, .01,
>   ImageSize -> Tiny, Appearance -> "Labeled"},
>  {{height, 5., "Height"}, 0, 10, .01, ImageSize -> Tiny,
>   Appearance -> "Labeled"},
>  ControlPlacement -> Left, TrackedSymbols -> True]
>
>


  • Prev by Date: Elasticity functions for Bezier and rectangular forms
  • Next by Date: Re: Intersect Point of a 3D Parametric Line & B-Spline Surface
  • Previous by thread: Re: Plot in manipulate
  • Next by thread: Re: Plot in manipulate