# Question:Global Maximum over Defined Range #2

## Question:Global Maximum over Defined Range #2

Hi,

Previously I got some great help from Markiyan Hirnyk who introduced me to the DirectSearch package. I am having a little trouble implementing it for this function:

y := proc (E) options operator, arrow; -_C4*MathieuS(-a, -q, E)*(Int(MathieuC(-a, -q, E)*(-a+2*q*cos(2*E)), E))+_C4*(Int(MathieuS(-a, -q, E)*(-a+2*q*cos(2*E)), E))*MathieuC(-a, -q, E)-_C2*MathieuC(-a, -q, E)-_C3*MathieuS(-a, -q, E)-_C4*MathieuS(-a, -q, E)*MathieuCPrime(-a, -q, E)+_C4*MathieuSPrime(-a, -q, E)*MathieuC(-a, -q, E) end proc

Then using the following procedure:

MAXforY := proc (consta, constb, constc, aa, qq, A, B) if A <= B then DirectSearch:-GlobalSearch(eval(y(E), [_C2 = consta, _C3 = constb, _C4 = constc, a = aa, q = qq]), {E <= B, A <= E}, maximize, solutions = 1) else print(Inconsistent*input) end if end proc

Implementing that:

MAXforY(1, 0, -1000, .013, .689, 0, 3000)

Then Maple is giving me the following Error:

Error, (in evalf/int) invalid arguments

I cannot understand why this is happening as my understanding of the DirectSearch package is null. I'm wondering if it is having a hard time with the integrals?

Thanks for helps

﻿