Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'For loop in Maximize function' topicStudent Support Forum > General > Archives > "For loop in Maximize function"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'For loop in Maximize function')
Author Date Posted
For loop in Maximize function Wei Zhao 02/23/13 10:18am
Re: For loop in Maximize function Bill Simpson 02/24/13 6:54pm
Next Comment >Help | Reply To Topic