HP Forums
Find minimum or maximum of multi-variable function - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Find minimum or maximum of multi-variable function (/thread-13526.html)



Find minimum or maximum of multi-variable function - teerasak - 08-28-2019 07:14 AM

I'm not sure whether there is a function or command which can find the minimum or maximum of multi-variable function e.g

find min of Sqrt((x-14)^2 + (y-55)^2) + Sqrt((x-23)^2 + (y-95)^2)

Or any application which can help finding this kind of problem?


RE: Find minimum or maximum of multi-variable function - jlind - 08-28-2019 02:33 PM

(08-28-2019 07:14 AM)teerasak Wrote:  I'm not sure whether there is a function or command which can find the minimum or maximum of multi-variable function e.g.

find min of Sqrt((x-14)^2 + (y-55)^2) + Sqrt((x-23)^2 + (y-95)^2)

Or any application which can help finding this kind of problem?

This is a multivariate calculus problem with the function f(x,y) = z, where z is the unstated dependent variable for the equation you gave for the third z-axis. Fortunately your two independent variables, x and y, aren't completely jumbled together. Conceptually it's the same approach as univariate calculus. The zeroes of the first partial derivatives will help identify maxima, minima, and saddle points, if there are any, where the slope of the tangent plane is zero. This involves finding partial derivatives of f(x,y) as part of the solution and it sets up a partial derivative vector called the gradient. A gradient is the same concept as a slope in three (or more) dimensions as a plane (in three dimensions) or a hyper-plane in four or more dimensions. When the set of all (x,y) are found that are zeroes of both the partial derivatives with respect to both x and y, it's called the set of zero vectors. Among them should be (if they exist) the global maximum, the global minimum, other local maxima, other local minima, and a phenomenon not found in univariate calculus, saddle points. Local maxima are other hilltops not as tall as the tallest peak in the mountain range. A saddle point looks like a saddle, and it's the low spot between two or more peaks that rises in their direction and falls off in the directions between the peaks.

See this video from the Kahn Academy and its follow-on videos to give you a conceptual idea of what you'll need to do . . .
https://www.khanacademy.org/math/multivariable-calculus/applications-of-multivariable-derivatives/optimizing-multivariable-functions-videos/v/multivariable-maxima-and-minima

With regard to the HP Prime, look for the Gradient tools in its derivative calculus toolbox. Hope this helps get you started. The conceptual aspect of what you want to do is well over half the battle. You'll undoubtedly have to poke around a bit to find what you need to use and how to use it in the calculator. Looked for some things in the Prime documentation which isn't as helpful as it could be. Been decades since I did this stuff. All we had was pencils, engineering pads, a slide rule, and the CAS calculator was the CRC Handbook of Mathematical Tables (which has sections on derivatives and integrals). :-D

BTW, don't think of math involving three or more independent variables in hyperspaces as being that exotic. There are a multitude of practical applications for it in maximizing or minimizing aspects of physical processes and systems with multiple inputs or controls when responses are non-linear.

John


RE: Find minimum or maximum of multi-variable function - parisse - 08-28-2019 04:09 PM

This is the sum of distances of M(x,y) to 2 points A(14,55) and B(23,95). Therefore the min is any point in the segment AB. Multivariate calculus would fail here, because the minimum is not isolated (the gradient is 0 in the segment).


RE: Find minimum or maximum of multi-variable function - roadrunner - 08-28-2019 05:29 PM

If you plot the equation n the 3D app:

sqrt((X-14)^2+(Y-55)^2)+sqrt((X-23)^2+(Y-95)^2)

Tap Menu/Zoom/Out 4 or 5 times, then go to the plot setup the new Zoom values are not saved. Is there a way to use Menu/Zoom/Out and have the zoom settings saved in Xmin, Xmax, Ymin, Ymax, Zmin, and Zmax?

-road


RE: Find minimum or maximum of multi-variable function - teerasak - 08-29-2019 07:19 PM

@jlind, Thank you. It is time to come back to review multi-variable calculus which has gone from my head. Thank you for the info and link.

@parissee, you are right. So the minimum for this case is the distance between two point, which is 41. However, I’m not sure, in HP prime, is there the command to find Min/max of multi-variable function? One tools I use is 3D graph. It helps but quite difficult to read the value, and no tools to find extremum in the graph.

@roadrunner, I faced the same issue too. For this problem, I zoom out few time to see the 3D graph. After I quit from the plot, and come back, the scale go back to default.


RE: Find minimum or maximum of multi-variable function - teerasak - 08-30-2019 11:01 AM

I tried to find derivative of the function to x and to y, and use solve command to find the value x, and y to make the derivative to zero, as in the pictures.

I got strange calculation result c_0. What does it mean? I try to evaluate it numerically, it still leave c_0 as the result.


RE: Find minimum or maximum of multi-variable function - Csaba Tizedes - 08-30-2019 08:48 PM

(08-29-2019 07:19 PM)teerasak Wrote:  So the minimum for this case is the distance between two point, which is 41.

Just put a third point and you will jump to the complex problems world. If you interested, here you can find a sloooow solution on a TI-83:





Csaba


RE: Find minimum or maximum of multi-variable function - parisse - 09-02-2019 04:57 AM

(08-29-2019 07:19 PM)teerasak Wrote:  @parissee, you are right. So the minimum for this case is the distance between two point, which is 41. However, I’m not sure, in HP prime, is there the command to find Min/max of multi-variable function? One tools I use is 3D graph. It helps but quite difficult to read the value, and no tools to find extremum in the graph.

There is an extrema command in Xcas to do that, but it seems it is not available in the Prime CAS.


RE: Find minimum or maximum of multi-variable function - teerasak - 09-03-2019 07:21 AM

@parisse , that's really unfortunate for not having that command. So need to find out from derivative and solve equation. Thank you for information.