MathGroup Archive 2014

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

Search the Archive

Plot Label and Angle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132336] Plot Label and Angle
  • From: Jenhow Tan <jenh0w at hotmail.com>
  • Date: Tue, 11 Feb 2014 02:59:02 -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

Hi is it possible to add features like, the angle of object being tossed from the height and plotlabels as shown in the demo found in the link? I would like to add it into this following code.

http://demonstrations.wolfram.com/ThrowOffACliff/
http://demonstrations.wolfram.com/sourcecode.html?demoname=ThrowOffACliff&demodisplayname=Throw%20off%20a%20Cliff

Manipulate[
 Module[{TT, Potential, Kinetic, position, KineticPortion},
  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;
  BallPosition[t_] = -.5 gravity t^2 + initialvelocity t + height;
  KineticPortion = Kinetic[time]/(Kinetic[time] + Potential[time]);
  PotentialPortion = Potential[time]/(Kinetic[time] + Potential[time]);
  If[time > TT, time = TT];
  
  Grid[{{Plot[{BallPosition[tt], Potential[tt], Kinetic[tt]}, {tt, 0, 
       TT + .0001}, 
      PlotStyle -> {{Dashed, Thick}, {Thick, Purple}, {Thick, Yellow}},
      Epilog -> {LightGray, AbsoluteDashing[{5, 5}], 
        Line[{{time, 0}, {time, Max[Potential[time], Kinetic[time]]}}],
        Blend[{Purple, Yellow}, KineticPortion], 
        Disk[{time, BallPosition[time]}, 5 mass {13, 23.5}/23.5]},
      
      PlotRange -> {{-.5, 12.5}, {-.5, 23}}, AspectRatio -> .75,
      PlotLegends -> {
        StringForm["Position = ``", 
         NumberForm[BallPosition[time], {4, 2}]],   
        StringForm["Potential = ``", 
         NumberForm[Potential[time], {4, 2}]],
        StringForm["Kinetic = ``", NumberForm[Kinetic[time], {4, 2}]]},
      ImageSize -> 450, AxesLabel -> StandardForm[Height]],
     
     VerticalGauge[100 PotentialPortion, {0, 100},
      GaugeMarkers -> 
       Graphics[{Blend[{Yellow, Purple}, PotentialPortion], Disk[]}],
      GaugeLabels -> "Potential Energy (%)"],
     
     Spacer[30],
     
     VerticalGauge[100 KineticPortion, {0, 100},
      GaugeMarkers -> 
       Graphics[{Blend[{Purple, Yellow}, KineticPortion], Disk[]}],
      GaugeLabels -> "Kinetic Energy (%)"]}}]],
 
 
 {{time, .0, "Time"}, 0., 
  Round[Dynamic[(initialvelocity + 
       Sqrt[initialvelocity^2 + 2 gravity height])/
     gravity], .001], .01,
  Appearance -> "Labeled", ControlPlacement -> Top, 
  ImageSize -> Large},
 
 Grid[{                                                               \
                                                                      \
                                                                      \
                               
   {Control[{{mass, .07, "Mass"}, .001, .1, .001, ImageSize -> Small, 
      Appearance -> "Labeled"}],
    Spacer[30],
    Control[{{gravity, 9.8, "Gravity"}, 1, 20, .01, 
      ImageSize -> Small, Appearance -> "Labeled"}]},
   
   {Control[{{initialvelocity, 5, "Initial Velocity"}, 0, 5, .01, 
      ImageSize -> Small, Appearance -> "Labeled"}],
    Spacer[30],
    Control[{{height, 5., "Height"}, 0, 10, .01, ImageSize -> Small, 
      Appearance -> "Labeled"}]}
   }], TrackedSymbols -> True]



  • Prev by Date: Re: hold question
  • Next by Date: Re: hold question
  • Previous by thread: Re: RowBox disappearing Lines
  • Next by thread: Re: R: Re: Goodstein expansion