# Tagged Questions

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

2answers
20 views

### NMaximize and FindMaximum — Two Different Results

I have the following code in my preamble: ...
1answer
40 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
30 views

### Training Hidden Markov Models using Mathematica

I have created a Hidden Markov Process with an initial probability vector, emission and transmission matrices. ...
0answers
33 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 <...
1answer
36 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: ...
3answers
152 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
43 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 ...
0answers
38 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? ...
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

### How to symbolically solve the minimization problem in simple linear regression

I want to use mathematica to symbolically solve the minimization problem in simple linear regression: {\text{Find }}\text{arg}\min _{\alpha ,\,\beta }Q(\alpha ,\beta ),\qquad {\text{for }}Q(\alpha ,...
1answer
123 views

### Finding Maximum Value of ElectricField in a bounded region

I have been trying to find the maximum value of the magnitude of an electric field in a bounded region. NDSolve gives the value of the potential inside the region ...
1answer
79 views

### How to speed up this code with NMaximize?

I want to maximize the expected exponential growth rate of the portfolio, which contains 3 stocks. I get the adjusted stock price for General Electric, Du Pont, and IBM. ...
0answers
63 views

### CVaR Portfolio Optimization

I am looking for help on CVaR Portfolio Optimization based on the article . I have to solve the following problem: CVaR cannot be negative by design. Therefore, (a)+ is defined as max(a, 0). Withe ...
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
89 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 ...
7answers
564 views

### how to get $n$ equidistributed points on the unit sphere

We can get $n$ equidistributed points in the unit circle using CirclePoints. But how do you get $n$ equidistributed points on the unit sphere(surface of a ball)? ...
1answer
112 views

### Is the MMA formulation correct?

Let $H$ be a $4\times 8$ matrix and $R$ is a vector of 2 elements. ...
0answers
86 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
116 views

...
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
98 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
61 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
33 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 ...
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 ...
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 ...
2answers
65 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
47 views

### Numerical evaluation of large number of constraints in nminimize at each step [closed]

I am trying to solve an optimization problem with complicated constraints which can be computed only numerically. I have written a module that computes lhs of these constraints. Now I need to tell ...
0answers
34 views

### How to make FindMiniumum work with delayed function and NIntegrate [duplicate]

I can plot my function penalty[v] just fine, but FindMinimum doesn't work, it just complains non-numerical values from ...
1answer
62 views

### Finding a maximum of a Bézier function

Suppose I have a Bézier function $f:\mathbb{R}^2\to\mathbb{R}$ with random coefficients: ...
3answers
141 views

### Locally Weighted Linear Regression

I am following the online Stanford Course in Machine Learning and I am trying to implement the algorithms on the fly in Mathematica. Currently, I have issues with minimizing the Locally Weighted ...
0answers
24 views

### Question about finding the minimum for self-defined function

My self-defined function is too complicated to paste here, and it works well with numerical values assigned. Basically, I have something like this , which contains 12 parameters. With numerical values,...
0answers
123 views

### Solve a certain optimization problem [closed]

I am new user of Mathematica. I want to solve an optimization problem. W = (n (X-Y-Z) p / Z q)^(1/a) where a > 0 I ...
0answers
21 views

...
0answers
56 views

### ShortestTour Problem with Constraints [closed]

I can solve a travelling salesman problem with FindShortestTour[], but couldn't find any function to solve a shorest tour problem with additional constraints like cost, fuel capacity etc. How cam I ...
2answers
148 views

### Using StepMonitor/EvaluationMonitor with DifferentialEvolution in NMinimize

My question about tracking the progress of a minimisation/fitting process is two-fold: 1. The first part of my question can be considered a slight duplicate/follow-up of this question. There the OP ...
0answers
32 views

### Problem with ParametricNDSolve and FindMaximum [closed]

I have a system 4 coupled differential equations: ...
0answers
53 views

### Solving 4 coupled differential equation and minimizing the solution

I have a system of $4$ coupled differential equations. ...
1answer
154 views

### Using Minuit2 to minimize a Mathematica function

FindMinimum is great, but sometimes it is difficult to get an idea of the uncertainties and intermediate evaluation diagnostics. How to define a function in ...
3answers
59 views

### Maximum value of a function using loops

I have a function ab+bc+a/c, where a,b and c ranges from 1 to 5.I have to get an output of maximum value of this function and the values of a,b and c which give that maximum value. Is it possible to ...
0answers
164 views

### FindMinimum doesn't increase step size when necessary

I've spent much time finding a minimal example demonstrating this problem with FindMinimum. Normally one faces this problem when fitting very large and complicated ...
0answers
114 views

### Find coordinate {x, y, z} where two functions are minimal

I am trying to find a point in a ListPointPlot where the total RegionDistance is minimal AND the total differences of the <...
1answer
85 views

### Optimization of the solution to an ODE

Apologies if this is obvious -- I'm very new to Mathematica. I'm trying to minimize the solution to an ODE with respect to a variable. The following code generates the solution to the ODE, ...
0answers
55 views

### Minimize: which algorithm is in use?

How can I know which algorithm has been used by Minimize to solve a given problem? Can I force Minimize to use a specific ...
1answer
48 views

### Finding parameters with NMinimize doesn't do any steps

To find the best fit for an SVM, I have to constantly re-train my classifier with different parameters based on the result of the test set. I created a helper function which trains the SVM with the ...
0answers
39 views

### NMinimize to Optimize Parameters for Quarter Car Model

I am very new to Mathematica and am trying to simulate a mountain bike suspension by using a quarter-car model and I have input a displacement vs time road profile for two bumps for the excitation. ...
1answer
68 views

### Double summation nminimize

Please help me... ...