Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
1answer
23 views

Optimization with constraint or with the constraint embedded into the problem?

I need to find the minimum of a function. However, the condition is that the final state should be normalized i.e. sum of the squares must be one. One way to deal with it is just add the constraint ...
0
votes
0answers
42 views

Linear programming with FindMinimum [on hold]

Need some help. Why on this apparently legitimate code, is there no computation ? Hint the y[.] stay blue. ...
0
votes
2answers
75 views

How to use Levenberg-Marquardt for parameter identification

Imagine I have a function called fun1 that returns a vector of numbers fun1[a,b,c,d,...]:=. ...
1
vote
1answer
43 views

Finding algebraic expression for local minimum of a function with one unassigned variable

I want to find the local minimum in the region 0.5<x<=1 of a function which has an unassigned variable r (note: ...
0
votes
0answers
60 views

How can I find the maximum of my function? [closed]

I have a function given by V = ((e q - k r)^2 - f[r] (L + L^2 + r D[f[r],r]))/r^2 with ...
6
votes
1answer
433 views

Which algorithm does Mathematica use for “RandomSearch”?

Recently I have used Mathematica for minimization of certain functions and I have realized that even though it lasts much longer, the method "RandomSearch" functions much better than the other methods ...
1
vote
0answers
82 views
+100

Finding an optimal location of 2D points?

I have a function f that returns the number of triangles formed by given line segments. For example, in the following case f ...
6
votes
2answers
273 views

FindMinimum: How can I know which method Mathematica has used?

I have been using FindMinimum to find a local minimum of a non-linear function within a constrained region. How can I know which method Mathematica has selected to find the local minimum? Thanks in ...
0
votes
1answer
39 views

FindMaximum wont give the correct solution

So i have this function for witch i made a 3D plot and tried to do a FindMaximum[func,{x,0},{y,0.45}]]search for coordinates x=0 ...
3
votes
3answers
266 views

How to create a fractal tree?

I want to create a fractal tree, using translation and rotation. Code below is working for one level, but when I try loop, it is not giving output. Code is given below: ...
2
votes
1answer
62 views

How to draw a “Y” shaped branch in Mathematica?

I want to draw a Y-shaped branch in Mathematica. I am trying to draw a line of length L. In step II, I want to translate to the ending point of the line. Then I want to rotate at an angle of 45 deg to ...
2
votes
2answers
61 views

“Forcing output of a function to be Real in Mathematica” Non-linear optimization

I am trying to solve a Nonlinear optimization problem with Mathematica. Since the maximization problem includes exponentiation with fractional power, the result generates the complex numbers that stop ...
0
votes
1answer
38 views

Minimizing chi-squared to find unknown value of parameters

X= Sum[(events[[i]] - f[x, a, b])^2/ events[[i]], {i, 1, 40}] I want to minimize X to find the value of a and b. How will i do it?
0
votes
1answer
36 views

Find initial surface to minimize between two close curves

I have two close curves in space defined by $g$ and $h$ with: ...
0
votes
0answers
23 views

Mixed integer programming with FindMinimum

As this works fine ...
2
votes
0answers
24 views

How I can use FindFit to simultaneously fit two data sets to two equations having shared parameters? [duplicate]

I think that FindFit package with the method Nminimize yields global minimum if initial values of adjustable parameters are ...
0
votes
0answers
37 views

solving the game of fiver

Up to an error by myself, the following code is an implementation of the mixed integer linear programming of the game of Fiver : ...
0
votes
1answer
67 views

Non-linear optimization giving error NMaximize::nrnum [closed]

I am trying to solve the following non-linear optimization problem: Here is my code: ...
2
votes
0answers
36 views

FindMinium produces a worse point that the initially provided one [closed]

I am using FindMinimum to get a local minimum to a non-liner function of 50 variables on [0,1]^50 with some additional constraints. I provide FindMinumum with a feasible point which reaches a function ...
1
vote
0answers
22 views

Affine connection with torsion using xAct

I'm working with xAct and I need to obtain the affinne connection with torsion. Without torsion it is easy: ...
3
votes
1answer
54 views

How to build a Neural Network with only categorical variables?

I've built mixed data NN, but I'm trying to build an NN that only has categorical variables. In my problem, I cannot represent my categorical variables using the commonly used ...
0
votes
2answers
51 views

Solving for variable with Gamma and Exponential Function

I am trying to solve for the dl parameter knowing all the remaining variables and as t->Infinity or very large number ...
0
votes
1answer
41 views

Choice of variables name affects the behavior of expression evaluation

I tried to expand this polynomials. With x, it is increasing with the right order, however with b it is in a random order. The only difference is that I change b to x and it works. ...
1
vote
0answers
29 views

Acceptable number of parameters for NMinimize

At the moment I am trying to optimize a fourth order polynomial which contains many parameters. I wanted to ask your opinion based on your experience about what is the acceptable number of parameters ...
0
votes
2answers
57 views

FindMinimum from DensityPlot

I need to find the values of x, y that correspond to the minimum value of the function (in this example it is -1.0, the black area). Code example: ...
1
vote
0answers
31 views

Determine if nonlinear function can be positive subject to nonlinear constraints [closed]

I am trying to determine if a certain nonlinear function can be positive when the variables have to satisfy multiple nonlinear constraints. Currently my code looks like ...
0
votes
0answers
45 views

