# Items tagged with minimizeminimize Tagged Items Feed

### Optimization problem...

February 22 2015
2 7

So i got a procedure test, she is kind of numeric, i whant to optimaze test([.5, .5, .5], 1, 3, 100, 100, true, [x, 0, 0, 0, 0])=0 by x. But optinization substitutes x like a symbol, i tryed all methods but they all do the same.

f := proc (x) options operator, arrow; abs(test([.5, .5, .5], 1, 3, 100, 100, true, [x, 0, 0, 0, 0])-.4) end proc; Minimize(f(x));
%;
Error, (in test) cannot determine if this expression is true or false: 0 < -43.0+100*x

Can i some how use optinization on such procedure?

### Not returning answer, only echoing...

February 08 2015
1 1

When I try and evaluate the minimize command the result is just echoed.

If I try Maples example function, they echo such as:

minimize(x^2+y^2-3*x+3*y+3);

minimize(x^2 + y^2 - 3 x + 3 y + 3)

Any suggestions?

Thanks.

### founding the error in program...

July 13 2014
0 2

hi all.

I have wrore the following program for optimization with bernstein and block pulse hybrid functions.

the program have some errors which i can't understand.

Bernestien1.mws

 > restart:
 > alias(C=binomial): with(LinearAlgebra): macro(LA= LinearAlgebra):
 > HybrFunc:=proc(N, M,  tj)               # N=Number of subintervals,  M=Number of functions in subintervals   local B, n, m; global b; for n from 1 to N do for m from 0 to M-1 do B := (i,m,t) -> C(m,i)*(1-t)^(m-i)*t^i: b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and tb[n,m](t)): #convert(%,vector); end proc: HybrFunc(3, 3, 1);                                        # End Of Definition   g2(t):=t;            #*exp(t-1):                      # Any other function can be replaced here      g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3); Optimization[Minimize](sqrt(int((g2(t)-g1(t))^2, t=0.. 1))); assign(op(%[2])); plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);
 Error, (in Optimization:-NLPSolve) complex value encountered Error, invalid left hand side in assignment (1)

I'll be so grateful if any one can help me.

Ph.D Candidate

Applied Mathematics Department

### can not find initial feasible point with DirectSea...

June 28 2014
0 7

in maple 15

there are 3 equation to be minimized

and i limit x between x + 5 and x - 5 as constraints

though f1 got a error in first line of command,

later i type a correct command for f1 in later part of script

### how to minimize this penalty function which has ma...

June 26 2014
0 22

f1 := -2*x1 - x2;
f2 := -x1 - 4*x2;
g1 := 2*x1 + 3*x2 - 6;
g2 := -x1;
g3 := -x2;
penalty := lambda1*Max(f1-M,0)+lambda2*Max(f2-M,0)+(M^2)*(max(g1,0) + max(g2,0) + max(g3,0));
M := 1;
k := 1;
s := 1;
lambda1 := 0.5;
lambda2 := 0.5;
with(Optimization):
Minimize(subs(lambda2=0.5, subs(lambda1=0.5, subs(M=1, penalty))));

correct answer for these parameters should be below, however, Minimize got error

when lambda1 = 0.5, lambda2 = 0.5
(x1, x2) = 1.551123, 0.965918
f(x1, x2) = (–4.068164, –5.414795);

### Optimization [Minimize] and [Maximize] with Pi...

April 20 2014
2 3

what is the wrong with Pi set ::: in this function ::: Warning, no iterations performed as initial point satisfies first-order conditions

Optimization[Minimize](x^2 + y^2 + 25*(sin(x)^2+sin(y)^2), x=-2*Pi .. 2*Pi , y= -2*Pi .. 2*Pi);

Warning, no iterations performed as initial point satisfies first-order conditions
[0., [x = HFloat(0.0), y = HFloat(0.0)]]

Optimization[Maximize](x^2 + y^2 + 25*(sin(x)^2+sin(y)^2), x=-2*Pi .. 2*Pi , y= -2*Pi .. 2*Pi);

Warning, no iterations performed as initial point satisfies first-order conditions
[-0., [x = HFloat(0.0), y = HFloat(0.0)]]

--------------------------------

I got my good result when I apply it with this function :

f:= (x,y)->cos(x)*sin(y) -(x/(y^2+1));

Optimization[Maximize](f(x,y), x = -1 .. 2, y = -1 .. 1);

[0.994945017202501170,[x = HFloat(-0.6362676080636113), y = HFloat(1.0)]]

Optimization[Minimize](f(x,y), x = -1 .. 2, y = -1 .. 1);

[-2.02180678335978703,[x = HFloat(2.0), y = HFloat(0.10578346945175972)]]

### Minimization Process...

April 04 2014
1 12

Hi all

I have the following segment of maple program which belongs to time delay systems dynamic. here C=X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P, is a matrix(vector) which comes from reordering the system terms and my goal is to minimizing J:=X.E.Transpose(X)+U.E.Transpose(U), subject to constraint C=0, but i don't know how to do so.

