mathematica 的奇技淫巧

更方便的积分

Unprotect[Integrate];
Integrate[expr_]:=Integrate[expr,##]&@@Variables[expr/.Equal->List//Flatten;
Protect[Integrate];

缺省时自动捕捉变量(by 深蓝)


更方便的 Solve

    Unprotect[Solve];
    Solve[expr_]:=Solve[expr,Variables[expr/.Equal->List//Flatten]]
    Protect[Solve];

缺省时自动捕捉变量(by 深蓝)


求解框符

    CurrentValue[EvaluationNotebook[],{InputAliases,"Solve"}]=TemplateBox[{"[SelectionPlaceholder]"},"Solve",DisplayFunction->([email protected]{#1,OverscriptBox["[LongRightArrow]",[email protected]"求解"]}&)]/.s[e_]->StyleBox[e,Black,Plain,FontFamily->"宋体"];

ESC Sol TAB(by Flaribbit)


函数和图像同色

    Plot[Style[x, Red], {x, 0, 5}]

接着选中 Style[x, Red] ,右键,在当前位置计算。(by Flaribbit)


封装函数来魔改函数

模式一

f1[name_]:=Block[
{},
Unprotect[name];
name[expr_]:=name[expr,##]&@Variables[expr/.Equal->List//Flatten];
Protect[name];
]
f1[Maximize]
-x^2-y^2//Maximize

效果为 Maximize[-x^2-y^2,{x,y}]

模式二

f1[name_]:=Block[
{},Unprotect[name];
name[expr_]:=name[expr,##]&@@Variables[expr/.Equal->List//Flatten];
Protect[name];
]
f1[Integrate]
-x^2-y^2//Integrate

效果为 Integrate[-x^2-y^2,x,y]