Hi everybody i've to minimize a function of about 5-6 variables so i tried some of maple functions like: 'Minimize', 'minimize', 'NLPSolve' but with 'minimize' my pc goes in loop and it eats a lot of ram without giving some results, while with the Optimization package i got the error :'

Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments

'

code :

restart;

L := 1:

b := 1.1:

p := 1.8:

xa := 0:

xd := -b/2:

ya := -p+z:

yd := 0:

quadrilatero := proc(q,xa,ya,xd,yd,l1,l2,l3,modo,alpha0,alpha1)

local xb,yb,l5,c,alpha,theta5,theta2,xc,yc,theta3,xm,ym:

xb := xa+l1*cos(q + alpha0 + pi/2):

yb := ya+l1*sin(q + alpha0 + pi/2):

l5 := sqrt((xd-xb)^2+(yd-yb)^2):

c := (l2^2+l5^2-l3^2)/(2*l2*l5):

if modo = 1 then alpha := arccos(c) else alpha := -arccos(c) end if:

theta5 := arctan(yd-yb,xd-xb):

theta2 := theta5 + alpha:

xc := xb + l2*cos(theta2 + pi):

yc := yb + l2*sin(theta2 + pi):

theta3 := arctan(yd-yc,xd-xc):

return (theta3 - pi - alpha1):

end proc:

#funione sterzo

f := proc(q,ya,l1,l2,l3,yd,alpha0,alpha1)

local theta;

theta := quadrilatero(q, 0, ya,-b/2,0, l1, l2, l3, -1,alpha0,alpha1) - pi/2;

if theta < Pi and Im(theta) = 0 then theta := theta + 2*pi end if;

return theta;

end proc:

#funzione desiderata

Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));

arctan(tan(q), 1 - 0.3055555556 tan(q))

#Definisco procedura dei minimi quadrati:

n := 1: i := 0:

q := Vector[n]: rms := 0:

for i from 0 by 1 to (n-1) do

q[i] := Pi*(i/(4*n)):

rms := rms + abs(f(q[i],ya,l1,l2,l3,yd,alpha0,alpha1) - yd(q[i])^2):

end do:

rms := sqrt(rms / n):

#MIN := (minimize(rms, z = -0.4..0,alpha0 = 0..Pi/3,alpha1 = Pi/2..5*Pi/4,l1 = 0.3..1,l2 = 0.001..0.3,l3 = 0.01..0.3,iterationlimit = 100));

with(Optimization):

Optimization[NLPSolve](((rms)));

Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments

thanks in advance for your help !