I will be so grateful if anyone can guide me

best wishes

Ph.D Candidate

Applied Mathematics Department

 > restart: with(Optimization): with(LinearAlgebra): macro(LA= LinearAlgebra): L:=1:  r:=2:  tau:= 1: interface(rtablesize= 2*r+1): Z:= Matrix(      2*r+1, 2*r+1,      [tau,       seq(evalf((L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L)), iz= 2..r+1),       seq(evalf((L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L))), iz= r+2..2*r+1)       ],      scan= columns,      datatype= float[8] );                          Dtau00:= < 1 >: Dtau01:= Vector[row](r): Dtau02:= Vector[row](r): Dtau10:= Vector(r): Dtau20:= Vector(r): Dtau1:= LA:-DiagonalMatrix([seq(evalf(cos(2*i*Pi*tau/L)), i= 1..r)]): Dtau2:= LA:-DiagonalMatrix([seq(evalf(sin(2*i*Pi*tau/L)), i= 1..r)]): Dtau3:= -Dtau2: Dtau4:= copy(Dtau1): Dtau:= < < Dtau00 | Dtau01 | Dtau02 >,          < Dtau10 | Dtau1  | Dtau2  >,          < Dtau20 | Dtau3  | Dtau4  > >;   P00:= < L/2 >: P01:= Vector[row](r): P02:= Vector[row](r, j-> evalf(-L/j/Pi), datatype= float[8]): P10:= Vector(r): P20:= Vector(r, i-> evalf(L/2/i/Pi)): P1:= Matrix(r,r): P2:= LA:-DiagonalMatrix(P20): P3:= LA:-DiagonalMatrix(-P20): P4:= Matrix(r,r): P:= < < P00 | P01 | P02 >,       < P10 | P1  | P2  >,       < P20 | P3  | P4  > >; interface(rtablesize=2*r+1):    # optionally J:=Vector([L, L/2 \$ 2*r]):      # Matrix([[...]]) would also work here E:=DiagonalMatrix(J); X:=  Vector[row](2*r+1,symbol=a); U:=Vector[row](2*r+1,symbol=b); X0:= Vector[row](2*r+1,[1]); G:=Vector[row](2*r+1,[1]); C:=simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);
 (1)
 > J:=X.E.Transpose(X)+U.E.Transpose(U);
 (2)
 > Minimize(J,{C=0});
 Error, (in Optimization:-NLPSolve) invalid arguments
 > #XP:=-.015+X[1]+add(X[l+1]*f1(l)+X[r+l+1]*f2(l), l= 1..r): #plot([XP,T1], t= 0..1);#,legend= "Solution Of x(t) with r=50"):
 >
 >
 >
 >

### A command like fmincon command(matlab) in maple...

March 30 2014
0 2

Hi all

In matlab software we have a command namely fmincon which minimizes any linear/nonlinear algebric equations subject to linear/nonlinear constraints.

Now my question is that: what is the same command in maple?or how can we minimize linear/nonlinear function subject to linear/nonlinear constraints in maple?

thanks a lot

Ph.D Candidate

Applied Mathematics Department

### "Too many levels of recursion" error when trying t...

January 22 2014
2 9

I received an unexpected error message when trying to minimize a function: evaluating

returns the error message

Error, (in @) too many levels of recursion

Why am I getting this message?  It's hard for me to see how minimizing a function involves recursion, unless Maple is trying to iteratively approximate a solution.

### command minimize...

December 28 2013
0 7

hey maple followers,

i need, please to find the method used in command "minimize".
i looked into help maple and i found "theorema mean values" as example
thanks!

P.s: minimize not Minimize

### how to do pdsolve numeric in this case...

December 27 2013
1 0

> sol := pdsolve({ICS, sys1, sys2, sys3, sys4, sys5, sys6, sys7}, numeric, method = rkf45, parameters = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p], output = listprocedure);

Error, (in pdsolve) invalid input: `pdsolve/numeric` expects its 2nd argument, IBCs, to be of type {set, list}, but received method = rkf45

restart;

x11:=[1.05657970467127, .369307407127487, .400969917393968, .368036162749865, .280389875142339, .280523489139136, .283220960827744, .373941285224253, .378034013792196, .384412762008662, .358678988563716, .350625923673556, .852039817522304, .362240519978640, 1.03197080591829, .343650441408896, .982510654490390, .404544012440991, .422063867224247, 1.20938803285209, .455708586000668, 1.22503869712995, .388259397947667, .472188904769827, 1.31108028794286, 1.19746589728366, .572669348193002];

y11:= [.813920951682113, 10.3546712426210, 2.54581301217449, 10.2617298458172, 3.82022939508992, 3.81119683373741, 3.90918914917183, 10.5831132713329, 10.8700088489538, 11.0218056177585, 10.5857571473115, 9.89034057997145, .271497107157453, 9.77706473740146, 2.23955104698355, 4.16872072216206, .806710906391666, 11.9148193656260, 12.0521411908477, 2.52812993540440, 12.6348841508094, 2.72197067934160, 5.10891266728297, 13.3609183272238, 3.03572692234234, 1.07326033849793, 15.4268962507711];

