|
SOLUTIONS
|
MATHEMATICA 内置符号
TimeConstrained
TimeConstrained[expr, t]
计算 expr,在 t 秒后停止计算.
TimeConstrained[expr, t, failexpr]
如果没有达到时间限制,返回 failexpr.
更多信息更多信息
- 如果计算在指定的时间里没有完成,TimeConstrained 产生一个中断中止 expr 的计算.
- 仅在计算中止时,TimeConstrained 计算 failexpr.
- 如果计算中止且没有指定任何 failexpr 时,TimeConstrained 返回 $Aborted.
- 仅在向下达到至少 $TimeUnit 秒的间隔时,TimeConstrained 是准确的.
- 由 TimeConstrained 产生的终止可以类似 Abort 一样处理,它可以由 AbortProtect 覆盖.
- TimeConstrained[expr, Infinity] 指定无时间限制.
- TimeConstrained 在一个进程中可能对不同的情况给出不同的结果,例如一个内部系统缓存的结果.
- TimeConstrained 仅考虑在主要 Mathematica 内核中消耗的 CPU 时间;它不包括其它的线程或进程.
版本 1 的新功能 | 版本 6 修改功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »

