Items tagged with directsearch



I have three simultaneous equations  with three unknown variables (E, W, T). When I solve these  simultaneous equations with fsolve command without specifying any range for variables, I don't get desirable root ( equation sol4 in maple worksheet- {E = 0.1007672475e-2, T = .7969434549, W = 0.1937272759e-2}). For this problem, I know the correct root {E = 2843.916504, T = .2782913990, W = 5344.844134} beforehand which maximize the objective function TP (equation sol8 in maple worksheet) and when I specify the narrow range of variables around the already known correct root in the fsolve command, then I get correct root ( equation sol5 in maple worksheet). If I don't know the actual answer (correct roots of the simultaneous equation) beforehand, How  could I get the correct root with fsolve command because it is very tedious work to specify different range in fsolve command repetitively to solve it by trial and error.

I also tried Direct Search method as suggested in this forum  but DirectSearch is also not able to provide the correct root (equation sol6 in maple worksheet). If I specify the narrow range around known root in direct search method ( equation sol6a in maple worksheet), then it would provide close to optimal root but if I don't know the correct root beforehand, then I couldn't specify the narrow range of variables, then how can I get correct root through direct search command.

Equation sol10 in maple worksheet  (objective function value at correct root) confirms that {E = 2843.916504, T = .2782913990, W = 5344.844134} is the correct root because it provide the value of objective function (TP) equal to 78285.85621 as opposed to negative value (TP value -12.53348074 in equation sol9)  produced by incorrect root  {E = 0.1007672475e-2, T = .7969434549, W = 0.1937272759e-2}).

Is there any method which would provide all the roots of these simultaneous equations which also include correct root. Maple worksheet is attached.

I am trying fsolve and direct search method with known root so that I could get the proper procedure to get the correct root which I can apply to another problem (set of similar simultaneous equations) for which I don't know correct root beforehand.

Thanks for your anticipated

Maple 2017 has launched!

Maple 2017 is the result of hard work by an enthusiastic team of developers and mathematicians.

As ever, we’re guided by you, our users. Many of the new features are of a result of your feedback, while others are passion projects that we feel you will find value in.

Here’s a few of my favourite enhancements. There’s far more that’s new - see What’s New in Maple 2017 to learn more.


MapleCloud Package Manager

Since it was first introduced in Maple 14, the MapleCloud has made thousands of Maple documents and interactive applications available through a web interface.

Maple 2017 completely refreshes the MapleCloud experience. Allied with a new, crisp, interface, you can now download and install user-created packages.

Simply open the MapleCloud interface from within Maple, and a mouse click later, you see a list of user-created packages, continuously updated via the Internet. Two clicks later, you’ve downloaded and installed a package.

This completely bypasses the traditional process of searching for and downloading a package, copying to the right folder, and then modifying libname in Maple. That was a laborious process, and, unless I was motivated, stopped me from installing packages.

The MapleCloud hosts a growing number of packages.

Many regular visitors to MaplePrimes are already familiar with Sergey Moiseev’s DirectSearch package for optimization, equation solving and curve fitting.

My fellow product manager, @DSkoog has written a package for grouping data into similar clusters (called ClusterAnalysis on the Package Manager)

Here’s a sample from a package I hacked together for downloading maps images using the Google Maps API (it’s called Google Maps and Geocoding on the Package Manager).

You’ll also find user-developed packages for exploring AES-based encryption, orthogonal series expansions, building Maple shell scripts and more.

Simply by making the process of finding and installing packages trivially easy, we’ve opened up a new world of functionality to users.

Maple 2017 also offers a simple method for package authors to upload workbook-based packages to the MapleCloud.

We’re engaging with many package authors to add to the growing list of packages on the MapleCloud. We’d be interested in seeing your packages, too!


Advanced Math

We’re committed to continually improving the core symbolic math routines. Here area few examples of what to expect in Maple 2017.

Resulting from enhancements to the Risch algorithm, Maple 2017 now computes symbolic integrals that were previously intractable

Groeber:-Basis uses a new implementation of the FGLM algorithm. The example below runs about 200 times faster in Maple 2017.

