[Date Index]
[Thread Index]
[Author Index]
Making a LOOP (DO)
*To*: mathgroup at smc.vnet.net
*Subject*: [mg102256] Making a LOOP (DO)
*From*: Youness Eaidgah <y.eaidgah at gmail.com>
*Date*: Mon, 3 Aug 2009 05:45:28 -0400 (EDT)
Dear All,
Based on the following table, I want to calculate the =93Total Expected Profit
(TEP)=94. The retailer profit (REP) is a function of OR, D1, and p (which are
known and described at the table) as well as R and P which are unknown.
For calculating each cell of the table, I have the following formulas (the
values of highlighted variables come from table. The values of variables
highlighted in orange are unknown):
REP=(100*DE*(1-R)+SI*20-P*OR)
Where,
DE=If[D1*<=*OR,D1,OR];
SI=If[OR>=D1,OR-D1,0]
*12000*
*(OR)*
*14000*
*(OR)*
1st scenario
*D1*
8000
A=REP*p
D=REP*p
*p*
0.11
2nd scenario
*D1*
10000
B=REP*p
E=REP*p
*p*
0.11
3rd scenario
*D1*
12000
C=REP*p
F=REP*p
*p*
0.28
Total Expected Profit (TEP)
A+B+C
D+E+F
Therefore, to calculate the total expected profit (TEP), I need a loop that
sum the value at each column. To do so, I made the following loop:
Clear[REP[12000],REP[14000]]
Do[
DE=If[D1<=OR,D1,OR];
SI=If[OR>=D1,OR-D1,0];
REP[OR]=REP[OR]+((100*DE*(1-R)+SI*20-P*12000)*p),
{OR,12000,14000,2000},
{{D1,p},{8000,0.11},{10000,0.11},{12000,0.28}}];
{REP[12000],REP[14000]}
However, the loop does not work as expected. It might be because I
introduced {D1, p} as a couple. But, I need to do that. I would be really
grateful if you could help me out.
Thank you,
Youness
Prev by Date:
**Re: Creating a Random Function to Select an Irrational Number**
Next by Date:
**Re: Help with concatenating a list with &&**
Previous by thread:
**Re: Creating a Random Function to Select an Irrational Number**
Next by thread:
**Re: Making a LOOP (DO)**
| |