Monte Carlo method to find minimum value of a function












0












$begingroup$


As far as I understand the Monte Carlo methods from a non-rigourous point of view because unfortunately I didn't study mathematics formally.



For example to find a minimum value of a function $f(x)$ in a given interval $[a,b]$:




  • Generate $N$ uniform random numbers in the interval $ale x_ilt b,$ for $i=1, cdots N$ .

  • Evaluate $f(x_i)$ for $i=1, cdots N$.

  • The minimum value, $m$, of $f(x)$ in the given interval is: $m= text{min}(f(x_1),f(x_2), cdots, f(x_N))$.


For $N$ sufficiently large we get the approximate value of $m$. if we fix $N$ and run the algorithm $n$ times the values $m_k$ tend to follow a normal distribution for $k = 1, cdots, n$



But in the following example I get only half of the normal distribution
$$f(x) = (x-3)^2+5$$
in the interval $[1, 8]$, with $N=1000$ and $n=10000$ I get something like this: histogram of m



Could you tell me mathematically which cases we do not get normal distribution of $m_k$ values but only the half normal distribution as shown in the histogram above?
(By the halves, I mean the the two parts of the histogram/normal distribution graph symmetric about the mean value.



Edit: Please notice that $n neq N$. $N$ is the number of random numbers while $n$ is the number of times running the algorithm for a fixed $N$.



Thank you










share|cite|improve this question











$endgroup$












  • $begingroup$
    Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
    $endgroup$
    – copper.hat
    Jan 22 at 17:19












  • $begingroup$
    The distribution will depend on the shape of $f$.
    $endgroup$
    – user121049
    Jan 22 at 17:55










  • $begingroup$
    @copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:48












  • $begingroup$
    @user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:49










  • $begingroup$
    It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
    $endgroup$
    – copper.hat
    Jan 22 at 18:55


















0












$begingroup$


As far as I understand the Monte Carlo methods from a non-rigourous point of view because unfortunately I didn't study mathematics formally.



For example to find a minimum value of a function $f(x)$ in a given interval $[a,b]$:




  • Generate $N$ uniform random numbers in the interval $ale x_ilt b,$ for $i=1, cdots N$ .

  • Evaluate $f(x_i)$ for $i=1, cdots N$.

  • The minimum value, $m$, of $f(x)$ in the given interval is: $m= text{min}(f(x_1),f(x_2), cdots, f(x_N))$.


For $N$ sufficiently large we get the approximate value of $m$. if we fix $N$ and run the algorithm $n$ times the values $m_k$ tend to follow a normal distribution for $k = 1, cdots, n$



But in the following example I get only half of the normal distribution
$$f(x) = (x-3)^2+5$$
in the interval $[1, 8]$, with $N=1000$ and $n=10000$ I get something like this: histogram of m



Could you tell me mathematically which cases we do not get normal distribution of $m_k$ values but only the half normal distribution as shown in the histogram above?
(By the halves, I mean the the two parts of the histogram/normal distribution graph symmetric about the mean value.



Edit: Please notice that $n neq N$. $N$ is the number of random numbers while $n$ is the number of times running the algorithm for a fixed $N$.



Thank you










share|cite|improve this question











$endgroup$












  • $begingroup$
    Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
    $endgroup$
    – copper.hat
    Jan 22 at 17:19












  • $begingroup$
    The distribution will depend on the shape of $f$.
    $endgroup$
    – user121049
    Jan 22 at 17:55










  • $begingroup$
    @copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:48












  • $begingroup$
    @user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:49










  • $begingroup$
    It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
    $endgroup$
    – copper.hat
    Jan 22 at 18:55
















0












0








0





$begingroup$


As far as I understand the Monte Carlo methods from a non-rigourous point of view because unfortunately I didn't study mathematics formally.



For example to find a minimum value of a function $f(x)$ in a given interval $[a,b]$:




  • Generate $N$ uniform random numbers in the interval $ale x_ilt b,$ for $i=1, cdots N$ .

  • Evaluate $f(x_i)$ for $i=1, cdots N$.

  • The minimum value, $m$, of $f(x)$ in the given interval is: $m= text{min}(f(x_1),f(x_2), cdots, f(x_N))$.


For $N$ sufficiently large we get the approximate value of $m$. if we fix $N$ and run the algorithm $n$ times the values $m_k$ tend to follow a normal distribution for $k = 1, cdots, n$



But in the following example I get only half of the normal distribution
$$f(x) = (x-3)^2+5$$
in the interval $[1, 8]$, with $N=1000$ and $n=10000$ I get something like this: histogram of m



Could you tell me mathematically which cases we do not get normal distribution of $m_k$ values but only the half normal distribution as shown in the histogram above?
(By the halves, I mean the the two parts of the histogram/normal distribution graph symmetric about the mean value.



Edit: Please notice that $n neq N$. $N$ is the number of random numbers while $n$ is the number of times running the algorithm for a fixed $N$.



Thank you










share|cite|improve this question











$endgroup$




As far as I understand the Monte Carlo methods from a non-rigourous point of view because unfortunately I didn't study mathematics formally.



For example to find a minimum value of a function $f(x)$ in a given interval $[a,b]$:




  • Generate $N$ uniform random numbers in the interval $ale x_ilt b,$ for $i=1, cdots N$ .

  • Evaluate $f(x_i)$ for $i=1, cdots N$.

  • The minimum value, $m$, of $f(x)$ in the given interval is: $m= text{min}(f(x_1),f(x_2), cdots, f(x_N))$.


For $N$ sufficiently large we get the approximate value of $m$. if we fix $N$ and run the algorithm $n$ times the values $m_k$ tend to follow a normal distribution for $k = 1, cdots, n$



But in the following example I get only half of the normal distribution
$$f(x) = (x-3)^2+5$$
in the interval $[1, 8]$, with $N=1000$ and $n=10000$ I get something like this: histogram of m



Could you tell me mathematically which cases we do not get normal distribution of $m_k$ values but only the half normal distribution as shown in the histogram above?
(By the halves, I mean the the two parts of the histogram/normal distribution graph symmetric about the mean value.



Edit: Please notice that $n neq N$. $N$ is the number of random numbers while $n$ is the number of times running the algorithm for a fixed $N$.



Thank you







monte-carlo






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 22 at 21:23









copper.hat

127k559160




127k559160










asked Jan 22 at 17:08









IamNotaMathematicianIamNotaMathematician

33




33












  • $begingroup$
    Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
    $endgroup$
    – copper.hat
    Jan 22 at 17:19












  • $begingroup$
    The distribution will depend on the shape of $f$.
    $endgroup$
    – user121049
    Jan 22 at 17:55










  • $begingroup$
    @copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:48












  • $begingroup$
    @user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:49










  • $begingroup$
    It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
    $endgroup$
    – copper.hat
    Jan 22 at 18:55




















  • $begingroup$
    Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
    $endgroup$
    – copper.hat
    Jan 22 at 17:19












  • $begingroup$
    The distribution will depend on the shape of $f$.
    $endgroup$
    – user121049
    Jan 22 at 17:55










  • $begingroup$
    @copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:48












  • $begingroup$
    @user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
    $endgroup$
    – IamNotaMathematician
    Jan 22 at 18:49










  • $begingroup$
    It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
    $endgroup$
    – copper.hat
    Jan 22 at 18:55


















$begingroup$
Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
$endgroup$
– copper.hat
Jan 22 at 17:19






$begingroup$
Broadly, Monte Carlo methods are for estimating the value of expectations. It is not clear how this would be adapted to find a $min$, nor why $m$ would have a normal distribution. Clearly all values must be $ge$ the actual $min$.
$endgroup$
– copper.hat
Jan 22 at 17:19














$begingroup$
The distribution will depend on the shape of $f$.
$endgroup$
– user121049
Jan 22 at 17:55




$begingroup$
The distribution will depend on the shape of $f$.
$endgroup$
– user121049
Jan 22 at 17:55












$begingroup$
@copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
$endgroup$
– IamNotaMathematician
Jan 22 at 18:48






$begingroup$
@copper.hat Why it is not clear? it's clear that it gives the minimum if the appropriate interval $[a,b]$ is chosen.
$endgroup$
– IamNotaMathematician
Jan 22 at 18:48














$begingroup$
@user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
$endgroup$
– IamNotaMathematician
Jan 22 at 18:49




$begingroup$
@user121049 Could you give more details? could you explain why I do get that shape of distribution for the given example?
$endgroup$
– IamNotaMathematician
Jan 22 at 18:49












$begingroup$
It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
$endgroup$
– copper.hat
Jan 22 at 18:55






$begingroup$
It is nothing to do with Monte Carlo. You are just looking at the distribution of $min_{kle N} x_k$. Why would you expect this to be normal?
$endgroup$
– copper.hat
Jan 22 at 18:55












1 Answer
1






active

oldest

votes


















0












$begingroup$

This is not Monte Carlo, you do not compute any expectation. What you are doing is throwing darts randomly and hoping you will get (close to) the minimum. Let us assume that you are ok with finding a point that yields something within a threshold of the minimum. Now let the set corresponding to anything below this threshold have 'volume' $V$, and let the domain in which you throw your (uniformly distributed) samples have 'volume' $M$. Then the probability that a sample will fall within that threshold is $V/M$. You can compute how many samples (on average) you need before the first success which is the expectation of the geometric distribution, in this case $M/V$.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But in this video he uses the name Monte Carlo method
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 14:27










  • $begingroup$
    @IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:30










  • $begingroup$
    I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 17:46










  • $begingroup$
    @IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:48











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3083416%2fmonte-carlo-method-to-find-minimum-value-of-a-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

This is not Monte Carlo, you do not compute any expectation. What you are doing is throwing darts randomly and hoping you will get (close to) the minimum. Let us assume that you are ok with finding a point that yields something within a threshold of the minimum. Now let the set corresponding to anything below this threshold have 'volume' $V$, and let the domain in which you throw your (uniformly distributed) samples have 'volume' $M$. Then the probability that a sample will fall within that threshold is $V/M$. You can compute how many samples (on average) you need before the first success which is the expectation of the geometric distribution, in this case $M/V$.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But in this video he uses the name Monte Carlo method
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 14:27










  • $begingroup$
    @IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:30










  • $begingroup$
    I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 17:46










  • $begingroup$
    @IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:48
















0












$begingroup$

This is not Monte Carlo, you do not compute any expectation. What you are doing is throwing darts randomly and hoping you will get (close to) the minimum. Let us assume that you are ok with finding a point that yields something within a threshold of the minimum. Now let the set corresponding to anything below this threshold have 'volume' $V$, and let the domain in which you throw your (uniformly distributed) samples have 'volume' $M$. Then the probability that a sample will fall within that threshold is $V/M$. You can compute how many samples (on average) you need before the first success which is the expectation of the geometric distribution, in this case $M/V$.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But in this video he uses the name Monte Carlo method
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 14:27










  • $begingroup$
    @IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:30










  • $begingroup$
    I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 17:46










  • $begingroup$
    @IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:48














0












0








0





$begingroup$

This is not Monte Carlo, you do not compute any expectation. What you are doing is throwing darts randomly and hoping you will get (close to) the minimum. Let us assume that you are ok with finding a point that yields something within a threshold of the minimum. Now let the set corresponding to anything below this threshold have 'volume' $V$, and let the domain in which you throw your (uniformly distributed) samples have 'volume' $M$. Then the probability that a sample will fall within that threshold is $V/M$. You can compute how many samples (on average) you need before the first success which is the expectation of the geometric distribution, in this case $M/V$.






share|cite|improve this answer









$endgroup$



This is not Monte Carlo, you do not compute any expectation. What you are doing is throwing darts randomly and hoping you will get (close to) the minimum. Let us assume that you are ok with finding a point that yields something within a threshold of the minimum. Now let the set corresponding to anything below this threshold have 'volume' $V$, and let the domain in which you throw your (uniformly distributed) samples have 'volume' $M$. Then the probability that a sample will fall within that threshold is $V/M$. You can compute how many samples (on average) you need before the first success which is the expectation of the geometric distribution, in this case $M/V$.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Jan 22 at 22:35









lightxbulblightxbulb

1,125311




1,125311












  • $begingroup$
    But in this video he uses the name Monte Carlo method
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 14:27










  • $begingroup$
    @IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:30










  • $begingroup$
    I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 17:46










  • $begingroup$
    @IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:48


















  • $begingroup$
    But in this video he uses the name Monte Carlo method
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 14:27










  • $begingroup$
    @IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:30










  • $begingroup$
    I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
    $endgroup$
    – IamNotaMathematician
    Jan 23 at 17:46










  • $begingroup$
    @IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
    $endgroup$
    – lightxbulb
    Jan 23 at 17:48
















$begingroup$
But in this video he uses the name Monte Carlo method
$endgroup$
– IamNotaMathematician
Jan 23 at 14:27




$begingroup$
But in this video he uses the name Monte Carlo method
$endgroup$
– IamNotaMathematician
Jan 23 at 14:27












$begingroup$
@IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
$endgroup$
– lightxbulb
Jan 23 at 17:30




$begingroup$
@IamNotaMathematician there is no consensus on the exact definition, but what you are doing could at best be considered a Monte Carlo simulation, and at worst random dart throwing.
$endgroup$
– lightxbulb
Jan 23 at 17:30












$begingroup$
I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
$endgroup$
– IamNotaMathematician
Jan 23 at 17:46




$begingroup$
I am so confused, the video says literally this is a Monte carlo method but in your answer you say it is not Monte Carlo method!!!!!!!!!!!!!!!
$endgroup$
– IamNotaMathematician
Jan 23 at 17:46












$begingroup$
@IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
$endgroup$
– lightxbulb
Jan 23 at 17:48




$begingroup$
@IamNotaMathematician A monte carlo method involves averaging samples in order to approximate the expectation. Nothing of the sort is done in your case.
$endgroup$
– lightxbulb
Jan 23 at 17:48


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3083416%2fmonte-carlo-method-to-find-minimum-value-of-a-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith