Items tagged with optimization optimization Tagged Items Feed

How to find the maximum natural number n s. t. the sum of its cubed digits is greater than or equal to n? Of course, with Maple. The same question for the sum of the  digits to k-th power. Here are my unsuccessful attempts:
1.Optimization:-Maximize(n, {n <= convert(map(c ->c^3, convert(n, base, 10)), `+`)}, assume = integer);

Error, invalid input: `convert/base` expects its 1st argument, n, to be of type {integer, list(integer)}, but received n


2. for n while n <= convert(map(c ->c^3, convert(n, base, 10)), `+`) do print(n) end do;

                               1
                               2
                               3
                               4
                               5
                               6
                               7
                               8
                               9

Hi all,

Hope all to be in good health.

I have written following program to obtain minimum  under som constraints but it doesn't work due to some unknown error.

can any one help me?

Program1.mws

 

best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

This problem has real world applicability: Three vampires and three maidens are at the foot of a tall building and wish to get to the bar on the top floor.  The lift only holds two people (for convenience I am classing vampires as people), and needs one person to operate it.  If ever the vampires outnumber the maidens at any place, they will do something unspeakable.  How can the vampires and maidens all safety get to the top in the minimum of moves?  http://tonysmaths.blogspot.com.au/2012/05/vampires-and-maidens-problem.html

can this be solved procedurally or using optimization package?

possible manual soln:

No. m>= No. v

3m+3v, 0   [0]

2m+2v,m+v [1]

3m+2v,v  [2]

     3m, 3v [3]

3m+v , 2v  [4]

m+v  , 2m+2v [5]

#then reverse the steps

2m+2v, m+v [6]

       2v, 3m+v [7]

       3v, 3m  [8]

        v , 3m+2v [9]

    m+v, 2m+2v [10]

        0, 3m+3v [11]

 

What is the right syntax to solve :

min {sum(i=1 to 10) sum(j=1..10) (a_i_j)*(x_i)*(x_j) 

s.t sum(i=1..n) (b_i)*x_i=p and sum(i=1..n)x_i=1 

if a_i_j is a constant, b_i is a constant, p is a constant and x_i, x+j are the decision variables?

I understand that this is a quadratic programming problem and an application of Markowitz optimization. I've tried to use the in-built minimize function but haven't got the right output.

Please see attached document.

 

The 2 bits of data I am working with are a Constraint Function and Objective Function:

 

 

I need some pointers on how to do this. I keep getting solutions of

and I am ont receving an x value for some reason and leaving me unable to continue with the problem.

If anyone can send me some code I would be grateful. If anyone would like to send the correct full working code so I can see how to do this and review it I would be grateful.

 

 Code I had so far was:

 

 


 

Hi

I am trying to optimize a 39, 1 MATLAB matrix, but cannot seem to get a result beyond a 6, 1 matrix. I am getting "Warning, cannot resolve types, reassigning t##'s type" where t## varies from each time I run it, and can show multiple of these warnings. It also says "Warning, cannot translate list".

 

I found a pretty similar problem posted here earlier, where the user "Carl Love" suggested to replace a command from the original code with

Matlab(
     subsop([-1,1]= J, eval([codegen:-optimize](tmp, tryhard), pow= `^`)),
     output = string, defaulttype = numeric
);

 

I was wondering what exactly this command does? Can I apply it to my code to solve my problem? It yielded a result that looks (on the surface) as an optimized code, but I don't feel completely comfortable using it without being certain.

What I have done is simply to replace Matlab(tmp, optimize) with the suggested code above. My code is attached. Thanks in advance for any help.

OptiMatrix.mw

Hello maple users,

I have 2 functions and each functions has 8 variables. I run a matlab code and get outputs for different values of these variables. I assumed 3 of them as constant because the combinations are too many. Anyway, I plot the results and I can see that one function is much better than the other. But I need to compare these functions mathematically. I need to show some proofs. Has anyone any idea what should I do? I wrote the functions on maple and take derivative with respect to one variable and try to see the reaction of the functions to that variable. i am confused.

 

Thanks

 

I've got

f(x,y)= a.exp(1+xy) +( a^2 )*sin(x)+1

for which I've shown that there exists an implicit function x=g(y). ( df/dx <>0)

and df/dx = a*exp(1+xy) +( a^2 )*cosx now in the neighborhood of P=(0,0) for the implicit function to exist I'd need a*exp(1+xy)*y <>0 but at P, wouldn't this be 0?

Given, g(y)=x, how do I find the max,min,saddle points?

I want to know with what x,y, z,  function f is minimum, whereas function g is constant.

 

regards

Hi

I want to know with what x/y, z,  function f is minimum, whereas function g is constant.

regards

 

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?

file link  - >    primset.mw

 

 

 

 

Hello

I wqant to minimize a function that has som parameters (here number of parameters are two). how can i do that?

I have attache a picture from my target function. Could you please help me?

Tahnk you.

 

 

Hello,

      I would like to solve a system of 9 nonlinear equations, with the constraints on all 9 variables to be that they are nonnegative. How can I do this?

My code is below - I am trying NLPSolve and have tried solve, but am getting stuck.

with(Optimization);

restart; eq1 := 531062-S/(70*365)-(.187*(1/365))*(H+C+C1+C2)*S/N = 0;eq2 := (4/365*(T+C))*S/N-(.187*(1/365))*(H+C+C1+C2)*T/N-(1/(70*365)+1/(5*365))*T = 0; eq3 := (.187*(1/365))*(H+C+C1+C2)*S/N-(4/365)(T+C)*H/N-(1/(70*365)+1/(4*365))*H = 0; eq4 := (.187*(1/365))*(H+C+C1+C2)*T/N+(4/365*(T+C))*H/N-(1/(70*365)+3/(8*365)+.2*(1/365)+.1)*C = 0; eq5 := .1*C-(1/(70*365)+1/(4*365)+1/60+.5)*C1 = 0; eq6 := (1/60)*C1-(1/(70*365)+1/(4*365)+1/210+.5)*C2 = 0; eq7 := .5*C1-(1/(70*365)+1/60+0.1e-2)*CT1 = 0; eq8 := .5*C2-(1/(70*365)+1/210+(1/9)*(0.1e-2*7))*CT2+(1/60)*CT1 = 0; eq9 := N-S-T-H-C-C1-C2-CT1-CT2 = 0; soln := NLPSolve({eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}, {C, C1, C2, CT1, CT2, H, N, S, T}, assume = nonnegative);

Hi all

The aim of following program is minimization but it is unable to produce it. where is the mistake?

Taylor2.mws

thanks a lot.

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

1 2 3 4 5 6 7 Last Page 1 of 12