Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions mathics/builtin/drawing/plot_plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED
from mathics.core.builtin import Builtin
from mathics.core.convert.expression import to_mathics_list
from mathics.core.definitions import Definitions
from mathics.core.evaluation import Evaluation
from mathics.core.systemsymbols import Symbol, SymbolPlotRange, SymbolSequence

Expand Down Expand Up @@ -143,9 +144,10 @@ def eval(

class ComplexPlot3D(_Plot3D):
"""
<url>:Domain coloring:https://en.wikipedia.org/wiki/Domain_coloring</url>
<url>:WMA link: https://reference.wolfram.com/language/ref/ComplexPlot3D.html</url>
<dl>
<dt>'Plot3D'[$f$, {$z$, $z_{min}$, $z_{max}$}]
<dt>'ComplexPlot3D'[$f$, {$z$, $z_{min}$, $z_{max}$}]
<dd>creates a three-dimensional plot of the magnitude of $f$ with $z$ ranging from $z_{min}$ to \
$z_{max}$ with surface colored according to phase

Expand All @@ -154,6 +156,14 @@ class ComplexPlot3D(_Plot3D):
</url> for a list of Plot options.
</dl>

'ComplexPlot' allows to visualize the changes both in the phase and \
the module of a complex function:

In the neighbourhood of the poles, the module of a rational function \
grows without limit, and the phase varies between $-\\Pi$ to $\\Pi$
an integer number of times:
>> ComplexPlot3D[(z^2 + 1)/(z^2 - 1), {z, -2 - 2 I, 2 + 2 I}]
= ...
"""

summary_text = "plots one or more complex functions as a 3D surface"
Expand All @@ -166,9 +176,10 @@ class ComplexPlot3D(_Plot3D):

class ComplexPlot(_Plot3D):
"""
<url>:Domain coloring:https://en.wikipedia.org/wiki/Domain_coloring</url>
<url>:WMA link: https://reference.wolfram.com/language/ref/ComplexPlot.html</url>
<dl>
<dt>'Plot3D'[$f$, {$z$, $z_{min}$, $z_{max}$}]
<dt>'ComplexPlot'[$f$, {$z$, $z_{min}$, $z_{max}$}]
<dd>creates two-dimensional plot of $f$ with $z$ ranging from $z_{min}$ to \
$z_{max}$ colored according to phase

Expand All @@ -177,6 +188,12 @@ class ComplexPlot(_Plot3D):
</url> for a list of Plot options.
</dl>

'ComplexPlot' allows to visualize the changes in the phase of a \
complex function.
In the neighbourhood of the poles, the module of a rational function \
the phase varies between $-\\Pi$ to $\\Pi$ an integer number of times.
>> ComplexPlot[(z^2 + 1)/(z^2 - 1), {z, -2 - 2 I, 2 + 2 I}]
= ...
"""

summary_text = "plots a complex function showing phase using colors"
Expand All @@ -189,6 +206,8 @@ class ComplexPlot(_Plot3D):

class ContourPlot(_Plot3D):
"""
<url>:heat map:https://en.wikipedia.org/wiki/Heat_map</url>
<url>:contour map:https://en.wikipedia.org/wiki/Contour_line</url>
<url>:WMA link: https://reference.wolfram.com/language/ref/ContourPlot.html</url>
<dl>
<dt>'Contour'[$f$, {$x$, $x_{min}$, $x_{max}$}, {$y$, $y_{min}$, $y_{max}$}]
Expand All @@ -200,6 +219,19 @@ class ContourPlot(_Plot3D):
</url> for a list of Plot options.
</dl>

Colorize the regions where a function takes values close to different \
integer values
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values don't need to be integers.

>> ContourPlot[x - y^3, {x, -2, 2}, {y, -1, 1}, AspectRatio->Automatic]
= ...

The same, but with a finer division:
>> ContourPlot[x^2 - y^2, {x, -2, 2}, {y, -1, 1}, Contours->10]
= ...

Plot curves where the real and the imaginary part of a function take
specific values:
>> ContourPlot[{Re[Sin[x + I y]] == 5, Im[Sin[x + I y]] == 0}, {x, -10, 10}, {y, -10, 10}]
= ...
"""

requires = ["skimage"]
Expand Down
Loading