programming
- To: mathgroup at smc.vnet.net
- Subject: [mg22446] programming
- From: JikaiRF at aol.com
- Date: Wed, 8 Mar 2000 02:21:46 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I have trouble about programming Mathematica. My project is as follows: Firstly, consider that the following numbers are given; a baaaad c Y Secondly, I define the following: (1) Z= Y-(a+b+c). (2) A=(Z*a)/(a+b+c), B=(Z*b)/(a+b+c), C=(Z*c)/(a+b+c). Here, (2) has to satisfy the next conditions: (3) A+B+C<Z (or=Z). I fou Because (2) is a fractional number, I have to define how to round it off. Firstly, (2) should be rounded up from the third decimal point if they are larger than five digits and rounded off if smaller than four. However, in this situation, if (2) doesn't satisfy (3), the third decimal point is rounded off if smaller than five, while rounded up if larger than six. Thereafter, the same procedures are repeated until (2) satisfies (3). In the above case, let us give concrete numbers as follows: a=27.54, b=27.54, c=27.54, a Y=88.67. I can obtain A=B=C=2.01, after rounding off the third decimal point, which is smaller than six. I'd like to know how to program Mathematica to depict this. I hope to receive an answer from you soon. Sincerely, Fujio Takata P.S. My e-mail address is JikaiRF at aol.com.