top_left top_right
bottom_left
Next Event: Unknown | Forum Rules | QGL Website | Event Registration
openFolder AusForums.com
iconwatfolderLineopenFolder LANs
iconwatfolderLineopenFolder QGL
iconwatfolderLineopenFolder QGL Forum
Author
Topic: maths help
Strik3r
Posts: 1209
Location: Gold Coast, Queensland
hey, i need some maths help.

i need to work out an equation in terms of X and Y. (ie. what manipulation do you perform on x and y to give z that will work for all of the below examples (and more). also some background information: x can be of any positive value, y will be a number between 1 and 12 (inclusive) and Z will always be equal to or less than X.

From the work i did today, the equation will be something similar to Z = X - ( ((y-1)/4) + 1 ). this works for some values of x and y but not all.

Any ideas ? here is the data set.


X Y Z

1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
2 1 2
2 2 2
2 3 2
2 4 2
2 5 2
2 6 2
2 7 2
2 8 1
2 9 1
2 10 1
2 11 1
2 12 1
3 1 3
3 2 3
3 3 3
3 4 3
3 5 3
3 6 3
3 7 3
3 8 2
3 9 2
3 10 2
3 11 2
3 12 1
4 1 4
4 2 4
4 3 4
4 4 4
4 5 4
4 6 4
4 7 4
4 8 3
4 9 3
4 10 3
4 11 3
4 12 2
system
--
Cr@ckerJ@ck
Posts: 750
Location: Brisbane, Queensland
Right............................
Strik3r
Posts: 1210
Location: Gold Coast, Queensland
oh and i should have mentioned, this deals with integers only. So if you for example have y/4 and y is 5, the result is 4, not 4.25

last edited by Strik3r at 20:59:22 12/Jan/06
Tanaka Khan
Posts: 1926
Location: Brisbane, Queensland
Right............................
Strik3r
Posts: 1211
Location: Gold Coast, Queensland
solved: answer = Z = X - Y^2/64
Tanaka Khan
Posts: 1927
Location: Brisbane, Queensland
I knew that,but i wanted you to work it out for yourself.
Habib
Posts: 76
Location: Brisbane, Queensland
err... how does that work Striker? If x=1 and y=8, by your formula

z = x - y*y/64
z = 1 - 8*8/64
z = 1 - 64/64
z = 1 - 1
z = 0

Habib
Posts: 77
Location: Brisbane, Queensland
I'm not sure if you mean any division results in trucation of the fraction part? Or do you mean round?

I assumed truncation for any division operation for simplicity, and devised a formula in Excel that works.

Copy the data into excel, so that the first row of data is in A2,B2,C2 for X,Y,Z respectively. The following formula can be used to calculate Z:

A2 - TRUNC(B2/8) - (TRUNC(B2/12) * TRUNC(A2/3)) + (TRUNC(B2/8) * TRUNC((1-LOG(A2,10))/1))

Or, written normally

z = y - (y/8) * (x/3) + (y/8) * ((1-log(x))/1)

which simplifies to

z = y + (y/8) * (((1-log(x))/1) - (x/3))

Note that I exploited the integer-only way division works by dividing (1 - log(x)) by 1.

I tried using your original formula with both round() and trunc() as a starting point, but it didn't seem to be close? Oh well, if it turns out you meant round(), then it shouldn't be too hard to adjust the formula.
mission
Posts: 2708
Location: Brisbane, Queensland
Nerds.
Boofe
Posts: 1002
Location: Brisbane, Queensland
Nerds.


They just understand it! We DONT.

Thats a simplified answer..
paveway
Posts: 3177
Location: Brisbane, Queensland
striker wanted to show the internets his skills
whoop
Posts: 9719
Location: Brisbane, Queensland
http://users.bigpond.net.au/ritsuko/emoticons/paveway.gifpaveway does not approve
system
--
Not a new post since your last visit.
New Post Since your last visit
Back To Forum
Advertise with Us | Privacy Policy | Contact Us
© Copyright 2001-2026 AusGamers Pty Ltd. ACN 093 772 242.
Hosted by Mammoth Networks - Australian VPS Hosting
Web development by Mammoth Media.