Jump to content

dNY

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by dNY

  1. Formula for my case, I mean. I don't get how your answer applies to my question, so a formula would show that.
  2. Do you have a formula?
  3. You can't know result1 on the calculation of result2, and vice versa. Each one happens in their own separate environment at runtime, so to say that result2 is equal to result1 in result2's environment, you'd need to know result1 beforehand, thus breaking this invariant.
  4. Perhaps that something that's missing is the clarification that a1 and a2 are the only actual variables (while b and c are the constants)? You can also introduce more variables/constants in your end, if that helps to achieve the invariant of result1 === result2.
  5. Hello! I'm building a rebase algorithm that I need some help with. These are the variables, constants, and constraints (the values themselves are just examples): Set of variables 1: a1 = 1934464428151493937044 b = 54802476401439357 c = 1e18 result1 = ? Set of variables 2: a2 = 1837741206733939183658 b = 54802476401439357 c = 1e18 result2 = ? Final invariant --> result1 == result2 As you can see b and c are constants and the only variables shared between sets, so you can't use a1 during the operations of Set 2 and vice versa (a1 and a2 might fluctuate in value, but not b and c). Also, result1 is not known during the operations for result2, and vice versa. The idea is to have result1 to equal result2. Feel free to add more variables, constants, escalating factors, etc. if you need them in order to achieve the final idea. Thanks!
  6. Hello! If I have, let's say 1000 numbers or 10k numbers, and they all add up to 100 when combined, what would be the most efficient way to verify that in fact the sum of all of them is 100? I was thinking of a Merkle Tree, but I'm not really sure how to apply it in this case. I could just do n + n1 + n2 + n3....+ n10k, but that's not really scalable nor efficient. Thanks beforehand for any help.
  7. Thanks lot for these answers, guys! I completely got your solution @Sensei but I'm going to with @Ghideon's. It's an app in Solidity what I'm building so it makes more sense from a gas-saving perspective, but you introduced me to a concept that I've heard before but never really got into it until now.
  8. Hey guys, I'm building a financial app and I need some help with making a "distribution coefficient/index" (best math name I could give it). The idea behind it is: - There's a total balance. Let's call it "X". - There are users with different shares at stake on "X": A, B, C and D (users). - Each user has a % allocation depending on how much they have at stake on "X". Let's say: - A --> 10 units --> 10% - B --> 20 units --> 20% - C --> 30 units --> 30% - D --> 40 units --> 40% X = 100 ---> 100% I need a coefficient (let's call it "Y") capable of determining the new allocation % of each user once any of them has added more units to "X", and the formula to calculate this coefficient. It would be something like: oldUnits + newUnits - A --> 30 (10 + 20) --> Y --> 25% - B --> 20 --> Y --> 16.66% - C --> 30 --> Y --> 25% - D --> 40 --> Y --> 33.33% The limitations/constraints/requirements are: - The only parameter that I (my app) can freely modify is "Y". - The users are in charge of modifying their own stake of "units". - The % allocation is the result of the interaction of "units" with "Y" and it must return 100% when adding up the % allocation of all users. I don't have any high-level math background (mine it's business), so go easy on me please. Thanks a lot again for your help! Cheers.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.