gcdex now uses a sparse primitive polynomial remainder sequence together.  For sparse structured problems the new routine is orders of magnitude faster. The example below was previously intractable.

The asympt and limit commands can now handle asymptotic cases of the incomplete Γ function where both arguments tend to infinity and their quotient remains finite.

Among several improvements in mathematical functions, you can now calculate and manipulate the four multi-parameter Appell functions.


Appel functions are of increasing importance in quantum mechanics, molecular physics, and general relativity.

pdsolve has seen many enhancements. For example, you can tell Maple that a dependent variable is bounded. This has the potential of simplifying the form of a solution.


Plot Builder

Plotting is probably the most common application of Maple, and for many years, you’ve been able to create these plots without using commands, if you want to.  Now, the re-designed interactive Plot Builder makes this process easier and better.

When invoked by a context menu or command on an expression or function, a panel slides out from the right-hand side of the interface.


Generating and customizing plots takes a single mouse click. You alter plot types, change formatting options on the fly and more.

To help you better learn Maple syntax, you can also display the actual plot command.

Password Protected Content

You can distribute password-protected executable content. This feature uses the workbook file format introduced with Maple 2016.

You can lock down any worksheet in a Workbook. But from any other worksheet, you can send (author-specified) parameters into the locked worksheet, and extract (author-specified) results.


Plot Annotations

You can now get information to pop up when you hover over a point or a curve on a plot.

In this application, you see the location and magnitude of an earthquake when you hover over a point

Here’s a ternary diagram of the color of gold-silver-copper alloys. If you let your mouse hover over the points, you see the composition of the points

Plot annotations may seem like a small feature, but they add an extra layer of depth to your visualizations. I’ve started using them all the time!


Engineering Portal

In my experience, if you ask an engineer how they prefer to learn, the vast majority of them will say “show me an example”. The significantly updated Maple Portal for Engineers does just that, incorporating many more examples and sample applications.  In fact, it has a whole new Application Gallery containing dozens of applications that solve concrete problems from different branches of engineering while illustrating important Maple techniques.

Designed as a starting point for engineers using Maple, the Portal also includes information on math and programming, interface features for managing your projects, data analysis and visualization tools, working with physical and scientific data, and a variety of specialized topics.


Geographic Data

You can now generate and customize world maps. This for example, is a choropleth of European fertility rates (lighter colors indicate lower fertility rates)

You can plot great circles that show the shortest path between two locations, show varying levels of detail on the map, and even experiment with map projections.

A new geographic database contains over one million locations, cross-referenced with their longitude, latitude, political designation and population.

The database is tightly linked to the mapping tools. Here, we ask Maple to plot the location of country capitals with a population of greater than 8 million and a longitude lower than 30.


There’s much more to Maple 2017. It’s a deep, rich release that has something for everyone.

Visit What’s New in Maple 2017 to learn more.

I have a data point set:


I want to make a least square fit using this difficult function:


but both Statistics[Fit]:


and DirectSearch[DataFit]:


give wrong k,E parameters. The correct parameter values were obtained with Excel Solver:



The approximately correct parameters were fitted when using logarithm form of the function.
How can I obtain correct parameter values in Maple using given form of the function?

Maple tech support sent me a third party application for my Maple 2016 to solve a problem that I'm working on. I was instructed to copy and paste a few items from the download: "to your "<maple>/lib" folder" Unfortunately I cannot access "lib" in my Maple "Applications" folder on my OS X MacBook Pro.

This is what Maple Tech Support sent me:

"Another option you may want to look into is the "DirectSearch" package (which is third-party, and not supported by us), which would need to be downloaded from the Maplesoft Application Centre:




There is a function "GlobalOptima()", which allows one to search for a global minimum to the objective function, as opposed to a local minimum like commands such as "LSSolve()". To install, you can extract the files "DirectSearch.mla", "", and "DirectSearch.hdb" to your "<maple>/lib" folder."


Any suggestions?


How to prove the inequality x^(4*y)+y^(4*x) <= 2 provided x^2+y^2 = 2, 0 <= x, 0 <= y? That problem was posed  by Israeli mathematician nicked by himself as arqady in Russian math forum and was not answered there.I know how to prove that with Maple and don't know how to prove that without Maple. Neither LagrangeMultipliers nor extrema work here. The difficulty consists in the nonlinearity both the target function and the main constraint. The first step is to linearize the main constraint and the second step is to reduce the number of variables to one.

