# Tagged Questions

Questions on the optimization functions of Mathematica such as FindMinimum/FindMaximum, Minimize/Maximize, NMinimize/NMaximize, etc.

1answer
66 views

### Calculate minimum subject to conditions

What is the lowest value of $c$ such that $\qquad a^2 + b^2 = c^2$ and $\qquad ab + ac + bc = 100$ I want to solve this problem with Mathematica Edit These conditions are generated from a right ...
0answers
20 views

### Why isn't this minimize function returning the optimal answer? [on hold]

I am trying to minimize the following equation by solving for s1, s2, s3, s4 (where s1+s2+s3+s4=20, and they should be positive integers) ...
0answers
29 views

### NMaximize — Error + Output

When I run the code, Table[ NMaximize[ {f[α, χ, τ], 0 <= α <= 2 π, 0 <= χ <= π}, {α, χ}, WorkingPrecision -> 10 ], {τ, 0.1, 2, 0.1} ] ...
2answers
35 views

### NMaximize and FindMaximum — Two Different Results

I have the following code in my preamble: ...
1answer
44 views

### How to find a maximum?

FindMaximum[1/2*Abs[(o - u)^2/(1 + o^2 + u^2 + 2*o*u + 2*o^2*u^2)]^2, {o, u}] doesn't work. It gave me that : FindMaximum::fmgz: Encountered a gradient that ...
0answers
3 views

### Maximum Likelihood Approach for parameter estimation of multi response data, could you provide a tutorial? [migrated]

