How to find minima of a function of several variables using second derivative test

How to find maxima and minima using second derivative test

algorithms – Minimal modification of sequence that removes all local minima

Consider a trail as a sequence of land heights representing the elevation along the trail. A pit is any position in the trail surrounded by higher terrain on both sides.
For example, in the sequence (1000, 600, 1700, 900, 900, 1400, 600), positions 1, 3 and 4 are all pits (elevations 600, 900 and 900 respectively).

We would like to fix the trail such that it includes no pits, but we wish to do it with the minimal amount of additional sand units. In the example above the solution would be: (1000, 1000, 1700, 1400, 1400, 1400, 600). We added a total of 400+500+500=1400 sand units.


  • The sequence length $n$ may be large
  • Terrain levels are always in the range $(0, k)$, where $k$ is much smaller than $n$.

How do I solve this efficiently?

algorithms – How are randomized restarts in local search 4 times likely to give bad local minima?

I am reading section 9.3.3 Dealing with local optima in Algorithms by Dasgupta et al. and the authors mention that in randomized restarts, it is four times likely to end up with a bad solution. They, then in the next sentence, imply that this a good thing as there will be fewer repetitions needed. Here’s the text for context and the referenced figure. The next citation block contains the crux of my question.

Figure 9.10 shows a small instance of graph partitioning, along with the search space of solutions. There are a total of $ {8choose 4}= 70$possible states, but since each of them has an identical twin in which the left and right sides of the cut are flipped, in effect there are just 35 solutions.In the figure, these are organized into seven groups for readability. There are five local optima, of which four are bad, with cost 2, and one is good, with cost 0.

Figure 9.10

If local search is started at a random solution, and at each step a random neighbor of lower cost is selected, then the search is at most four times as likely to wind up in a bad solution than a good one. Thus only a small handful of repetitions is needed.

  1. How do you end up with the multiple of 4?
  2. How is it that the chance
    of picking a bad solution being 4 times as likely a good thing? How
    does this translate to needing fewer repetitions?

maxima minima – Morphological Closing. Formula understanding

I am trying to do use the morphological closing operation on a greyscaled image. As I found out closing is a combination of dilation and erosion.
Now I am trying to understand the formulas of dilation and erosion.
The formula of dilation is
left( A bigoplus X right)left( x,y right) = max left{ A left( x+s,y+t right)+ Xleft(s,t right) right}

I dont unterstand what s and t should be? Is it a max over s and t? And s and t are coordinates of image pixels? But if so, is it a max over the whole image or just over the neighborhood of (x,y)?

Mudar a API mínima do Android

Meu aplicativo está sendo feito para executar na API 29… Coloquei para que a versão mínima seja a API 20, mas quando instalo em um celular com android 5.0 da erro e nao abre… como proceder?

mysql – Query para retornar quantidade minima de valores “diferentes”

Tenho uma tabela chamada clientes e essa tabela tem uma coluna status que pode ter +/- 3 tipos (novo, cancelado, pendente...)

preciso exibir uma quantidade de informações separadas por status, e ao invés de fazer isso com 3 queries, sendo um where para cada status, gostaria de saber se é possível numa só query retornar os 3 status com uma quantidade minima de cada um deles:

Exemplo atual:

Cliente::where('status', 'novo')->take(20)->get();
Cliente::where('status', 'cancelado')->take(20)->get();
Cliente::where('status', 'pendente')->take(20)->get();

é possível, em uma só query, retornar 20 resultados para cada status diferente?

matrices – Unir dos coordenadas de una matriz usando distancia mínima con R

Estoy trabajando en un proceso de completación (no estoy seguro si es el término correcto) de una matriz basada en dos coordenadas de preferencia considerando la distancia mínima, me explico.

Tengo una matriz de nxm (filas y columnas), de valores NA y 1 ver figura 1:

introducir la descripción de la imagen aquí

El objetivo es:

  1. Encuentre los puntos extremos de los elementos contiguos que están unidos por una distancia igual a 1 (adyacente en la horizontal y vertical) o 1.4142 (adyacente en la diagonal). Las coordenadas extremas en el ejemplo están representadas por los rectángulos de la figura 1.

  2. Después de ubicar las coordenadas extremas de los grupos que tengas las distancias indicadas en el punto uno, se requiere completar las coordenadas que permita unir los dos extremos “de preferencia” considerar la distancia mínima entre los dos puntos. (ver líneas en la figura 1)

Suponiendo que encuentro las coordenadas extremas (a y b, ver figura 2), estoy tratando de usar la ecuación vectorial de una línea:

