Skip to main content
10 votes

Finding the smallest function and the domain on which it is smallest

PiecewiseExpand[Min[{x, x^2, 4 - x}]] (* 4-x if x>=2 x if 1<=x<2 || x<=0 x^2 otherwise *)
Roman's user avatar
  • 47.9k
10 votes
Accepted

Is it possible to ask Mathematica to give the maximum value of a function over a specific domain?

NMaximize[{f[n], 1 <= n <= 10^6, n ∈ Integers}, n] (* Out: {63.041, {n -> 2}} *) You can then get the corresponding symbolic function value using your ...
MarcoB's user avatar
  • 67.3k
9 votes
Accepted

MaximalBy[#, "votes"] & not equal to MaximalBy["votes"]?

Generally, fun in MaximalBy[fun] or MaximalBy[list, fun] must be a function. But <...
Szabolcs's user avatar
  • 235k
9 votes

How can I mark the maximum value in a plot?

f[x_] := im[0.1 10, 1 10, 1000, 0.1 10, 0.000001 10, x, 0.1 10]; 1. An alternative way to use MeshFunctions: ...
kglr's user avatar
  • 396k
8 votes
Accepted

Get envelope of a set of functions?

Michael E2 is correct in that Max is remarkably capable with functions as well as values. Defining ...
Quantum_Oli's user avatar
  • 7,964
8 votes

Find the max value of $f(x,y)= 9\ln(x^2+2y^2+1)-x^2-y^2$

If I understand correctly, you want to maximize the following expression: obj = 9 Log[x^2 + 2y^2 + 1] - x^2 - y^2; subject to the constraint that ...
Carl Woll's user avatar
  • 131k
7 votes

Finding maximum value of a discrete function

f[N2_, N3_] := 20*Log[20] - N2*Log[N2] - N3*Log[N3] - (20 - N2 - N3)*Log[20 - N2 - N3]; For the continuous function ...
Bob Hanlon's user avatar
  • 159k
7 votes
Accepted

How can I get exact maximal value of this expression?

Writing: ...
πρόσεχε's user avatar
7 votes

How can I get exact maximal value of this expression?

I don't know why Maximize is unable to find the maximum. Instead of using Maximize, you could try using Lagrange multipliers. To ...
Carl Woll's user avatar
  • 131k
7 votes

How can I mark the maximum value in a plot?

You may e.g. use "NMaximize" and "Epilog" like: ...
Daniel Huber's user avatar
  • 52.6k
7 votes

Find the minimum & maximum and plot it with the mean data

Transpose all of the data lists ...
Bob Hanlon's user avatar
  • 159k
7 votes
Accepted

How can I find the maximal value of this?

...
cvgmt's user avatar
  • 75k
6 votes

List of critical points

I would use MaxValue in combination with Solve: ...
Carl Woll's user avatar
  • 131k
6 votes

Finding maximum value of a discrete function

Just a brute force approach: ...
ubpdqn's user avatar
  • 61.6k
6 votes

Find the max value of $f(x,y)= 9\ln(x^2+2y^2+1)-x^2-y^2$

As mentioned by kirma in a comment to Carl Woll's answer, the maximum depends on whether you are defining the function as being on a Circle or on a ...
Bob Hanlon's user avatar
  • 159k
6 votes

Optimising the Selection of MaxValue in Association

Maybe you can use Reduce instead of MaxValue. For instance, the "vanilla:veal" rational function is: ...
Carl Woll's user avatar
  • 131k
6 votes
Accepted

Finding the smallest function and the domain on which it is smallest

There is a very recent addition to the Wolfram Function Repository that can be utilized here. ...
6 votes

Maximization of a concave function with contraints in the arguments

If I correctly understand the question, Maximize does the job in 13.1 on Windows 10: ...
user64494's user avatar
  • 26.6k
6 votes

Polynomial approximation of max function

Limit[x LogisticSigmoid[k x], k -> Infinity] gives ConditionalExpression[x, x > 0] so give a large ...
flinty's user avatar
  • 25.5k
6 votes

Getting an exact value from FindMinimum

...
Syed's user avatar
  • 55.4k
6 votes

NMaxValue - function is not a real number

If you plot your function F[z] Plot[F[z], {z, -0.7, 1}] you can see that the max is somewhere near -0.25. Since your function becomes complex valued at around -0.6,...
bill s's user avatar
  • 69.1k
6 votes

Is it possible to ask Mathematica to obtain the function describing the upper and lower boundaries of a combinations of functions?

Something like: ...
Daniel Huber's user avatar
  • 52.6k
5 votes
Accepted

Finding all the local minima from a noisy data plot

Try: ...
Josh Bishop's user avatar
5 votes
Accepted

Maximization of a function over a discrete set

This? Last[SortBy[Map[{f@@#, #}&, Tuples[{setx, sety, setz}]], First]] The Tuples will give you all combinations, the ...
Bill's user avatar
  • 12.1k
5 votes
Accepted

Find maximum of the output from reduce

Let the large result of Reduce be rs. Then the maximum of each quantity is determined by ...
bbgodfrey's user avatar
  • 61.6k
5 votes
Accepted

NMaximize is not converging to a solution

Rationalize the constraint: ...
Bob Hanlon's user avatar
  • 159k
5 votes

Plot maximum value of a function of three variables

I might be misinterpreting the question, but it seems like the OP is asking for a 2-D representation (t vs. the maximum of f over the whole domain). ...
MelaGo's user avatar
  • 8,751
5 votes

Optimising the Selection of MaxValue in Association

The following is not the exact filter that you want, but a simple prefilter that apparently is quite good at filtering the given example ;) The point is that this check is much cheaper than computing ...
Henrik Schumacher's user avatar
5 votes

How can I mark the maximum value in a plot?

Try this: ...
Alexei Boulbitch's user avatar
5 votes
Accepted

Polygon Diameter

...
Bob Hanlon's user avatar
  • 159k

Only top scored, non community-wiki answers of a minimum length are eligible