The FastDay Forum

Suggestion Box

23 posts Page 2 of 2
fat mass = -98.42 + (4.15 * waist) - (0.082 * weight)
fat mass = -98.42 + (4.15 * (waist - 0.082)) * weight
fat mass = -98.42 + (4.15 * (waist - (0.082 * weight)))


your random application of surplus brackets broke the last two unfortunately. They are wrong. Only the first is correct.
Sorry Phil, blame it on my need for things to be tidy & organised. I always add my brackets for clarity, was taught it was good practice!

Forgive my blondeness, but if division and multiplication are performed first well fair enough that handles the ungrouped stuff within the brackets... but still, what comes first, multiplying the bracketed stuff by 100 or dividing it by weight? I suppose the 100* bit because it comes first. I guess I just don't like assumptions and maybe my maths teacher at school was more interested in getting us all to sit on his lap (yes, really - now I think back to it that probably was a bit wrong) than teaching us the proper use of brackets when we learned 'balancing' (that was our book on equations :))
but still, what comes first, multiplying the bracketed stuff by 100 or dividing it by weight?


it simply doesn't matter. The answer is the same. I'm not even sure the concept of "first" is valid - do you know what the compiler or interpreter does when it generates the CPU instructions.

Sorry you were taught so badly. If that's common it does explain why online calculators are often wrong.
PhilT wrote:
fat mass = -98.42 + (4.15 * waist) - (0.082 * weight)
fat mass = -98.42 + (4.15 * (waist - 0.082)) * weight
fat mass = -98.42 + (4.15 * (waist - (0.082 * weight)))


your random application of surplus brackets broke the last two unfortunately. They are wrong. Only the first is correct.



I was taught you group into brackets the parts you want done first, with the innermost brackets calculated first and working outwards.
Without the brackets specified, they could be positioned anywhere as far as I'm concerned, hence giving examples of it with brackets in different possible positions.

Yes, in this quick example I actually missed a pair of brackets out on the second one, for my purposes it could be:
fat mass = -98.42 + ((4.15 * (waist - 0.082)) * weight)
or
fat mass = (-98.42 + ((4.15 * (waist - 0.082))) * weight


So let's assume a weight of say 65 and a waist of 80.

fat mass = -98.42 + (332) - (5.33)
result: 228.25

fat mass = -98.42 + ((4.15 * (79.918)) * 65)
result: 21459.4605

fat mass = (-98.42 + (4.15 * (79.918))) * 65
result: 15160.5805


fat mass = -98.42 + (4.15 * (80 - (5.33)))
result: 211.4605


Which is why to me the brackets make all the difference. I was never taught anything about multiplying and dividing first. Everything gets bracketed to determine the order, that's how I was taught. Apparently that's wrong, so thank you for teaching me something new today. It will certainly be helpful next time I'm given an equation without all those lovely brackets!

(and no, I don't know the gubbins of interpreters and CPUs or how they handle things)
Oh man, I feel for you. You basically haven't been taught how to do maths !

You didn't miss anything in the example I quoted back at you, you've gone on to add further surplus brackets that have no impact on the outcome :

fat mass = -98.42 + (4.15 * (waist - 0.082)) * weight
fat mass = -98.42 + ((4.15 * (waist - 0.082)) * weight)

these two are identical in outcome, erasing the trailing bracket on the second equation and its mate has no effect.

By spraying the brackets around you broke the maths, as demonstrated by your worked examples. Brackets override the natural preference of operators - at least they taught you that - so throwing them around blindly is potentially fatal (literally in my line of work - "oh dear, the vessel exploded 'cos the maths was wrong").

Thanks Phil, that's really helpful. If only I had known about the natural preference of operators all this time! I've always thought equations without brackets were wrong as they don't show what order anything has to be done in - hence demonstrating how many different ways I could read the equation you posted, due to lack of brackets (and lack of knowing the natural order!).

Lesson learned, I stand corrected and hopefully better armed for future maths! :)
I think some groups of programmers wanted self-documenting math code and either didn't trust the computer to know the order of preference or didn't trust most people to know it, so the surplus brackets were added as reminders. Similar things happen with spaces between operators and lining up digits. Perhaps ironically, it serves to let people forget or never learn the order and makes the problem worse over time! :-P
Glad it wasn't just me then :)
23 posts Page 2 of 2
Similar Topics

Who is online

Users browsing this forum: No registered users and 1 guest

START THE 5:2 DIET WITH HELP FROM FASTDAY

Be healthier. Lose weight. Eat the foods you love, most of the time.

Learn about the 5:2 diet

LEARN ABOUT FASTING
We've got loads of info about intermittent fasting, written in a way which is easy to understand. Whether you're wondering about side effects or why the scales aren't budging, we've got all you need to know.

Your intermittent fasting questions answered ASK QUESTIONS & GET SUPPORT
Come along to the FastDay Forum, we're a friendly bunch and happy to answer your fasting questions and offer support. Why not join in one of our regular challenges to help you towards your goal weight?

Use our free 5:2 diet tracker FREE 5:2 DIET PROGRESS TRACKER & BLOG
Tracking your diet progress is great for staying motivated. Chart your measurements and keep tabs on your daily calorie needs. You can even create a free blog to journal your 5:2 experience!

cron