Method
是一个选项,对多种复杂运算函数指定应该使用的内部运算方法.
范例
打开所有单元 关闭所有单元基本范例 (2)
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"]NDSolve[{x''[t] + (2 + Sin[x[t]]) x[t] == 0, x[0] == 1, x'[0] == 0}, x, {t, 0, 10}, Method -> "ExplicitRungeKutta"]Plot[Evaluate[First[{x[t], x'[t]} /. %]], {t, 0, 10}]范围 (4)
FindRoot[{x - 1, 10(y - x ^ 2)}, {{x, -1}, {y, 1}}, Method -> {"Newton", "StepControl" -> "TrustRegion"}]在求解这个问题上,这种方式比用默认的步长控制法减小了运算量:
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]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"}}]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[Evaluate[First[x[t] /. %]], {t, 0, end}]用 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 -> {"Projection", "Invariants" -> {x'[t] ^ 2 - 2 Cos[x[t]]}, Method -> {"Extrapolation", Method -> "ExplicitMidpoint"}}}]历史
1999年引入 (4.0) | 在以下年份被更新:2007 (6.0)
文本
Wolfram Research (1999),Method,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Method.html (更新于 2007 年).
CMS
Wolfram 语言. 1999. "Method." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2007. https://reference.wolfram.com/language/ref/Method.html.
APA
Wolfram 语言. (1999). Method. Wolfram 语言与系统参考资料中心. 追溯自 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: 12-July-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: 12-July-2026]}