restart; A := eval(x^(4*y)+y^(4*x), [x = sqrt(u), y = sqrt(v)]);




B := expand(A);



C := eval(B, u = 2-v);



It is more or less clear that the plot of F is symmetric wrt  the straight line v=1. This motivates the following change of variable  to obtain an even function.

F := simplify(expand(eval(C, v = z+1)), symbolic, power);




The plots suggest the only maximim of F at z=0 and its concavity.

Student[Calculus1]:-FunctionPlot(F, z = -1 .. 1);


Student[Calculus1]:-FunctionPlot(diff(F, z, z), z = -1 .. 1);


As usually, numeric global solvers cannot prove certain inequalities. However, the GlobalSearch command of the DirectSearch package indicates the only local maximum of  F and F''.NULL

Digits := 25; DirectSearch:-GlobalSearch(F, {z = -1 .. 1}, maximize, solutions = 3, tolerances = 10^(-15)); DirectSearch:-GlobalSearch(diff(F, z, z), {z = -1 .. 1}, maximize, solutions = 3, tolerances = 10^(-15));

Array([[0.8e-23, [z = -0.1980181305884928531875965e-12], 36]])


The series command confirms a local maximum of F at z=0.

series(F, z, 6);



The extrema command indicates only the value of F at a critical point, not outputting its position.

extrema(F, z); extrema(F, z, 's');



solve(F = 2);



DirectSearch:-SolveEquations(F = 2, {z = -1 .. 1}, AllSolutions, solutions = 3);

Matrix(1, 4, {(1, 1) = 0., (1, 2) = Vector(1, {(1) = 0.}), (1, 3) = [z = -0.5463886313e-6], (1, 4) = 27})


DirectSearch:-SolveEquations(F = 2, {z = -1 .. 1}, AllSolutions, solutions = 3, assume = integer);

Matrix(1, 4, {(1, 1) = 0., (1, 2) = Vector(1, {(1) = 0.}), (1, 3) = [z = 0], (1, 4) = 30})



 PS. I see my proof needs an additional explanation. The DirectSearch command establishes the only both local and global  maximum of F is located at z= -1.98*10^(-13) up to default error 10^(-9). After that  the series command confirms a local maximum at z=0. Combining these, one draws the conclusion that the global maximum is placed exactly at z=0 and equals 2. In order to confirm that the only real root of F=2 at z=0  is found approximately and exactly by the DirectSearch.


Let us consider the maximum value of the polynomial


on the interval x=-1..1 as a function g of the parameters c and d. General considerations suggest its continuity. However, a plot3d of g does not  confirm it.  Also the question arises "Is the function g(c,d) bounded from below?". Here is my try with the DirectSearch and NLPSolve:



g(10, -10)



plot(x^4+x^3+10*x^2-10*x-10-1, x = -1 .. 1)


plot3d(g, -5 .. 5, -5 .. 5, grid = [100, 100], style = surface, color = "DarkOliveGreen")


DirectSearch:-GlobalOptima(proc (a, b) options operator, arrow; g(a, b) end proc, {a = -1000 .. 1000, b = -1000 .. 1000}, variables = [a, b])

[-167.208333252089, Vector(2, {(1) = 999.9999999975528, (2) = 166.20833325208952}, datatype = float[8]), 815]


DirectSearch:-GlobalOptima( (a, b) -> g(a, b), variables = [a, b])

DirectSearch:-GlobalOptima(proc (a, b) options operator, arrow; g(a, b) end proc, variables = [a, b])

Error, (in Optimization:-NLPSolve) invalid input: PolynomialTools:-CoefficientVector expects its 1st argument, poly, to be of type polynom(anything, x), but received HFloat(HFloat(undefined))*x^4+HFloat(HFloat(undefined))*x^3+HFloat(HFloat(undefined))*x^2+HFloat(HFloat(undefined))*x+HFloat(HFloat(undefined))