introducir la descripción de la imagen aquí

completa <- function(a, b, k){
  x <- y <- NULL
  resta <- b - a
  u_ba <- resta / sqrt(sum(resta^2))
  for (i in seq(0, 1, k)) {
    posi <- a + i * u_ba
    x <- c(x, posi(1))
    y <- c(y, posi(2))
  coordenadas  <- cbind(x, y)

La matriz de ejemplo está en:

data_mat <- read.csv ("")

considerando como ejemplo las coordenadas a y b
a <- c (25, 6)
b <- c (20, 10)

Al utilizar la función con las coordenadas con k = 0.5 (el valor de k puede variar entre 0 y 1), se obtiene lo siguiente:

completa (a, b, 0.5)
# x y
# (1,) 25 6
# (2,) 25 6
# (3,) 24 7

pero el resultado esperado es:

# x y
# (1,) 25 6
# (2,) 24 7
# (3,) 23 8
# (4,) 22 9
# (5,) 21 10 # o 21 9,
# (6,) 20 10

Es evidente que existe más de una solución para la línea, por lo que comentar que se puede considerar de preferencia la distancia mínima.

Finalmente, luego de tener estas coordenadas, solo bastaría con asignarles un valor igual a uno. La idea principal es hacer que este proceso sea recursivo. Y que al final se pueden unir todas las coordenadas de la matriz.

Por favor, cualquier sugerencia es bienvenida, gracias.

maxima minima – Find the maximum value of the integral

$f:(0,1) longrightarrow (-1,1)$
Be a onto function with the property that
Then we have to find the maximum value of the integral
My attempt as $f$ is onto its range must be $(-1,1)$ but I can’t proceed further please give hints no solution

calculus of variations – Why are the two infima actually minima?

Let $ L: mathbb {T} ^ d times mathbb {R} ^ d mapsto mathbb {R} $ to be a Lagrangian on the $ d $-Dimensional standard toroid time $ mathbb {R} ^ d $. Let $ alpha> 0 $, the optimal control problem at infinite horizon is to minimize
u _ { alpha} (x) = inf _ { textbf {x}: textbf {x} (0) = x} int _ {- infty} ^ {0} e ^ { alpha s} L ( textbf {x}, dot { textbf {x}}) text {d} s,

amang all Lipschitz trajectories in the world $ mathbf {x} $ with initial condition $ mathbf {x} (0) = x $. Let $ T in mathbb {R} $, the initial value problem, consist in minimizing
V (x, t) = inf _ { textbf {x}: textbf {x} (t) = x} int _ {- T} ^ {t} L ( textbf {x}, dot { textbf {x}}) text {d} s + psi ( textbf {x} (- T)),

for $ t geq -T $, amang all Lipschitz trajectories in the world $ mathbf {x} $ with initial condition $ mathbf {x} (t) = x $.

This function satisfies dynamic programming principlethat is to say for everything $ T> 0 $,

u _ { alpha} (x) = inf _ { textbf {x}: textbf {x} (0) = x} left ( int _ {- T} ^ {0} e ^ { alpha s} L ( textbf {x}, dot { textbf {x}}) text {d} s + e ^ {- alpha T} u _ { alpha} ( textbf {x} (- T )) right).

V (x, t) = inf _ { textbf {x}: textbf {x} (t) = x} left ( int _ {- tilde {t}} ^ {t} L ( textbf {x}, dot { textbf {x}}) text {d} s + V ( textbf {x} (- tilde {t}), – tilde {t}) right),

for everyone $ -T leq – tilde {t} leq t. $

I have to prove that the two infima are in fact minimaand i try to use the compactness torus and some variation calculation argument, but I can't do anything.

Thank you!

st.statistics – Are there any known results in the literature on empirical and theoretical minima for likelihood estimators?

I'm working on a problem in my research where I want to estimate a parameter $ theta $ from samples $ x_i, z_i, , {1 leq i leq n } $. For each $ x_i $, we also observe the probability $ z_i $. In reality, $ l $ is the likelihood function, so $ l (x_i, theta) $ gives us the real probability of seeing $ x_i $ if our model $ theta $ as the underlying parameter.

Let $ hat { theta} _n = arg min _ { theta} sum_ {i = 1} ^ n (l (x_i, theta) -z_i) ^ 2 $, our estimate of $ theta $ of our samples using a square error (we could use a different error if necessary).

Are there any results in the literature where they provide limits on $ left | hat { theta} _n- theta right | $? Or better yet, some results on the behavior of $ hat { theta} _n $? This is not an M-estimator so it is not as easy of a problem as I originally thought …