Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Calculus sorted by active[GIF] Toss (Projectile envelope)
http://community.wolfram.com/groups/-/m/t/1077609
![Projectile envelope][1]
**Toss**
Inspired by [Example 5 from the Wikipedia article on "Envelope (mathematics)"][2]. Basically: if you throw a projectile from the origin with initial speed $v$ and initial angle $\theta$ subject to gravitational acceleration $g$, then its trajectory as a function of $t$ is given by:
Trajectory[t_, v_, g_, θ_] := {t v Cos[θ], t v Sin[θ] - g/2 t^2};
All such trajectories are tangent to the parabola $y=\frac{v^2}{2g}-\frac{g}{2v}x^2$, so the parabola is the envelope of the family of trajectories.
The animation shows a number of trajectories simultaneously, and the resulting envelope emerges without ever being explicitly drawn.
Note that the animation is _not_ to scale: I've used `AspectRatio -> 1` to scale the vertical axis to get proportions that work better for a square image. A more physically realistic animation is:
![More realistic projectile envelope][3]
The code is below, but I want to point out a couple of quirks. I originally used `ParametricPlot` rather than `Graphics`, which is conceptually simpler, but there seems to be a bug in the interaction of `CapForm` and `ParametricPlot` which makes it basically impossible to get endcaps to look right.
Consequently, I re-implemented the trajectories as a table of `Line`s, which mostly works okay, except that you can't really use transparency with concatenated lines unless you use `CapForm["Butt"]` or `CapForm[None]`: for example, with `CapForm["Round"]` the lines overlap, creating spots of increased opacity. This can make for a cool visual effect, but doesn't lend itself to a nice smooth gradient. Unfortunately, using `CapForm["Butt"]` leaves tiny gaps between the adjacent line segments, which I obscured by exporting the original GIF at 2160x2160 and then resizing down to 540x540.
Anyway, hopefully that explains most of the oddities in the code, which is not exactly speedy:
DynamicModule[{v = 1., g = 10., n = 101, timesteps = 75, transparencypoint = 3/2, pts,
cols = RGBColor /@ {"#393C83", "#C84771", "#FFE98A", "#280B45"}},
pts = Join[
Table[Trajectory[t, v, g, θ], {θ, 0., π/2, π/n}, {t, 0., 2 v/g, 2 v/(timesteps*g)}],
Table[Trajectory[t, v, g, θ], {θ, π + 0., π/2, -π/n}, {t, 0., 2 v/g, 2 v/(timesteps*g)}]];
Manipulate[
Graphics[
{Thickness[.004],
Table[{
If[i == s, CapForm["Round"], CapForm["Butt"]],
Opacity[Min[1, transparencypoint + 2 (i - s)/timesteps]],
Blend[cols[[;; -2]], (i - 1)/(Length[pts[[1]]] - 1)],
Line[pts[[j, i ;; i + 1]]]},
{j, 1, Length[pts]}, {i, 1, Min[s, timesteps]}]},
ImageSize -> 540, PlotRange -> {6/5 {-v^2/g, v^2/g}, {0, 5/4 v^2/(2 g)}},
AspectRatio -> 1, Axes -> False, Background -> cols[[-1]]],
{s, 0, timesteps (1 + transparencypoint/2), 1}]
]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=toss12Lsru.gif&userId=610054
[2]: https://en.wikipedia.org/wiki/Envelope_(mathematics)#Example_5
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=toss12LsRealisticr.gif&userId=610054Clayton Shonkwiler2017-04-29T22:24:48ZHow to simplify (use variables) and plot this summation?
http://community.wolfram.com/groups/-/m/t/1076864
I'd like to simplify this equation by using variables. For some reason I can't get the right order and way to define them:
sum Part[IntegerDigits [b, 10], i+1] * (10^i+10^(Length[IntegerDigits [b, 10]]-1-i)), i = 0 to Length[IntegerDigits [b, 10]]-1
I have tried this:
a=IntegerDigits [b, 10], k=Length[a]-1, sum Part[a, i+1] * (10^i+10^(k-i)), i = 0 to k
but without success.
Then for some reason equation doesn't give right solution with free b variable. WolframAlpha claims it is: 11 (b + 10)
But with set variable b=153 calculation is correct: 504:
[https://www.wolframalpha.com/input/?i=b%3D153,+sum+Part%5BIntegerDigits+%5Bb,+10%5D,+i%2B1%5D+*+(10%5Ei%2B10%5E(Length%5BIntegerDigits+%5Bb,+10%5D%5D-1-i)),%C2%A0+i+%3D+0+to+Length%5BIntegerDigits+%5Bb,+10%5D%5D-1][1]
Thanks for any help provided,
-Marko
[1]: https://www.wolframalpha.com/input/?i=b=153,%20sum%20Part%5BIntegerDigits%20%5Bb,%2010%5D,%20i%2b1%5D%20*%20%2810%5Ei%2b10%5E%28Length%5BIntegerDigits%20%5Bb,%2010%5D%5D-1-i%29%29,%C2%A0%20i%20=%200%20to%20Length%5BIntegerDigits%20%5Bb,%2010%5D%5D-1Marko Manninen2017-04-28T18:56:07ZHow do I plot a solid bounded below by g(x,y) and above by h(x,y)?
http://community.wolfram.com/groups/-/m/t/1074028
Hi!
I'm not sure if this is the right place to ask this type of question, but how would I graph a solid bounded below by
g[x_, y_] = 9 - x^2 - 4 y^2
and above by
h[x_, y_] = 25 - 4 x^2 - 16 y^2
where the boundaries are given to be (|x| < 3 , |y| < 3 , 0 < z < 30)?
I'm required to use *RegionFunction[]* to limit the bounds by their intersection but when I did so, I got an odd looking graph.
Here's the relevant part of the code as well as the resulting graph.
g[x_, y_] = 9 - x^2 - 4 y^2;
h[x_, y_] = 25 - 4 x^2 - 16 y^2;
i[x_, y_] = h[x, y] - g[x, y];
p1 = Plot3D[g[x, y], {x, -3, 3}, {y, -3, 3},
PlotRange -> {0, 30},
Mesh -> None,
RegionFunction -> Function[{x, y, z}, g[x, y] < i[x, y] < h[x, y]]];
p2 = Plot3D[h[x, y], {x, -3, 3}, {y, -3, 3},
PlotRange -> {0, 30},
Mesh -> None,
RegionFunction -> Function[{x, y, z}, g[x, y] < i[x, y] < h[x, y]],
PlotStyle -> {Blue, Opacity[0.5]}];
Show[{p1, p2},
PlotLabel -> "Ideal Model for a Small Jet of Ionized Particles",
AxesLabel -> {"x", "y", "z"},
BoxRatios -> {1, 1, 1},
ImageSize -> Large]
![Overlaid Graphs][1]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Capture3.PNG&userId=1074014Phil .2017-04-27T01:36:36ZUse Assumptions and Integrate?
http://community.wolfram.com/groups/-/m/t/1074810
Mathematica 11.1
Can someone explain why in the following "Assumptions" does not work as expected:
Integrate[ Sin[n x]^2, {x, 0, 2 Pi}, Assumptions -> n \[Element] Integers]
This gives:
Pi - Sin[4 n Pi ]/(4 n)
The second part is clearly redundant, but not even "Simplify" or "FullSimplify" will eliminate it.Daniel Huber2017-04-27T09:03:47Z