I was trying to fit the parameters a time dependent system coupled of ODES relate to a kinetic experiment with multi response data. example: A->B+H A+H->C+H A->D dcA(t)/dt=-k1Ca(t)-k2Ca(t)*Ch(t)-k3*Ca(...
0answers
33 views

### Training Hidden Markov Models using Mathematica

I have created a Hidden Markov Process with an initial probability vector, emission and transmission matrices. ...
2answers
101 views

### In NMinimize, how can I efficiently handle NIntegrate errors for non-integrable functions?

I am using NMinimize to find parameters that minimise the integral of a function in the least squares sense: ...
0answers
34 views

### Why Mathematica does not Maximize when using parameter

I have recently started using Mathematica and I have got a question using it. I would appreciate if one could help me figuring out how to handle it. I have the following simple maximisation code <...
3answers
315 views

### Find parameters that minimize the distance between two curves in terms of the infinite norm

I am trying to implement a very simple NMinimize code that would search for parameters of a polynomial that minimize (globally) the distance between this polynomial ...
1answer
38 views

### (Custom) domain restrictions for NMaximize

I'm new to mathematica, so please be forbearing with me :D I would like to use NMaximize together with domain restriction (where the domain is a custom domain). I've got an example: ...
1answer
63 views

### Calculating extrema of a given function on a geometrical region

I've never used Mathematica before. Now I have to figure out, for one of my classes, how to find the max and min of the function $f(x,y)=x^3+2\ xy$ over the triangular region of the plane with ...
3answers
153 views

### Optimizing a Difference in Mathematica

I have the following expressions: $$\frac{1}{2} \Bigg [1 + \sqrt{a^2 + (b e^{-\gamma(\tau)})^2 + (c e^{-\gamma(\tau)})^2} \Bigg ];$$ ...
1answer
53 views

### Find the minimum of several functions

I have 6 functions of four variables $f_i: \mathbb{R}^4 \rightarrow \mathbb{R},\, i \in 1..6$ For each function $f_j$ I want to find the subset of $\mathbb{R}^4$, called $S_j$, for which it is ...
0answers
44 views

### Issues with methods of FindMinimum

I'm trying to use the function FindMinimum for portfolio optimization in stead of NMinimize, since the latter is a lot slower. Also because the variance function of my portfolio is convex, locally ...
2answers
350 views

### Need an efficient method for finding certain matrices

I am trying to write a function which produces square matrices with certain characteristics. The function should have two inputs: number of the rows, n number of ...
1answer
625 views

### Fitting Vogel's formula for phyllotaxis to the image of a flower

After having read this question I was inspired to investigate how we could take an image of a plant displaying phyllotaxis and fit Vogel's model of phyllotaxis to the image. The theory is very simple. ...
0answers
39 views

### Constrain a series of parameters while using FindMinimum

I'm working on fitting some experimental data using a model function that consists of sum of Lorentzians with width parameters A[1], ...
0answers
49 views

### Optimization: Area of solvable constraints

I need some support with the following problem: In a polar-type problem, I hand over a list of variables rlist and a numerical optimization function (e.g. ...
1answer
53 views

### Why isn't FindMinimum doing anything?

Why is FindMinimum not giving me a result? ...
4answers
489 views

### Finding a point from a set of contours such that it is nearest to a given point

I have several contour lines and one point. How can I find a point in one of those contour lines which is nearest to the given point? ...
1answer
65 views

### How to minimize the total delivered price when buying many items from many different sources [closed]

In the past, I have often had a problem that I have tried to solve with a large matrix in Excel. Now I want to solve the problem in Mathematica because the matrix is getting larger and the problem ...
1answer
46 views

1answer
198 views

### Finding the maximum of a gradient vector

Im trying to find the maximum of my gradient vector G[x,y], I've tried several options including FindMaximumValue, FindMaximum etc. but i couldn't find it. The full function is shown below, any help ...
1answer
97 views

### Moving the start of a graph to the right, finding maxima in an oscillator

I have the following code written to simulate a driven damped oscillator ...
1answer
109 views

### Complicated implicit plotting [closed]

I'm quite new to Mathematica and have already spent tons of time on problems of this type, browsing through tutorials and topics here. I'm now coming to conclusion that it cannot be done and am about ...
1answer
91 views

### Problem with a chemical optimization problem [closed]

First of all, I want to say that I'm quite new to Mathematica. I searched a lot on this site to learn how to solve my problem, which this is the problem of my life! I want to minimize a function. It ...
1answer
80 views

### RegionPlot with rank constraint

I am trying to plot the feasible region of a rank constrained semidefinite program shown below: The Mathematica code that I am using is the following: ...
1answer
112 views

### Is the MMA formulation correct?

Let $H$ be a $4\times 8$ matrix and $R$ is a vector of 2 elements. ...
3answers
97 views

### FindMinimum step size too small

I'm running a simulation of an electromagnetic system using Radia, an external code that is run from Mathematica. I want to use FindMinimum to determine some ...
2answers
116 views

...
2answers
1k views

### Schedule programing problem with integer linear programming

I know how to model this question on paper, but I don't know how doing it in Mathematica. Imagine , there is a university student who want to choose courses for this semester and he got the ...
0answers
87 views

### Softmax Regression Classification Algorithm

I'm following the Stanford Machine Learning course while simultaneously developing my Mathematica abilities. I'm having issues with my Softmax Classifier implementation (for ref, have a look at these ...
2answers
92 views

### Find smallest solution in Solve's solution set

When an equation has multiple solutions, how do you find the first solution? Example: Say we're trying to find the first positive x-intercept of the cosine function: $cos(x)=0 \land x \ge 0$ ...
1answer
99 views

### Controlling step size in FindMaximum

I have a function of several variables for which I'd like to find the maximum. On one hand, it's easy to work with in the sense that it's smooth, and its only local maximum is a global one. On the ...
0answers
63 views

### Solve equations involving summation expressions in Mathematica

I am trying to solve the simple linear regression equation analytically in Mathematica (not using builtin functions). I managed to calculate the gradient as follows f is loss function using RSS and ...
0answers
35 views

### Gradient Descent's Update Rule for Multiparameter Functions

I'm sure this has been answered before, but I haven't been able to find it. I'm trying to manually implement gradient descent for some function, f, with a vector of any length. I define the update ...
2answers
66 views

### How to pass numerically evaluated constraints into nminimize?

I have a set of complicated 100 constraints which can be computed numerically for the given iterative values of the design variables. Once evaluated the lhs of the constraints are available as a ...
1answer
59 views

### Finding the max points of a surface, maximize

So, this should not be hard at all, in fact no one seems so be having my issue so it should be me missing out on a point of information or just experience. So my mission is to with Mathematica find ...
1answer
383 views

### ParametricNDSolve KKT Constraint Directly

I am trying to directly solve for an optimal control using Pontryagin Maximum, where H is the Hamiltonian, in the presence of a KKT constraint. The constraint is ignored. I am wondering if a direct ...
2answers
218 views

### How to find a graphical solution for extreme values using Lagrange multipliers

I need to find the maxima and minima of a function. I managed this analytically with no problem, but now I need to show in a graphic the intersection of the functions. My function is: ...