How to find unknowns from the maximum value of a function?

238 Views Asked by At

I have this function representing the vertical velocity of a player jumping in a video game over time $t$.

$$V(t) = V_0 - G\cdot t + j\cdot F\cdot t$$

$V_0 = \,\,?$ is the initial velocity

$G = 50$ is the gravity constant

The longer the player holds the jump button, the higher he should go. It is predetermined that a player holding during the whole jump will have a peak height of $6$ but a player not holding the jump at all will have a peak height of $1$.

$F = \,\,?$ is the floating constant, how much the player floats in the air when he holds jump

$j = 1$ if the player holds the jump button otherwise $j = 0$

To find the height at any time $t$ I need to find the integral of the velocity function:

$$\begin{align} \frac{dy}{dt} = V(t)\Rightarrow & \frac{dy}{dt}=V_0 - G\cdot t + j\cdot F\cdot t\\ & dy=(V_0 - G\cdot t + j\cdot F\cdot t)dt\\ & \int dy=V_0\int dt - G\int t \,dt + j\cdot F\int t\,dt\\ & y = V_0\cdot t - \frac{G\cdot t^2}{2} + \frac{j\cdot F\cdot t^2}{2} + C \end{align}$$

$C = 0$ is the initial vertical position (and can safely be ignored)

I want to find $V_0$ and $F$ such as

if $j = 0$, the maximum of $y$ is $1$ but if $j = 1$, the maximum of y is $6$

My problem is I don't know how to find unknowns in my equations from those maximums. It would be easy if I simply had points since $j= 0$ cancels the $F$ variable leaving only one unknown. But I only have the output value of the function $y(t_{max}) = 1, j = 0$ and $y(t_{max}) = 6, j = 1$.

How can I resolve the equation and get my 2 unknowns?

2

There are 2 best solutions below

1
On BEST ANSWER

You have $y$ as a quadratic function of $t$. For this even have a maxima, you must have coefficient of $t^2$ negative.

  1. If $j = 0$, then $y$ becomes: $$y(t) = V_0\cdot t - \frac{G\cdot t^2}{2}\\ y'(t) =V_o-Gt$$ For a maximum, we have $t_o = \frac{V_o}{G}$. At this $t$, we have a maximum $y(t)$, that is $1$ for this case. Thus we can say: $$y(t_o) = \frac{V_o^2}{2G} = 1$$ Giving us $V_o = \sqrt{2G}$.

Now try similarly for $j=1$ :)

2
On

At max height $V=0$ so time then given by $t_{max}=\frac{V_0}{(G-jF)}$.

Height at this time is then $y_{max}=t_{max}(V_0-\frac{t_{max}(G-jF)}{2})$

Putting in $t_{max}$ gives $y_{max}=\frac{V_0}{(G-jF)}(V_0-\frac{V_0}{2})= \frac{V_0^2}{2(G-jF)}$

Case $j=0$ gives $1=\frac{ V_0^2} {2G}$ which gives you $V_0^2=2G$ and case $j=1$ gives $6=\frac{V_0^2}{2(G-F)}$ Which after a little algebra gives $F=\frac{5}{6}G$.