calculating with variables - need help.

Jul 22, 2013

I have watch both Jeanette Brookes screeners on how to use variables in order to do simple calculations in Storyline. I have tried to implement what she said to the following physics equation - with little success

v2 = (m1*u1 + m2*u2 - m1*v1) / m2

My learners are prompted to enter values for variables m1, m2, u1, u2 and v1. then hit a button to produce calculated v2 value

Is my understanding correct that I must

(i) alter u1 initial value by multiplying it with m1 value.

(ii)  alter u2 initial value by multiplying it with m2 value.

(iii) alter v1 initial value by multiplying it with m1 value.

(iv) then add altered u1 value to that of altered u2 value.(to create a "new" u1 value)

(v) then subtract altered v1 value from "new" u1 value (to create an even newer u1 value)

(vi) finally, divide "even newer u1 value" by m2 value

(vii) then reset everything to initial values in order to do a second calculation.

If my logic is correct - why am I not getting the correct calculation answers.

Am prepared to upload my momentum_calculator. story file if anyone can help.

Thanx in advance.

Alphonso

4 Replies
Alexandros Anoyatis

Hi Alphonso,

Your process is correct, however the timing in which you calculate these variables matters - I am guessing this is where the problem lies.

In this case, I would create a layer that makes the calculation and also use seperate variables for "new u1" and "even newer u1". This way the initial u1 value will not get overwritten when some other variable changes (and the calculation has to happen again without resetting).

Hope this helps,
Alex

Alphonso Hendricks

Hi Justin and Alexandros

i just solved the problem and wanted to go online to withdraw my question. Then I saw your emails.

Turns out that when multiplying, I had to set the initial value of variable to one. I missed the fact that multiplying by zero always gives a zero answer.

thanx for your immediate response.