| Draco18s |
This isn't really a Pathfinder thing, more of a d20 thing, but as I managed to solve this recently I thought I'd share.
As we all know, x2 x2 = x3 and x3 x4 = x6 because xA xB = x(A + B - 1)
In completely unrelated sphere of my world I found I needed this equation to make some stat scaling non-exponential, but I had a problem.
Some of my numbers weren't integers. Not even all of them were greater than 1. Which introduced a complication: x1/2 x1/2 should not equal 0. Largely because x1/2 x1/2 x2 should be non-zero, but if you wrap the parentheses differently (xA xB) xC vs. xA (xB xC) you would get a different result (violating the associative property: the former would be x0 the latter would be x1).
So I had to come to another solution. One that had the properties I was looking for (sublinear scaling) and no zero or negative results from positive non-zero inputs.
Thus I have generalized the d20 multiplication is addition system:
Assume X and Y are positive real numbers and that X is >= Y (if Y > X, the Commutative Property applies).
If(X >= 1 && Y >= 1):
= X + Y - 1
If(X >= 1 && Y < 1):
= (XY - 1) / (2Y - 1)
If(X < 1 && Y < 1):
= 1 / (X + Y - 1)
This can actually be simplified if we generalize our inputs as x/X and y/Y.
x/X * y/Y => (xY + Xy - 1)/(2XY - 1)
However, it is important to maintain that one of x and X is equal to 1 and the same holds for y and Y. If we do not, then values that are closer and closer to 1 have smaller and smaller final values!
For example:
9/10 * 4 vs. 99/100 * 4:
9/10 * 4/1 = (9*1 + 4*10 - 1) / (2*10*1 - 1) = 48 / 19 ~= 2.526
99/100 * 4/1 = (99*1 + 4*100 - 1) / (2*100*1 - 1) = 498/199 = 2.502
Hold on a moment: 0.99*X less than 0.9*X?
As soon as you express these fractions as being 1/X instead (i.e. 1/1.1111 and 1/1.0101) the resulting values are:
x0.9 x4: 3.6363...
x0.99 x4: 3.960960...
Thus giving the desired result.
| Distant Scholar |
Thus giving the desired result.
What's the desired result? Why is this the desired result? What are you trying to model here?
If I'm understanding your notation and limitations (all numbers are either 1/X or x/1, with x and X positive rational numbers never less than 1), and using @ for your operator, and * for real-number multiplication:
-----------------------------
(3/1 @ 1/4) @ 2/1 = (12+1-1)/(2*1*4-1) @ 2/1 = 12/7 @ 2/1 = (12/7)/1 @ 2/1 = (12/7 + 2 - 1)/(2*1*1-1) = 19/7
3/1 @ (1/4 @ 2/1) = 3/1 @ (1+8-1)/(2*1*4-1) = 3/1 @ 8/7 = 3/1 @ (8/7)/1 = (3 + 8/7 - 1)/(2*1*1-1) = 22/7
-----------------------------
Your @ operator isn't associative. Which is fine, if that's what you're going for.
| Draco18s |
Draco18s wrote:Thus giving the desired result.What's the desired result? Why is this the desired result? What are you trying to model here?
Sorry, it was late.
I was trying to model something that would work for fractions such that smaller fractions had smaller results, but that would never reduce to 0.You are correct that it's not associative, though.