z11:= [8.93290500985527, 8.96632856524217, 15.8861149154785, 9.16576669760908, 3.20341865536950, 3.11740291181539, 3.22328961317946, 8.71094047480794, 8.60596466961827, 9.15440788281943, 10.2935566768586, 10.5765776143026, 16.3469510439066, 9.36885507010739, 2.20434678689869, 3.88816077008078, 17.9816287534802, 10.1414228793737, 10.7356141216242, 4.00703203725441, 12.0105837616461, 3.77028605914906, 5.01411979976607, 12.7529165152417, 3.66800269682059, 21.2178824031985, 13.9148746721034];

u11 := [5.19, 5.37, 5.56, 5.46, 5.21, 5.55, 5.56, 5.61, 5.91, 5.93, 5.98, 6.28, 6.24, 6.44, 6.58, 6.75, 6.78, 6.81, 7.59, 7.73, 7.75, 7.69, 7.73, 7.79, 7.91, 7.96, 8.05];

u11 := [seq(close3(t+t3), t3=0..26)];

sys1:=Diff(a1(s,t),s) = a*a1(s,t)+ b*a2(s,t)+ c*a3(s,t)+ d*u(t);

sys2:=Diff(a2(s,t),s) = e*a1(s,t)+ f*a2(s,t)+ g*a3(s,t)+ h*u(t);

sys3:=Diff(a3(s,t),s) = i*a1(s,t)+ j*a2(s,t)+ k*a3(s,t)+ l*u(t);

sys4:=Diff(y(t),t) = m*a1(s,t)+n*a2(s,t)+ o*a3(s,t)+ p*u(t);

sys5:= Diff(a1(s,t),t) = a1(s,t);

sys6:= Diff(a2(s,t),t) = a2(s,t);

sys7:= Diff(a3(s,t),t) = a3(s,t);

sol := pdsolve([sys1, sys2, sys3,sys4,sys5,sys6,sys7]);

t2 := [seq(i, i=1..27)];

xt1 := subs(_C1=1,sol[1]); # a1(t)

xt2 := subs(_C1=1,sol[2]); # a2(t)

xt3 := subs(_C1=1,sol[3]); # a3(t)

ut1 := subs(_C1=1,sol[4]); # u(t)

tim := [seq(n, n=1..27)];

N:=nops(tim):

ICS:=a1(1)=x11[1],a2(1)=y11[1],a3(1)=z11[1],u1(1)=u11[1];

sol:=pdsolve({sys1, sys2, sys3,sys4,sys5,sys6,sys7,ICS}, numeric, method=rkf45, parameters=[ a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p],output=listprocedure);

ans(.001,.002,.003,.001,.002,.003,.001,.002,.003,.003,.003,.003,.003,.003,.003,.003);

ans:=proc(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) sol(parameters=[ a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p]);

end proc;

result1 := Optimization:-Minimize(ans,initialpoint=[.001,.002,.003,.001,.002,.003,.001,.002,.003,.003,.003,.003,.003,.003,.003,.003]);

### product grouping...

December 13 2013
0 43

product.mw

Experts, I pose a question:

Separate the numbers 3,4,5,6,7,8,28,30,35 into three groups of three numbers each, so that the
product of the numbers in each group is equal.

The idea is to select numbers where the variance between the 3 groups is minimized.

my attempt doesn't get the anwer directly, there must be a better approach

### Minimize doesn't work with dsolve procedure?...

December 07 2013
0 4

Minimize doesn't work with dsolve porcedure?

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

with trool procedure minimize dosent work .... and its make me realy sad, couse i need to optimize alpha and leng in other (big one) porcedure with same dsolve.

get this errors:
"Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)"
"Error, (in XX) parameter 'alpha' must be assigned a numeric value before obtaining a solution"

### Integral devision by zero...

November 09 2013
1 1

Hello,

For a control systems project I'am working on I need to minimize the actuator effort required to control an input voltage to certain output voltage. As a first experiment I chose a sinusoidal input ug and a sinusoidal output ul. The function to minimize is the funtion Uint. We know that when both the input voltage and output voltage share the frequency, phase and amplitude, that the control effort is zero. Running the animation (see Maple input below) shows that if the input and output voltage frequencies approach eachother the function Uint goes to zero. However, if the frequencies exactly match and I evaluate the function Uint I get a devision by zero notification (this could already be seen from the function of Uint). How can I solve this?

 >
 >
 >
 >
 >
 >
 >
 >
 >

Thanks

### How to find the minimum value of this expression?...

April 28 2013
0 6

Let x, y, z be three nonnegative numbers and x^2 + y^2 + z^2 = 5. Find the minimum value of the expression

A = 1/2*x^2*y^2 + y^2*z^2 + z^2 *x^2 + 96/(x + y + z + 1).

How to find the minimum value of the expression?

 1 2 Page 1 of 2
﻿