reporting solution
- To: mathgroup at smc.vnet.net
- Subject: [mg24608] reporting solution
- From: JikaiRF at aol.com
- Date: Fri, 28 Jul 2000 17:23:44 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear members of MathGroup: I have been successful in solving the problem which I previously inquired about to you several times, so first of all I will report my solution. My problem is as follows: Consider three numbers with the second decimals yi(i=1, 2, 3) and a certain number with the second decimal X as given. Then, the following is defined; Z= X-Y where Y means the total of the three numbers, that is, Y=y1+y2+y3. Furthermore, I define the following: (1) zi= yi + (X-Y) yi /Y (i=1, 2, 3). Because zi is a result of division, I have to answer the question about how zi should be rounded. In addition, the total of zi , that is, z1+z2+z3 =A has to be submitted to the following condition: (2) A < X (A has to be less than X). At this stage, I define the following rule: Firstly, zi should be rounded to the second decimal. Under this condition, if (2) is not satisfied, zi should be rounded off at the second decimal point if the digit of the third decimal is less than five (five is included). If it is more than six (six is included), zi should be rounded up at the second decimal point. Under this condition, if (2)is not satisfied, a similar procedure should be tried. My aim is to obtain zi which satisfies (2). I program the above procedure with Mathematica as follows: (3) zi = yi + N[ Floor[ (Z yi/Y + (9 - m) 0.001) 100 ]/100 ] m = 4,5, 6,... (4) A < X (criterion) As a specific example, consider the following: y1=27.54; y2=27.54; y3=27.54. X=88.67. In the above situation, I obtain the following: Y=82.62. Z= 6.05 When I enter m=4 in (3), I obtain the following: zi =29.56, (for i = 1, 2, 3 ) A = 88.68. Because the above result does not satisfy (4), then I enter m=5. The answer returned is not satisfactory with (4), as follows: zi =29.56, (for i = 1, 2, 3 ) A = 88.68. Next, I enter m=6 in (3), I obtain the answer required, which satisfies (4). zi =29.55, (for i = 1, 2, 3 ) A = 88.65. In order to work out this program, I have had helpful suggestions from several members of MathGroup, especially David Park, Murray Eisenberg and Ted Ersek. For that, I thank you. By the way, in my program, I subsequently enter the number m from 4 through 6 until the condition (4) is satisfied. I hope that instead of entering m by hand, I can establish a program to automatically calculate the above process. I guess that a "Which" function might be useful for that, but I do not know an exact program. I would certainly welcome any suggestions about this. Sincerely, Fujio Takata P.S. My e-mail address is: JikaiRF at aol.com