maths help

Get help using Construct 3!

» Sun Aug 20, 2017 10:30 am

Hello, i'm stuck with a maths question i hope you can help with.

Say to be 100% (A) needs = 5 of (B), 12 of (C), 2 of (D).

5+12+2 = 19

But (A) currently has say 1(B), 8 (C), 1(D).

so i know it has 1+8+1=10 , which is 10/19*100 = 52.6% of total (A) needs to be whole.

Here is the problem i can't get my head around.

(A) might have more of one or all of (B),(C) or (D) then it needs.

for example 12(B) instead, but it only needs 5(B).

I want to make it so the value can be greater than 100%, but doing 12+8+1 = 21/12*100 = 110% is incorrect as it still does not have enough of (C) or (D) it needs.

B
13
S
4
G
1
Posts: 78
Reputation: 1,112

» Sun Aug 20, 2017 11:07 am

I want to make it so the value can be greater than 100%, but doing 12+8+1 = 21/12*100 = 110% is incorrect as it still does not have enough of (C) or (D) it needs.

How much of (C) and (D) does (A) need to be 'legal' ?

Is it minimum 5 of (B) AND minimum 12 of (C) AND minimum 2 of (D) ?
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

» Sun Aug 20, 2017 12:15 pm

yes thats correct.
B
13
S
4
G
1
Posts: 78
Reputation: 1,112

» Sun Aug 20, 2017 3:40 pm

B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

» Sun Aug 20, 2017 4:36 pm

Thanks for the example, and taking the time to help, but i'm not sure what it does.

I'm really look for the maths formula to give me the correct percentage. I'm probably trying to cram too much into one value. I'll have to try a new approach

Thanks.
B
13
S
4
G
1
Posts: 78
Reputation: 1,112

» Sun Aug 20, 2017 8:58 pm

5+12+2 = 19 .... stands for 100

B = 5 = (100/19) * 5 = 26.31%
C =12 = (100/19) * 12 = 63.15%
D= 2 = (100/19) * 2 = 10.52 %

26.31% + 63.15% + 10.52 % = 100%

But, as soon B is higher then 26.31% it can not add to the total amount no more

So
AMax = 19
MiniB = 5
MiniC = 12
MiniD = 2

B = current value for B
C = current value for C
D = current value for D

MaxB = ( (100/AMax ) * ( min(MiniB, B ))
MaxC = ( (100/AMax ) * ( min(MiniC, C ))
MaxD = ( (100/AMax ) * ( min(MiniD, D ))

So

A = MaxB + MaxC + MaxD

Example
5+12+2 = 19 .... stands for 100
How many % is 12+8+1?

Well
AMax = 19
MiniB = 5
MiniC = 12
MiniD = 2

B = 12
C = 8
D = 1

min(MiniB, B ) = 5
min(MiniC, C ) = 8
min(MiniD, D ) = 1

MaxB = ( (100/19) * ( 5 ))
MaxC = ( (100/19) * ( 8 ))
MaxD = ( (100/19) * ( 1 ))

A = ( (100/19) * ( 5 )) + ( (100/19) * ( 8 )) + ( (100/19) * ( 1 )) = 73.6842105263 %

C = ( (100/19) * ( 12 )) - ( (100/19) * ( 8 )) = 21.0526315789% short
D = ( (100/19) * ( 2 )) - ( (100/19) * ( 1 )) = 5.26315789474% short

73.6842105263% + 21.0526315789% + 5.26315789474% = 100% (with a floating point error)
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

» Mon Aug 21, 2017 3:53 pm

Thanks so much for your help.
B
13
S
4
G
1
Posts: 78
Reputation: 1,112