In this lecture we looked at how to convert a design problem into an algebraic expression and then manipulate it in order to solve for different values.
For your challenge, our designer wants to make our fuel to last for 120 seconds.
To do this, we can adjust the maxFuel and/or burnRate.
You task is to rearrange our equation and solve for maxFuel [m] and burnRate [b].
m = (b * t) + c, or Max fuel = (burn rate multiplied by time) plus current fuel
and
b = (m - c) / t, or Burn rate = (max fuel minus current fuel) / time
So, a burn rate of 1 unit per second and a max fuel of 120 units would yield 120 seconds before the player ran out of fuel. Any scaled version of this would work too.
If the designers insisted that the max fuel be 100 units, then the burn rate would be 5/6 units per second, or ~0.833.
For maxfuel (m)…
c = m - (b * t), subtract m from both sides
c - m = -1 (b * t), do what’s in parenthesis and multiply by the variable to get
c - m = -bt, move the c over to the right of the equals by dividing both sides by c leaving
-m = -bt / c -> final answer
For your first equation, you’ve made a small mistake when moving ‘c’ to the other side.
Rather than dividing both sides by c, you need to subtract instead.
This will leave you with -m = -bt - c. From there, you can multiply both sides by -1 to get m = bt + c.
For the second equation, it’s difficult to separate b straight away, like you’ve tried to do.
Doing so would leave you with (c/b) = (m/b) - t, which actually gets you slightly further away from the answer - Remember that you have to apply the division to everything on both sides.
For this one, it’s actually easier to strip everything else away from the right hand side and leave b alone.
Give this one another try and then check the solution below:
c = m - (b * t)
c - m = -bt <- Subtract m from both sides
(c - m) / -t = b <- Divide both sides by -t
b = (c - m) / -t <- Swap the sides to tidy everything up
Then, once you’ve got your two equations, try plugging in the numbers for our designer to see which numbers we could use for the maxFuel and burnRate.
I hope all of that makes sense but if you have any questions, please let me know.
( c = m - (b * t) ) - m
( c - m = -bt ) - c
( -m = -bt - c ) * -1
m = bt + c
m = 2 * 120 + 0
m = 240 Answer: You need to have 240 max fuel with a burn rate of 2 to be able to fly 120 seconds
c = m - (b * t)
( c = m - bt ) - m
( c - m = -bt ) / -t
b = (-c + m) / t
b = (0+100)/120
b = 10/12
Answer: You need to have a burn rate of around 0.833 with max fuel of 100 to be able to fly 120 seconds.
I hope these are right. Also, I have a question. To show what math action I use to the equation, I put brackets around the whole equation and then write the math action as you can see from my answer. In my opinion that looks a little messy so is there any clearer way to show it?
Rather than using parentheses to show the step you’re working on, you could just add a small comment to the side of each line.
Using the strikethrough to show variables being eliminated from one side is also an option. However, this doesn’t work with code formatting and tends to be a little harder to read.
Once you get used to reading calculation, you could even decide to just omit the details and assume the person reading will be able to follow along. You run the risk of obscuring any mistakes you may have made but it’s the easiest of the three to write.
To demonstrate these three approaches, here’s the first equation using each style.
Verbose comments:
c = m - (b * t)
c - m = -(b * t) <- Subtract 'm' from both sides
c - m = -bt <- Expand the right side
-m = -bt - c <- Add 'c' to both sides
m = bt + c <- Multiply both sides by -1
Strikethrough:
c = m - (b * t)
c - m = m - (b * t)
c - m = -(b * t)
c - m = -bt c - m = -bt - c
-m = -bt - c
-1 * (-m) = -1 * (-bt - c)
m = bt + c
Omitting Steps:
c = m - (b * t)
c - m = -bt
-m = -bt - c
m = bt + c
At the end of the day though, write in whichever style you think is the easiest to read (including options not mentioned here).
I tend to go with a blend of options 1 and 3 to keep things simple but adding verbose comments where things may seem a little unintuitive (like applying obscure math rules/tricks).