![]() |
X-Y==Min
[B]Good Time to All, Amici.[/B]
i got following math problem: to split up number array into pairs of arrays where X[t] & Y[t] are multiplications of numbers of gotten arrays (in t'th pair) with condition: |X(0)-Y(0)|==MIN(0), |MIN(0)-(X(1)-Y(1))|==MIN(1), ..., |MIN(n-1)-(X(n)-Y(n))|==MIN(n). for example, let's take an array: 2, 5, 7 then: first pair is {2, 5}, {7} ==> X(0)==2*5==10, Y(0)==7, MIN(0)==3; second is {2, 7}, {5} ==> X(0)==14, Y(0)==5, MIN(1)==6; third is .. ------------------------------------------------ [B]Thanks a lot in Advance.[/B] |
[QUOTE=SarK0Y;207693][B]Good Time to All, Amici.[/B]
i got following math problem: to split up number array into pairs of arrays where X[t] & Y[t] are multiplications of numbers of gotten arrays (in t'th pair) with condition: |X(0)-Y(0)|==MIN(0), |MIN(0)-(X(1)-Y(1))|==MIN(1), ..., |MIN(n-1)-(X(n)-Y(n))|==MIN(n). for example, let's take an array: 2, 5, 7 then: first pair is {2, 5}, {7} ==> X(0)==2*5==10, Y(0)==7, MIN(0)==3; second is {2, 7}, {5} ==> X(0)==14, Y(0)==5, MIN(1)==6; third is .. ------------------------------------------------ [B]Thanks a lot in Advance.[/B][/QUOTE] Sorry, you haven't described what you mean by "t'th pair" yet. Without a more complete description of the problem there's not much we can do to help. Your example doesn't match the description either, you seem to say X[t] and Y[t] are multiplications of pairs but your example the Y is not any multiplication of any pair. You should call the MIN function something else. MIN is conventionally the MINIMUM function and will cause confusion. Is this a school math problem? It should be in the homework help section. Not the main math section. |
[B]lfm[/B]
[QUOTE]you seem to say X[t] and Y[t] are multiplications of pairs but your example the Y is not any multiplication of any pair.[/QUOTE] thanks for reply. "t" is index of array's pair, not number's pair, array with one item gives number itself. for example, another original array & possible array's pairs: {3, 11, 23, 31, 37} then possible array's pairs: {3, 11, 31}, {23, 37};... ; {3}, {11, 23, 31, 37}. [QUOTE]Is this a school math problem?[/QUOTE] no |
[quote=SarK0Y;207735]for example, another original array & possible array's pairs: {3, 11, 23, 31, 37} then possible array's pairs: {3, 11, 31}, {23, 37};... ; {3}, {11, 23, 31, 37}.[/quote]From this example, it seems to me that you may be talking about [I]set partitions[/I] ( [URL]http://mathworld.wolfram.com/SetPartition.html[/URL] ).
I'm not sure how to translate all your other notations into terms I'm familiar with, but let me ask about some possibilities: Start with same "original array" as in your example: {3, 11, 23, 31, 37} Is that intended to be a [I]well ordered set[/I] ( as in [URL="http://mathworld.wolfram.com/WellOrderedSet.html%29?"]http://mathworld.wolfram.com/WellOrderedSet.html[/URL] ) ? One partition of that set is: {3, 11, 31}, {23, 37}. Another partition of that set is: {3}, {11, 23, 31, 37}. From the [I]Mathworld[/I] entry for [I]Bell number[/I] ( [URL="http://mathworld.wolfram.com/BellNumber.html%29:"]http://mathworld.wolfram.com/BellNumber.html[/URL] ): "The number of ways a [URL="http://mathworld.wolfram.com/Set.html"]set[/URL] of n elements can be [URL="http://mathworld.wolfram.com/SetPartition.html"]partitioned[/URL] into nonempty [URL="http://mathworld.wolfram.com/Subset.html"]subsets[/URL] is called a Bell number and is denoted B[sub]n[/sub] (not to be confused with the [URL="http://mathworld.wolfram.com/BernoulliNumber.html"]Bernoulli number[/URL], which is also commonly denoted B[sub]n[/sub]). The number of partitions of a 5-element set such as {3, 11, 23, 31, 37} is 52, so there are 50 partitions besides the two you give as examples, {3, 11, 31},{23, 37} and {3},{11, 23, 31, 37}. (... except that your term "pair" may mean you're considering [U]only[/U] the partitions that have exactly two subsets of the original set. See below.) Does all this make sense? Am I correctly interpreting what you mean, SarK0Y? [quote]|X(0)-Y(0)|==MIN(0), |MIN(0)-(X(1)-Y(1))|==MIN(1), ..., |MIN(n-1)-(X(n)-Y(n))|==MIN(n). for example, let's take an array: 2, 5, 7 then: first pair is {2, 5}, {7} ==> X(0)==2*5==10, Y(0)==7, MIN(0)==3; second is {2, 7}, {5} ==> X(0)==14, Y(0)==5, MIN(1)==6; third is ..[/quote]_If_ my interpretation so far is correct, then for your 5-element example {3, 11, 23, 31, 37}, we have: Suppose partition 0 is {{3, 11, 31}, {23, 37}}. Then X(0) = 3*11*31 = 1023 and Y(0) = 23*37 = 851 and, using "M(n)" instead of "MIN(n)" to avoid confusion with the minimum function, |X(0)-Y(0)|==M(0), so M(0) = |1023-851| = 172. Okay so far? In your 3-element example {2, 5, 7}, partition 0 ("first pair") is {{2, 5}, {7}} and partition 1 ("second pair") is {{2, 7}, {5}}. Is the "third pair" (partition 2) = ({5, 7}, {2}} ? Do you have any use for the partition {{2}, {7}, {5}}, or does your term "pair" mean you're considering [U]only[/U] the partitions that have exactly two subsets of the original set? How are you ordering the partitions? What determines which partition is "first pair" = partition 0? |
[CODE]N=2*5*7;
s=0;fordiv(N,x,if(x*x>=N,d=x-N/x;print(N/x, ",", x, " -> ", d, ":", d-s);s=d)) result: 7,10 -> 3:3 5,14 -> 9:6 2,35 -> 33:24 1,70 -> 69:36[/CODE] |
Thanks for reply, [B]Amici[/B].
[B]cheesehead[/B] Bell numbers is more common task. [QUOTE]|X(0)-Y(0)|==M(0), so M(0) = |1023-851| = 172... Is the "third pair" (partition 2) = ({5, 7}, {2}}[/QUOTE] perfectly correct. [QUOTE]Do you have any use for the partition {{2}, {7}, {5}}, or does your term "pair" mean you're considering only the partitions that have exactly two subsets of the original set?[/QUOTE] you're right, original Set(array) must be splited up into two subsets on the each iteration. [QUOTE]How are you ordering the partitions? What determines which partition is "first pair" = partition 0?[/QUOTE] |X(0)-Y(0)|==M(0), |M(0)-(X(1)-Y(1))|==M(1),... , |M(n-1)-(X(n)-Y(n))|==M(n). M(t) is min value for current iteration. |
i got M(0) with following algo:
//(given: set I with n integers) sort(I); //I(0)<I(1)..<I(n-1) int x=n-1, y=n-2; for(int i=n-3; i>-1; i--) { if(x>y)y*=I(i); else x*=I(i); } ------- suggestions about other iterations shall be very appreciated:-) |
small correction: int x=M(n-1), y=M(n-2);
|
| All times are UTC. The time now is 23:31. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.