Re: School project - NEED HELP!
- To: mathgroup at smc.vnet.net
- Subject: [mg132211] Re: School project - NEED HELP!
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sat, 18 Jan 2014 05:00:26 -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: <20140116065504.8AD366A00@smc.vnet.net>
This uses a gauge rather than a bar chart. Note that the color of both the disk and the gauge marker change with the percentage of kinetic energy. 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; position[t_] = -.5 gravity t^2 + initialvelocity t + height; kineticPortion = Kinetic[time]/ (Kinetic[time] + Potential[time]); If[time > TT, time = TT]; Grid[{{ Plot[ {position[tt], Potential[tt], Kinetic[tt]}, {tt, 0, TT + .0001}, Epilog -> {LightGray, AbsoluteDashing[{5, 5}], Line[{ {time, 0}, {time, Max[Potential[time], Kinetic[time]]}}], Blend[{Blue, Red}, kineticPortion], Disk[ {time, position[time]}, 5 mass {13, 23.5}/23.5]}, PlotRange -> {{-.5, 12.5}, {-.5, 23}}, AspectRatio -> 1, PlotLegends -> { StringForm["Position = ``", NumberForm[position[time], {4, 2}]], StringForm["Potential = ``", NumberForm[Potential[time], {4, 2}]], StringForm["Kinetic = ``", NumberForm[Kinetic[time], {4, 2}]]}], VerticalGauge[100 kineticPortion, {0, 100}, GaugeMarkers -> Graphics[{ Blend[{Blue, Red}, kineticPortion], Disk[]}], GaugeLabels -> "Percent Kinetic"]}}, ItemSize -> {{Scaled[.8], Scaled[.2]}}, Spacings -> 0]], {{time, .0, "Time"}, 0., Round[Dynamic[ (initialvelocity + Sqrt[initialvelocity^2 + 2 gravity height])/gravity], .001], .01, Appearance -> "Labeled", ControlPlacement -> Bottom, ImageSize -> Large}, Grid[{{Control[{{mass, .07, "Mass"}, .001, .1, .001, ImageSize -> Tiny, Appearance -> "Labeled"}], Spacer[40], Control[{{gravity, 9.8, "Gravity"}, 1, 20, .01, ImageSize -> Tiny, Appearance -> "Labeled"}]}, {Control[{{initialvelocity, 5, "Initial Velocity"}, 0, 5, .01, ImageSize -> Tiny, Appearance -> "Labeled"}], Spacer[40], Control[{{height, 5., "Height"}, 0, 10, .01, ImageSize -> Tiny, Appearance -> "Labeled"}]}}], TrackedSymbols -> True] Bob Hanlon On Thu, Jan 16, 2014 at 1:55 AM, Jenhow Tan <jenh0w at hotmail.com> wrote: > Is it possible to show the kinetic energy with a bar graph that varies > over time manipulation? I'm getting an error asking for a pair of numbers > of the coordinates, but I would then be unable to see the bar graph > changing proportionally to time. > > I would also like it to solve the kinetic energy below my manipulation > bars. > > Plot[{Potential[tt], > Kinetic[tt], -.5 gravity tt^2 + initialvelocity tt + height}, {tt, > 0, TT + .005}, PlotStyle -> {Thick, Thick, {Dashed, Green}}, > Epilog -> {White, AbsoluteDashing[{5, 5}], > Line[{{time, 0}, {time, Max[Potential[time], Kinetic[time]]}}], > RGBColor[0, .79, .6], > Disk[{time, -.5 gravity time^2 + initialvelocity time + height}, > 5 mass], > > RGBColor[.6, .73, .36], Rectangle[{11, 0}, {12, Kinetic}]}, > > PlotRange -> {{-.5, 12.5}, {-.5, 23}}, AspectRatio -> Automatic, > PlotLegends -> {"Potential", "Kinetic", "Position"}, > ImageSize -> 300, AxesLabel -> StandardForm[Height]], > >
- References:
- School project - NEED HELP!
- From: Jenhow Tan <jenh0w@hotmail.com>
- School project - NEED HELP!