In this post, you'll learn how initial velocities affect
the trajectories of projectiles. This post contains interactive elements and
is best experienced with a web browser at the original
post .

Let's pull out our virtual slingshots for a moment and see just how far
we can fling a pebble. A slingshot gives the pebble an initial velocity and
the pebble is in freefall thereafter. Play with the velocity and see how the
trajectory changes.

y' = `m / s`
x' = `m / s`
kinetic energy ~ Joules
What is happening here?
The shape of the trajectory stays the same no matter how hard it is
thrown. By increasing x' the shape stretches out, and by increasing y' the
shape shifts up. Still it looks more-or-less the same.

This shape is called a parabola, and it is generated by a quadratic
equation. In fact, it is generated by this quadratic equation `t = 1/{x'} *
x; y = g/2 * t^2 + y' * t,` where `t` is time and `g` is the constant
acceleration due to gravity. Translated into ASCIIsvg JavaScript, it looks
like this:

```
g = -9.81;
plot(function (x) {
t = (1/b) * x;
return g/2*t*t+a*t
}, "cubic")
```

Where did that come from?
The quadratic solution follows directly from the assumption of constant acceleration.

`y'' = g`
From this we can integrate with respect to the time to find the vertical velocity.
`y' = int g dt.`
`y' = g t + C` where `C` is the initial velocity, since `y'(0) = C`.

Once we know the velocity across time, we can solve for the position. `y
= int g t + y'(0) dt.` `y = g/2 t^2 + y'(0) t + C` where `C` here is the
initial position, which we assume to be 0.

What about `x`? Gravity does not affect the `x` portion of the velocity,
since it only accelerates downward. Therefore, `x'` is constant.
Integrating, `x = int x' dt = x' t + C.` Since we can assume the slingshot
shoots from the origin, `C` here is 0.

Note that `x` has been solved to be just a constant factor of the time
`t.` Therefore, it makes sense to solve for the time first in the plots and
then solve for the height.

```
g = -9.81;
plot(function (x) {
t = (1/b) * x;
return g/2*t*t+a*t
}, "cubic")
```

Where does the pebble hit the ground?
The pebble hits the ground when `y = 0.` In the previous sections we have
already derived an equation of `y` with respect to time `t`. `y(t) = g/2 t^2
+ y'(0) t.`

The first thing to do is to figure out when the pebble will hit
the ground. Since `t` factors out, we needn't even pull out the quadratic
equation. `y(0) = t (g/2 t + y'(0))` Thus. `t = 0` or `t = { -y'(0) 2/g } = {
y'(0) 2/9.81 }` if `g = -9.81.`

Once we have when it hits, it is easy to find where it hits. Since the
x-velocity remains constant, `x = x' t.` Just multiply the x-velocity by the
time to find where!

This post was created as part of project 4 for
Texas
A&M Math 696.
This project is based on the the ASCIIsvg
example file .