# Question:Optimization

## Question:Optimization

Maple
```What's wrong?
Should I use for this function NLPSolve?

restart;with(Optimization);print(`output redirected...`); # input placeholder  [ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize, NLPSolve, ```
`    QPSolve]infolevel[Optimization] := 3;data := Matrix(10, 2, {(1, 1) = 0, (1, 2) = 0., (2, 1) = 1, (2, 2) = 2.0, (3, 1) = 2, (3, 2) = 7.29, (4, 1) = 3, (4, 2) = 13.72, (5, 1) = 4, (5, 2) = 21.92, (6, 1) = 5, (6, 2) = 32.57, (7, 1) = 6, (7, 2) = 35.48, (8, 1) = 7, (8, 2) = 50.11, (9, 1) = 8, (9, 2) = 57.67, (10, 1) = 9, (10, 2) = 82.47});`
`z := proc (x) options operator, arrow; A*x^b end proc;`
`        bx -> A x guess := [A = 2, b = 2];`
`                               [A = 2, b = 2]f := proc (x, y) y[1] = x^b; y[2] = A*x^b*ln(x) end proc;`
`X := data[1 .. (), 1]; Y := data[1 .. (), 2];`
`res := convert(`~`[`-`](Y, `~`[z](X)), list);`
`    [                       b             b             b             b      [0., 2.0 - A, 7.29 - A 2 , 13.72 - A 3 , 21.92 - A 4 , 32.57 - A 5 , `
`                 b             b             b             b]      35.48 - A 6 , 50.11 - A 7 , 57.67 - A 8 , 82.47 - A 9 ]Res := proc (X, Y) local j; for j to N do Y[j] := z(X[j])-data[j, 2] end do end proc;`
` `
`N := LinearAlgebra:-RowDimension(data);`
`                                     10`
`LSSolve([2, N], Res, objectivejacobian = f, initialpoint = `<,>`(2.0, 2.0));`
`LSSolve: calling nonlinear LS solverLSSolve: using method=modifiednewtonLSSolve: number of problem variables 2LSSolve: number of residuals 10LSSolve: optimality tolerance set to 0.3256082241e-11LSSolve: iteration limit set to 800LSSolve: trying evalhf modeLSSolve: trying evalf modeError, (in Optimization:-LSSolve) could not store A*2.^b in a floating-point rtable`
`LSSolve([2, N], Res, method = sqp, initialpoint = `<,>`(2.0, 2.0));`
`LSSolve: calling nonlinear LS solverLSSolve: using method=sqpLSSolve: number of problem variables 2LSSolve: number of residuals 10LSSolve: number of nonlinear inequality constraints 0LSSolve: number of nonlinear equality constraints 0LSSolve: number of general linear constraints 0LSSolve: feasibility tolerance set to 0.1053671213e-7LSSolve: optimality tolerance set to 0.3256082241e-11LSSolve: iteration limit set to 50LSSolve: infinite bound set to 0.10e21LSSolve: trying evalhf modeLSSolve: trying evalf modeError, (in Optimization:-LSSolve) could not store A*2.^b in a floating-point rtable`
```Gracias
HerClau```
﻿