Executing HelpTools:-Database:-ConvertAll(): produced file apparently without content. How can all content within DirectSearch.hdb be converted to a .help file accessible through help in Maple 2016?

So I installed copied DirectSearch.hdp and DirectSearch.mla into my Maple2015\lib directory and the program works (all the functions are there) but I cant get help menu by querying ?DirectSearch.

I'm running win7 64bit btw

so under


i put this into maple:


but i get error....

"Converting C:\\Program Files\\Maple 2015\\lib\\DirectSearch.hdb to C:\\Program Files\\Maple 2015\\lib\\"
Warning, .hdb help databases are deprecated, 'C:\Program Files\Maple 2015\lib\DirectSearch.hdb' will not be used, see ?HelpTools,Migrate help page for more information
Error, (in HelpTools:-HelpCallUI) cannot create help database: 'unable to open database file'

any clue?

ps I asked the same question for M18 but I managed to get the help to work in that instance.

(i also copied DirectSearch.hdp and DirectSearch.mla to Maple2015\bin.X86_64_WINDOWS directory but no joy, there is no .help file created in either bin or lib directories)

@Markiyan Hirnyk   I try not to use this package, as I think the results are not reliable enough. Here is the example, where instead of the three real roots it finds only one, despite the hint to look for the three roots:


DirectSearch:-SolveEquations(100^x=x^100, AllSolutions, solutions=3);


There are many other examples, particularly in discrete optimization in which it returns false results. Here is one example (well-known to you).

hi, the equations read as 

eq:=[2*x-0.2e-1*y-2.04*sqrt(-v^2+1)*v, 2*y-0.2e-1*x-2.16*sqrt(-u^2+1)*u, 2*u+2.16*u^2*y/sqrt(-u^2+1)-2.16*sqrt(-u^2+1)*y, 2*v+2.04*v^2*x/sqrt(-v^2+1)-2.04*sqrt(-v^2+1)*x] ;

i do as follows using DirectSearch package v.2

i find the solutions not the same,some time the results not much difference,but another,sols1 have one solution,sols2 have three some time,some solutions are lost,the result show  me  random.may i have run the command serveral times? regards.


I have a system of equation. to solve i using DirectSearch pakage. i think in answer DirectSearch use rounding number but in answer it's second and third digit after the decimal point is important. please help me.

if b and c increase 0.01 and -0.01 it's ok. another main question is why by increasing the intensity answer don't change.


i want to use Direct Search Package for solve system of equation but i have an error:

Error, SolveEquations is not a command in the DirectSearch package.

please help me. code is

I solve the problem on computational geometry: "A cube of side one contains two cubes of sides a and b having non-overlapping interiors. How to prove the inequality a+b≤1?" To this end I use the DirectSearch package , namely,

Here are some comments to it. The cube of side a is centered at (x_1,y_1,z_1) and rotated by the angles phi_1, psi_1, theta_1 (see ) and the cube of side b is centered at (x_2,y_2,z_2) and rotated by the angles phi_2, psi_2, theta_2. The procedure

calculates the distance between these cubes, for example,

st := time(); dist(.2, .9, .2, .2, .2, .7, .7, .7, 0, 0, 0, 0, 0, 0); time()-st;

[HFloat(5.453016092898238e-11), [s1 = HFloat(0.2646161775314957),

  s2 = HFloat(0.2828503247068887),

  s3 = HFloat(0.29444713116943216),

  t1 = HFloat(0.2646161774916062),

  t2 = HFloat(0.28285032471998384),

  t3 = HFloat(0.2944471311346344)], 2527]
Unfortunately, my code (which is syntactically correct) is spinning on my wondercomp during 10 hours without any output. I don't understand it at all. Your advices are welcome.

I want to find the greatest value of this expression 


with x>0, y>0 , z>0,x+y+z=3.

I tried



DirectSearch[GlobalOptima](f(x,y,z), {x>0, y>0 , z>0,x+y+z=3},maximize);

I got the output

[HFloat(infinity), [x = .591166078050740e52, y = .183647204560715e52, z = .786638021216969e52], 1249]




DirectSearch answer has confused me. How to reduce the residual.
See the

1 2 Page 1 of 2