| Author |
Comment/Response |
Wei Zhao
|
02/23/13 10:18am
I want to use Maximize function to compute something . Because there are lots of variables and constraints, I can't list them in the Maximize function like the bellow:
Maximize[x[1]+x[2]....,
x[1]+x[2]+x[3]+...+x[n]<100,
x[1]+2x[2]+3x[3]-...+nx[n]<100n,
..............
{x[1],x[2],x[3],.....x[n]}].
So I want to use For loop to describe variables and constraints in the function above. I thought it should be like:
sum=0;
Maximize[Sum[x,{1,n}]
For[i=1,i<=n,i++,
Sum[x,{1,n}]<100,
],
For[i=1,i<=n,i++,
.........
]
..............
{For[ i=1,i<=n,i++
x[i]
]
}.
However, this code didn't work.Could you help me?
Thank you for your kindness.
URL: , |
|