is an option for various algorithm-intensive functions that specifies what internal methods they should use.
Method
is an option for various algorithm-intensive functions that specifies what internal methods they should use.
Details
- Typical settings include:
-
Automatic pick the method automatically "name" use the method with the specified name {"name",opt1->val1,…} use the specified method with particular options {"name1",Method->{"name2",…}} use a method and a submethod {opt1->val1,opt2->val2,…} give options for methods - With the default setting Method->Automatic, the Wolfram Language will automatically try to pick the best method for a particular computation.
Examples
open all close allBasic Examples (2)
Find a nonlinear fit for exponential decay using a quasi-Newton method:
data = {{1.0, 12.}, {1.9, 10.}, {2.6, 8.2}, {3.4, 6.9}, {5.0, 5.9}};model = a Exp[-k t];fit = FindFit[data, model, {a, k}, t, Method -> "QuasiNewton"]Solve a differential equation using an explicit Runge–Kutta method:
NDSolve[{x''[t] + (2 + Sin[x[t]]) x[t] == 0, x[0] == 1, x'[0] == 0}, x, {t, 0, 10}, Method -> "ExplicitRungeKutta"]Plot the solution and its derivative:
Plot[Evaluate[First[{x[t], x'[t]} /. %]], {t, 0, 10}]Scope (4)
Find a root in two dimensions using Newton's method with a trust-region step control:
FindRoot[{x - 1, 10(y - x ^ 2)}, {{x, -1}, {y, 1}}, Method -> {"Newton", "StepControl" -> "TrustRegion"}]This takes fewer evaluations than the default step control for this problem:
Block[{e = 0}, FindRoot[{x - 1, 10(y - x ^ 2)}, {{x, -1}, {y, 1}}, Method -> {"Newton", "StepControl" -> "TrustRegion"}, EvaluationMonitor :> e++];e]Block[{e = 0}, FindRoot[{x - 1, 10(y - x ^ 2)}, {{x, -1}, {y, 1}}, Method -> "Newton", EvaluationMonitor :> e++];e]Number of steps and evaluations for an ODE using Runge–Kutta methods of various order:
TableForm[Table[Block[{e = 0, s = 0}, NDSolve[{x''[t] + (2 + Sin[x[t]]) x[t] == 0, x[0] == 1, x'[0] == 0}, x, {t, 0, 10}, Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> do}, EvaluationMonitor :> e++, StepMonitor :> s++];{do, s, e}], {do, {Automatic, 3, 4, 5, 6, 7, 8, 9}}], TableHeadings -> {{}, {"Difference Order", "Steps", "Evaluations"}}]Use of event location method using a backward differentiation formula base method:
NDSolve[{x''[t] + Sin[x[t]] == 0, x[0] == 3, x'[0] == 0}, x, {t, ∞}, Method -> {"EventLocator", "Event" -> x[t], "EventAction" :> Throw[end = t, "StopIntegration"], Method -> "BDF"}]Plot the solution up to the event
:
Plot[Evaluate[First[x[t] /. %]], {t, 0, end}]Use of event locator with a deeply nested Method option:
NDSolve[{x''[t] + Sin[x[t]] == 0, x[0] == 3, x'[0] == 0}, x, {t, ∞}, Method -> {"EventLocator", "Event" -> x[t], "EventAction" :> Throw[end = t, "StopIntegration"], Method -> {"Projection", "Invariants" -> {x'[t] ^ 2 - 2 Cos[x[t]]}, Method -> {"Extrapolation", Method -> "ExplicitMidpoint"}}}]Related Guides
History
Introduced in 1999 (4.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1999), Method, Wolfram Language function, https://reference.wolfram.com/language/ref/Method.html (updated 2007).
CMS
Wolfram Language. 1999. "Method." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Method.html.
APA
Wolfram Language. (1999). Method. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Method.html
BibTeX
@misc{reference.wolfram_2026_method, author="Wolfram Research", title="{Method}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Method.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_method, organization={Wolfram Research}, title={Method}, year={2007}, url={https://reference.wolfram.com/language/ref/Method.html}, note=[Accessed: 13-June-2026]}