Here is the simplified version of your problem:
{Slider[Dynamic[x], {1, 10}], Dynamic[x]}
Print [2*Dynamic[x]]
The problem you see is that the number "2" and the value of x are not multiplied before being printed. Why does this happen? After all Print[2*3]
produces 6. But you also see that Print[2*Dynamic[3]]
produces "2 3".
Dynamic is somewhat tricky. You should use Manipulate whenever possible. After that, you should use DynamicModule as much as possible. What you want here is:
Print [Dynamic[2*x]]]
Do not put Dynamic around all instances of x. Only put dynamic around what is going to be output that needs to change. Additionally, you will need to use SetDelayed to allow some values to be recomputed. Your code would look like:
{Slider[Dynamic[x], {1, 10}], Dynamic[x]}
v := x*Quantity[1, "Feet"/"Seconds"];
m = Quantity[5.0, "Pounds"];
ff := m*(v^2);
Print ["ff= ", Dynamic[ff]]
This is somewhat complicated to understand. But it can be made easier if you follow the golden rule.
If some value changes because of another value, you should have a function.
Newer programmers over-use Print. You almost always want to return a value, not print it.
Here is how I would probably write your code:
{Slider[Dynamic[x], {1, 10}], Dynamic[x]}
v[x_] := Quantity[x, "Feet"/"Seconds"];
m = Quantity[5.0, "Pounds"];
ff[m_, v_] := m*(v^2);
Dynamic[ff[m, v[x]]]
The real lesson is that you should use Manipulate. It makes all of this much cleaner