Author 
Comment/Response 
Sudarshan Baruah

12/01/05 1:25pm
hi,
I have got a problem to maximize a function which is:
total[m_]:=sqrt(q[m]^2+r[m]^2)
where,
q[m_]:=NIntegrate[t[s]*Sin[m*s],{s,0,2Pi}]
and
r[m_]:=NIntegrate[t[s]*Cos[m*s],{s,0,2Pi}]
Here, integration is over s and it is from 0 to 2 Pi. Values of t[s] are as follows:
t[s]=One, when s is between 0 and 3pi/18
t[s]=Two, when s is between 3pi/18 and 7pi/18
and so on in the interval 0 to Pi of s.
One, Two etc are unknown variables. This is achieved as:
t[s]:=Which[0 ≤ s ≤ 3Pi/18, One, 3Pi/18 ≤ s ≤ 7Pi/18, Two, 7Pi/18 ≤ s ≤ 10Pi/18, Three, 10Pi/18 ≤ s ≤ 18Pi/18, Four, 18Pi/18 ≤ s ≤ 21Pi/18, Five, 21Pi/18 ≤ s ≤ 25Pi/18, Six, 25Pi/18 ≤ s ≤ 28Pi/18, Seven, 28Pi/18 ≤ s ≤ 36Pi/18, Eight]
Now, when trying to maximize, for eaxmple, total[4_] as follows
Maximize[total[4_], {One, Two, Three, Four, Five, Six, Seven, Eight}]
I dont get a result. Could anyone point me the mistake?
Ultimately, I want to find the variables One, Two, Three....., Eight for which the function total[m_] for m=4 is maximum.
URL: , 
