# What is the default value of MaxFunctionCalls()

**URL:** <https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794>\
**Category:** Newbie\
**Tags:** root\
**Created:** [January 30, 2025, 6:46am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794 "2025-01-30T06:46:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [January 30, 2025, 6:46am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/1 "2025-01-30T06:46:20Z")

</div>

Dear experts

I wonder what is the number of `MaxFunctionCalls()` in `ROOT::Math::Minimizer` and should I set it manually?

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [January 30, 2025, 7:36am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/2 "2025-01-30T07:36:19Z")

</div>

```cpp
std::cout << MaxFunctionCalls() << std::endl;

```

[https://root.cern.ch/doc/master/classROOT\_1\_1Math\_1\_1Minimizer.html#aabbadaa76bb5723fcaec0eb7d40850b2](https://root.cern.ch/doc/master/classROOT_1_1Math_1_1Minimizer.html#aabbadaa76bb5723fcaec0eb7d40850b2)

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [January 30, 2025, 7:37am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/3 "2025-01-30T07:37:12Z")

</div>

This will return 0 and in the source code it says “Remain default” but I don’t know what number is the “default”

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [January 30, 2025, 7:37am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/4 "2025-01-30T07:37:48Z")

</div>

@moneta

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [January 31, 2025, 2:11am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/5 "2025-01-31T02:11:08Z")

</div>

Thank you for pointing to some experts! And in addition I wonder what is the default value of `ROOT::Math::Minimizer::Precision()`, maybe some experts can point me to some page that explains every default value.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [February 3, 2025, 6:53am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/6 "2025-02-03T06:53:53Z")

</div>

Any suggestions…?

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [February 6, 2025, 9:18am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/7 "2025-02-06T09:18:57Z")

</div>

Keep this topic alive…

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [February 6, 2025, 10:56am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/8 "2025-02-06T10:56:44Z")

</div>

Did you try with:

`MinimizerOptions::Print(cout)` ?

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [May 8, 2025, 6:24am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/9 "2025-05-08T06:24:55Z")

</div>

This also returns 0 for maxFuncCall, and -1 for precision.

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [May 8, 2025, 6:33am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/10 "2025-05-08T06:33:28Z")

</div>

OK, I found it in the source code of `ROOT::Math::Minuit2Minimizer::Minimize()`:

> **[ROOT: math/minuit2/src/Minuit2Minimizer.cxx Source File](https://root.cern.ch/doc/master/Minuit2Minimizer_8cxx_source.html)**

```auto
  492 int maxfcn_used = maxfcn;
  493 if (maxfcn_used == 0) {
  494 int nvar = fState.VariableParameters();
  495 maxfcn_used = 200 + 100 * nvar + 5 * nvar * nvar;
  496 }

```

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 8, 2025, 7:15am UTC](https://root-forum.cern.ch/t/what-is-the-default-value-of-maxfunctioncalls/62794/11 "2025-05-08T07:15:01Z")

</div>

Thanks for finding out!

I opened: [[skip-ci][nfc][math] Improve docu wrt max function calls in Minuit2 by ferdymercury · Pull Request #18656 · root-project/root · GitHub](https://github.com/root-project/root/pull/18656)  
to improve the HTML documentation
