Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16389

Re: Plot in manipulate

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Plot in manipulate
Date 2014-01-09 06:39 +0000
Message-ID <lalg7r$j8o$1@smc.vnet.net> (permalink)
References <20140108084208.473A06A08@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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]
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Plot in manipulate Bob Hanlon <hanlonr357@gmail.com> - 2014-01-09 06:39 +0000

csiph-web