这类图在Mathematica里的简单高效的画法几乎可以说是有定论的。明明是公开的讨论却总是无法传承也是搞得我心塞:
http://tieba.baidu.com/p/2776245919?pid=43465289339&cid=0#43465289339
http://tieba.baidu.com/p/2504432886?pid=36525064381&cid=36526175919#36526175919
http://tieba.baidu.com/p/3517568789
http://tieba.baidu.com/p/2578898520
----
算了,贴个通用解法,想抄就抄吧:
Clear[equationPlot, gradEquationPlot, approxEquationPlot]
equationPlot[type___][expr : Except[{__}], rest__] := equationPlot[type][{expr}, rest];
equationPlot[type___][eqn : {HoldPattern@Equal[_, _] ..}, rest__] :=
equationPlot[type][Subtract @@@ eqn, rest];
findZero["grad"] := Abs@Differences[# // UnitStep, {0, 1}] &;
findZero["approx", limit_: 1/100] :=
Function[(1 - UnitStep[-limit - #]) (1 - UnitStep[-limit + #])];
equationPlot[type : "grad" | "approx" : "approx", limit___][
expr_, {x_, xl_, xr_}, {y_, yl_, yr_}, step_: 1/100, prec_: MachinePrecision] :=
With[{rx = Range[xl, xr, N[step, prec]], ry = Range[yl, yr, N[step, prec]],
rcolor = Range@Length@expr},
ContourPlot[False, {x, xl, xr}, {y, yl, yr}]~Show~
ArrayPlot[rcolor findZero[type, limit][
Function[{x, y}, expr][#, ry] & /@ rx // Transpose] // Total,
DataReversed -> True, DataRange -> {{xl, xr}, {yl, yr}},
ColorRules -> (# -> ColorData[1][#] & /@ rcolor)]];
gradEquationPlot = equationPlot["grad"];
approxEquationPlot = equationPlot["approx"];
equationPlot["approx", 1/10][
E^(Sin[x] + Cos[y]) == Sin[E^(x + y)], {x, -10, 10}, {y, -10, 10}, 1/100]
gradEquationPlot[E^(Sin[x] + Cos[y]) == Sin[E^(x + y)], {x, -10, 10}, {y, -10, 10}]