Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16550
| From | Jenhow Tan <jenh0w@hotmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Plot Label and Angle |
| Date | 2014-02-11 07:24 +0000 |
| Message-ID | <ldcj7j$q3u$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
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]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar
Plot Label and Angle Jenhow Tan <jenh0w@hotmail.com> - 2014-02-11 07:24 +0000
csiph-web