level 4
MMa全书中的一个例子:
nb = SelectedNotebook[];
NotebookWrite[nb, "Expand[(1+x\!\(\*SuperscriptBox[\()\), \(4\)]\)]", \
All]
NotebookApply[nb, "x + 1/\[SelectionPlaceholder]"]
SelectionMove[nb, All, CellContents]
SelectionEvaluate[nb]
运行结果为:
x + 1/(1 + 4 x + 6 x^2 + 4 x^3 + x^4)
2018年01月07日 18点01分
1
level 4
类似的一段代码:
nb = SelectedNotebook[];
NotebookWrite[nb, "10!", All]
SelectionEvaluateCreateCell[nb, All]
NotebookApply[nb, "FactorInteger[\[SelectionPlaceholder]]", All]
运行结果为:
FactorInteger::exact: FactorInteger[\[SelectionPlaceholder]] 中的参数 \[SelectionPlaceholder] 不是一个精确数.
2018年01月07日 18点01分
2
都是将笔记本中高亮部分用函数作用上去,为什么前一个可以,后面一个不行?
2018年01月07日 18点01分
吧务
level 15
……你版本几?我版本9.0.1后一段可以,前一段反而不行。(把前一段的字符串里的代码改成InputForm也行。)
2018年02月03日 11点02分
3
版本11.2
2018年02月03日 12点02分
level 4
像我这种“三天打鱼两天晒网”的人估计是永远学不精MMa了吧?
2018年02月03日 12点02分
4
我倒觉得没几个人能深入到笔记本编程……
2018年02月03日 12点02分