FindMinimum giving error FindMinimum::infeas:

I'm trying to find the minimum y-coordinate of a point which lies on a side of an equilateral triangle. FindMinimum doesn't work when I change the position of the ...
1
vote
2answers
82 views

Problem with Solve (Lagrange multiplier)

I'm trying to solve a simple maximization problem, which I can easily solve by hand using the Lagrangian method. I want to maximize UH subject to ...
1
vote
2answers
115 views

Discrepancy between Minimize and Nsolve

I was trying to minimize a quartic polyonomial equation with a constraint using Mathematica but I got some conflicting results and I wanted to ask to you. Am I making a conceptual mistake or a coding ...
0
votes
0answers
54 views
5
votes
2answers
144 views

Optimization over a bi-linear function

For the function $$ f(x_1,x_2;a_0,b_0)=\\\small\cases{\frac{1}{2}\left[x_1+x_2-x_1x_2+\left(\frac{-1+b_0(1-a_0)}{a_0}x_1+1\right)\left(\frac{-1+b_0(1-a_0)}{a_0}x_2+1\right)\right],\quad 0 \leq x_1\...
1
vote
1answer
62 views

Plotting a 2D plot along the maxima of a 3D plot

so i have a function $f(x,y)$ (sorry i cannot provide the whole function, it is long transfer matrix function) which i have plotted onto a 3D plot to identify the max values of the function. In ...
1
vote
1answer
43 views

Function of three variables: find optimum value of one variable in a region determined by the other two

I need to find the optimal value of h for which the absolute values of f[x, t, h] are near to zero in the region of ...
0
votes
1answer
38 views

Minimax Optimization Over and Interesting Function

n=2; (i_1,i_2)= i mod 2 for example (0,1)=1 mod 2 or (1,1)=3 mod 2 $$f_i(s_0,s_1)={s_0}^{i_1}{s_1}^{i_2}{(1-s_0)}^{1-i_1}{(1-s_1)}^{1-i_2}$$ $$r(s_0,s_1,x_1,k_1)=...
0
votes
1answer
27 views

Find values that minimize function (by passing list as initial searching points)

I have a cost function and I want to find which variables minimize it using the built-in method FindMinimum My cost function is this (keep in mind that ...
0
votes
1answer
84 views

2nd Order ODE with Optimal Control

I'm trying to solve an ODE where there is an optimal control problem involving a tradeoff between the flow cost c and the drift rate ...
0
votes
0answers
66 views

How to involve more cpu cores?

I'm working on Mathematica 11 (Lenovo Laptop, Core i7 cpu, 16GB Ram, SSD storage, windows 10 pro), part of my work is definite double integral, the evaluation time of this integral takes between 50 to ...
1
vote
1answer
143 views

Solving coupled PDE and ODE

I want to solve a system of partial differential equation in mathematica. equation is: $y0=0.5 t0=30 λ_12=0.3 λ_13=λ_23=0.01 λ_21=2.8$ I am new in mathematica. please help me for solving ...
0
votes
0answers
48 views
2
votes
0answers
49 views

How to interpolate closed surface

With BSplineSurface I was trying to interpolate data points belonging to a sphere, but unfortunately I don't get the right geometry closing: ...
0
votes
1answer
83 views

Minimization of the sums of complicated parametric integrals

I have to find the values of the parametersω and λ that minimize the function Int[ω, λ] ...
1
vote
1answer
36 views

Precision error in FindMinimum

I am trying to solve a system of three non-linear equations for three unknowns (e1, e2, phi). I am using FindMinimum to solve the system (I am minimizing the norm ...
0
votes
1answer
26 views

Minimization of a summation of two functions with respect to two constrained variables

I have a question regarding the minimization of a function, which is a summation of two separate functions, with a discrete list for one of the variables. $S[a,c]= \sqrt{\sum_{b=0,4,8,12,16}{(f[b]-g[...
2
votes
1answer
62 views

How do I use FindMinimum with the LevenbergMarquardt method?

Below is my program. I don't know how to define the function f to make it work. Another question: When I define f as a vector ...
0
votes
0answers
43 views

Am I using FindMinimum correctly?

This is the first time I try to use FindMinimum. Am I using it correctly? Before that, is it always possible to use FindMinimum or Minimize? Here my code: ...
0
votes
0answers
49 views

Fastest way to find roots and reproduce this result

I am trying to solve the following transcendental equation numerically with the given values and to reproduce the diagram attached below. $0=\frac h2\sqrt{\left(\frac{\omega\cdot n_1}c\right)^2-\...
0
votes
0answers
26 views

FindMinimum Error - cvec: Constrained optimization is only supported with scalar valued variables

I want to solve a non-linear equation derived with a forward march finite difference technique (defined as "f" in the code). I am using FindMinimum, since I know an approximate initial value for each ...
0
votes
2answers
31 views

How do I use NMaximize on a Function that contains LinearProgramming?

I am trying to maximize a function that effectively has variable matrix elements that need to be optimized using Linear Programming. Here is my function: ...
2
votes
1answer
148 views

Solving optimal control problem when input is constrained

Given a linear time-invariant system: $$x'(t)=Ax(t)+Bu(t)$$ with initial state $x(0)=x0$ and final state $x(T)=xT$. The performance measure to be minimized is: $$∫_0^Tu(t)^2dt$$ The most important ...