Maple provides a collection of commands for numerically solving optimization problems, which involve finding the minimum or maximum of an objective function, possibly subject to constraints. The Optimization package enables you to solve linear programs (LPs), quadratic programs (QPs), nonlinear programs (NLPs), and both linear and nonlinear least-squares problems. Both constrained and unconstrained problems are accepted, and the package accepts a wide range of input formats.
You can also use Maple to perform global optimization. For more details, see Maple Global Optimization Toolbox.
 
													Maple
Logiciel de mathématiques puissant facile à utiliser
• Maple Académique • Maple Edition Étudiant • Maple Learn • Maple Calculator App • Maple pour l’industrie et le gouvernement • Edition personnelle Maple 
													
													Add-ons Maple
• E-Books & Guides d'étude • Boîte à outils et add-ons Maple • MapleNet • Maple Player gratuit 
                                                    Student Success Platform
Améliorer les taux de retention
Maple Flow
Engineering calculations & documentation
• Maple Flow • Maple Flow Migration Assistant 
                                                    
 
                             
													  
													  
                                                     
                                                     
													 
                            
















 .
.

; -1](/products/maple/features/images/optimization/optimization_examples[1]_16.gif)
](/products/maple/features/images/optimization/optimization_examples[1]_17.gif)
 

![[10.5000000000000, [x = 4., y = 6.50000000000000000]]](/products/maple/features/images/optimization/optimization_examples[1]_20.gif)

 that is closest to the point (1, 2, 3).
 that is closest to the point (1, 2, 3). 




 





![[10.2919871984546809, [x = -.510336533719663588, y = .166666666666666492, z = .843669867052996847]]](/products/maple/features/images/optimization/optimization_examples[1]_34.gif)
![x[1] .. x[n]](/products/maple/features/images/optimization/optimization_examples[1]_35.gif) be the amounts you buy
 be the amounts you buy the amount of capital you have
 the amount of capital you have the random vector of asset returns over some period
 the random vector of asset returns over some period the expected value of
 the expected value of 
 the minimum growth you hope to obtain
 the minimum growth you hope to obtain the covariance matrix of
 the covariance matrix of 
![Var(Sum(`*`(x[i], `*`(R[i])), i = 1 .. n))](/products/maple/features/images/optimization/optimization_examples[1]_43.gif) , which can be shown to be equal to
, which can be shown to be equal to  .
. 
 , you would try to:
, you would try to: 




![X := `<,>`(seq(x[i], i = 1 .. n)); -1](/products/maple/features/images/optimization/optimization_examples[1]_51.gif)




, Q), X))](/products/maple/features/images/optimization/optimization_examples[1]_56.gif)
![`+`(`*`(0.8e-1, `*`(`^`(x[1], 2))), `-`(`*`(.10, `*`(x[1], `*`(x[2])))), `-`(`*`(.10, `*`(x[1], `*`(x[3])))), `-`(`*`(.10, `*`(x[1], `*`(x[4])))), `*`(.16, `*`(`^`(x[2], 2))), `-`(`*`(0.4e-1, `*`(x[2]...](/products/maple/features/images/optimization/optimization_examples[1]_57.gif)
![ConstraintEquationsQP := {`>=`(`+`(`*`(r[1], `*`(x[1])), `*`(r[2], `*`(x[2])), `*`(r[3], `*`(x[3])), `*`(r[4], `*`(x[4]))), G), `<=`(`+`(x[1], x[2], x[3], x[4]), c)}](/products/maple/features/images/optimization/optimization_examples[1]_58.gif)
![{`<=`(1000, `+`(`*`(0.5e-1, `*`(x[1])), `-`(`*`(.20, `*`(x[2]))), `*`(.15, `*`(x[3])), `*`(.30, `*`(x[4])))), `<=`(`+`(x[1], x[2], x[3], x[4]), 10000)}](/products/maple/features/images/optimization/optimization_examples[1]_59.gif)

![[2232313.44316766, [x[1] = 3452.85892288522746, x[2] = 0., x[3] = 1068.80797452582034, x[4] = 2223.45285892288576]]](/products/maple/features/images/optimization/optimization_examples[1]_61.gif)
![x[1] = 3452, x[2] = 0, x[3] = 1068, x[4] = 2223](/products/maple/features/images/optimization/optimization_examples[1]_62.gif) . Asset 2 gets nothing because its expected return is -20% and its covariance with the other assets is not sufficiently negative for it to bring any diversification benefits.
. Asset 2 gets nothing because its expected return is -20% and its covariance with the other assets is not sufficiently negative for it to bring any diversification benefits.![x := [[1, 1], [.7, -1], [.1, -1], [.5, 1], [-.8, 1]]](/products/maple/features/images/optimization/optimization_examples[1]_63.gif)
![[[1, 1], [.7, -1], [.1, -1], [.5, 1], [-.8, 1]]](/products/maple/features/images/optimization/optimization_examples[1]_64.gif)
![tanh(`+`(`*`(x, `*`(w[2])), w[1]))](/products/maple/features/images/optimization/optimization_examples[1]_65.gif) , where
, where ![w[1]](/products/maple/features/images/optimization/optimization_examples[1]_66.gif) and
 and ![w[2]](/products/maple/features/images/optimization/optimization_examples[1]_67.gif) are the weights that are to be set. The residuals are the differences between these outputs and the desired outputs given in the training set:
 are the weights that are to be set. The residuals are the differences between these outputs and the desired outputs given in the training set:![Residual := seq(`+`(x[i][2], `-`(tanh(`+`(`*`(w[2], `*`(x[i][1])), w[1])))), i = 1 .. 5)](/products/maple/features/images/optimization/optimization_examples[1]_68.gif)
![`+`(1, `-`(tanh(`+`(w[2], w[1])))), `+`(`-`(1), `-`(tanh(`+`(`*`(.7, `*`(w[2])), w[1])))), `+`(`-`(1), `-`(tanh(`+`(`*`(.1, `*`(w[2])), w[1])))), `+`(1, `-`(tanh(`+`(`*`(.5, `*`(w[2])), w[1])))), `+`(...](/products/maple/features/images/optimization/optimization_examples[1]_69.gif)
![ObjectiveFunctionLeastSquares := add(`*`(`^`(Residual[i], 2)), i = 1 .. 5)](/products/maple/features/images/optimization/optimization_examples[1]_70.gif)
![`+`(`*`(`^`(`+`(1, `-`(tanh(`+`(w[2], w[1])))), 2)), `*`(`^`(`+`(`-`(1), `-`(tanh(`+`(`*`(.7, `*`(w[2])), w[1])))), 2)), `*`(`^`(`+`(`-`(1), `-`(tanh(`+`(`*`(.1, `*`(w[2])), w[1])))), 2)), `*`(`^`(`+`...](/products/maple/features/images/optimization/optimization_examples[1]_71.gif)
![LSSolve([Residual])](/products/maple/features/images/optimization/optimization_examples[1]_72.gif)
![[2.36675848172506, [w[1] = .251236401056941061, w[2] = -.174677175635026300]]](/products/maple/features/images/optimization/optimization_examples[1]_73.gif)
![w[1]](/products/maple/features/images/optimization/optimization_examples[1]_74.gif) and
 and ![w[2]](/products/maple/features/images/optimization/optimization_examples[1]_75.gif) are
 are  and
 and  .
. 
                                 
                                