用户:A2569875/沙盒3
- -
__INDEX__
11133311331113331113311331
[[zh-tw:User:A2569875/沙盒3]]
- Mathematica 4、5
Drawing[fn_, {fx_, xmin_, xmax_}, {fy_, ymin_, ymax_}, step_] := Show[Graphics[ RasterArray[ Table[Hue[Arg[fn]/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn] + 1]), 1 - 1/(1.1 + 5 Log[Abs[fn] + 1])], {fy, ymin + 0.0012, ymax, step}, {fx, xmin + 0.0012, xmax, step}]]], AspectRatio -> Automatic, Axes -> True, AxesStyle -> RGBColor[0, 0, 0], Ticks -> {Table[{0.1 + 50 i, xmin + 50 step i, 0.01}, {i, 0, (xmax - xmin)/(50 step)}], Table[{0.1 + 50 i, ymin + 50 step i, 0.01}, {i, 0, (ymax - ymin)/(50 step)}]}, ImageSize -> (20 + (xmax - xmin)/step)]
- Mathematica 6
ComplexGraph[f_, xmin_, xmax_, ymin_, ymax_, points_:100] := (* f is the complex function to be graphed in the region[xmin, xmax] × [ymin, ymax] . The parameter points controls how many points will be sampled in each direction; good values are 100 - 500. *) RegionPlot[True, {x, xmin, xmax}, {y, ymin, ymax}, ColorFunction → Function[ {x, y}, Hue[Mod[Arg[f[x + I * y]], 2Pi]/(2Pi), 1/(1 + 0.3 Log[Abs[f[x + I * y]] + 1]), 1 - 1/(1.1 + 5Log[Abs[f[x + I * y]] + 1])]], ColorFunctionScaling → False, AspectRatio → Automatic, PlotPoints → points]
- Mathematica 7
Options[ComplexPlot3D] = {Mesh -> Automatic, MeshStyle -> Automatic}; ComplexPlot3D[fn_, {fx_, {remin_, remax_}, {immin_, immax_}}, points_: 100, OptionsPattern[]] := Module[{f}, f := Function[fx, fn]; Plot3D[Abs[f[x + I*y]], {x, remin, remax}, {y, immin, immax},ColorFunction -> Function[{x, y, z}, Hue[Mod[Arg[f[x + I*y]], 2 Pi]/(2 Pi), 1, 1]],ColorFunctionScaling -> False, AspectRatio -> Automatic, PlotPoints -> points, Mesh -> OptionValue[Mesh], MeshStyle -> OptionValue[MeshStyle], AxesLabel -> {Re, Im}]]; Options[ComplexPlot] = {Mesh -> None, MeshStyle -> Automatic}; ComplexPlot[fn_, {fx_, {remin_, remax_}, {immin_, immax_}}, points_: 100] := Module[{f}, f := Function[fx, fn]; RegionPlot[True, {x, remin, remax}, {y, immin, immax},ColorFunction -> Function[{x, y}, Hue[Mod[Arg[f[x + I*y]], 2 Pi]/(2 Pi), 1/(1 + 0.3 Log[Abs[f[x + I*y]] + 1]), 1 - 1/(1.1 + 5 Log[Abs[f[x + I*y]] + 1])]], ColorFunctionScaling -> False, AspectRatio -> Automatic, PlotPoints -> points, Mesh -> OptionValue[Mesh], MeshStyle -> OptionValue[MeshStyle]]]
PlotComplex[fz_, {z_, {remin_, immin_}, {remax_, immax_}}, step_] := Module[{fn}, fn[gx_] := fz /. z -> gx; Show[Graphics[ Raster[(*In Mathematica 7,this function,RasterArray,was obsolete, so it always show'RasterArray::obs: RasterArray is obsolete.Translating to Raster. >>' on your \ function graph but it doesn't affect the correctness of the function \ graph anymore.*) Table[fn[fx + I fy], {fy, immin + 0.0012(*This number CAN NOT delete.*), immax, step}, {fx, remin + 0.0012(*This number CAN NOT delete.*), remax, step}], ColorFunction -> Function[{x}, Hue[Mod[Arg[x], 2 \[Pi]]/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[x] + 1]), 1 - 1/(1.1 + 5 Log[Abs[x] + 1])]]]], AspectRatio -> Automatic, Axes -> True, AxesStyle -> RGBColor[0, 0, 0], Ticks -> {Table[{0.1 + 50 i, remin + 50 step i, 0.01}, {i, 0, (remax - remin)/(50 step)}], Table[{0.1 + 50 i, immin + 50 step i, 0.01}, {i, 0, (immax - immin)/(50 step)}]}, ImageSize -> (20 + (remax - remin)/step)]]
PlotComplex[fz_, {z_, {remin_, immin_}, {remax_, immax_}}, step_] := Module[{fn}, fn[gx_] := fz /. z -> gx; Show[Graphics[ RasterArray[(* In Mathematica 7,this function,RasterArray, was obsolete, so it always show 'RasterArray::obs: RasterArray is obsolete. Translating to Raster. >>' on your function graph but it doesn't affect the correctness of the function graph anymore. *) Table[Hue[Mod[Arg[fn[fx + I fy]], 2 \[Pi]]/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn[fx + I fy]] + 1]), 1 - 1/(1.1 + 5 Log[Abs[fn[fx + I fy]] + 1])], {fy, immin + 0.0012(* This number CAN NOT delete. *), immax, step}, {fx, remin + 0.0012(* This number CAN NOT delete. *), remax, step}]]], AspectRatio -> Automatic, Axes -> True, AxesStyle -> RGBColor[0, 0, 0], Ticks -> {Table[{0.1 + 50 i, remin + 50 step i, 0.01}, {i, 0, (remax - remin)/(50 step)}], Table[{0.1 + 50 i, immin + 50 step i, 0.01}, {i, 0, (immax - immin)/(50 step)}]}, ImageSize -> (20 + (remax - remin)/step)]]
Options[PlotComplex] = {Mesh -> None, MeshStyle -> Automatic, WorkingPrecision -> MachinePrecision}; PlotComplex[fz_, {z_, min_, max_}, OptionsPattern[]] := Module[{fn}, fn[gx_] := fz /. z -> gx; RegionPlot[x^2 y^2 > 0, {x, -2, 2}, {y, -2, 2}, ColorFunction -> Function[{x, y}, Hue[Mod[Arg[fn[-max + max x - min x + I (-max + max y - min y)]], 2 \[Pi]]/(2 \[Pi]), 1/(1 + 0.3 Log[ Abs[fn[-max + max x - min x + I (-max + max y - min y)]] + 1]), 1 - 1/(1.1 + 5 Log[Abs[ fn[-max + max x - min x + I (-max + max y - min y)]] + 1])]], Mesh -> OptionValue[Mesh], MeshStyle -> OptionValue[MeshStyle], WorkingPrecision -> OptionValue[WorkingPrecision]]];
PlotComplex[fz_, {z_, {remin_, immin_}, {remax_, immax_}}, step_] := Module[{fn}, fn[gx_] := fz /. z -> gx; Show[Graphics[ RasterArray[ Table[Hue[Mod[Arg[fn[fx + I fy]], 2 \[Pi]]/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn[fx + I fy]] + 1]), 1 - 1/(1.1 + 5 Log[Abs[fn[fx + I fy]] + 1])], {fy, immin + 0.0012, immax, step}, {fx, remin + 0.0012, remax, step}]]], AspectRatio -> Automatic, Axes -> True, AxesStyle -> RGBColor[0, 0, 0], Ticks -> {Table[{0.1 + 50 i, remin + 50 step i, 0.01}, {i, 0, (remax - remin)/(50 step)}], Table[{0.1 + 50 i, immin + 50 step i, 0.01}, {i, 0, (immax - immin)/(50 step)}]}, ImageSize -> (20 + (remax - remin)/step)]]