Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 1544
complex_plot?
File: /usr/local/sage/sage-6.5/src/sage/plot/complex_plot.pyx Signature : complex_plot(f, xrange, yrange, plot_points=100, interpolation='catrom', **kwds) Docstring : "complex_plot" takes a complex function of one variable, f(z) and plots output of the function over the specified "xrange" and "yrange" as demonstrated below. The magnitude of the output is indicated by the brightness (with zero being black and infinity being white) while the argument is represented by the hue (with red being positive real, and increasing through orange, yellow, ... as the argument increases). "complex_plot(f, (xmin, xmax), (ymin, ymax), ...)" INPUT: * "f" -- a function of a single complex value x + iy * "(xmin, xmax)" -- 2-tuple, the range of "x" values * "(ymin, ymax)" -- 2-tuple, the range of "y" values The following inputs must all be passed in as named parameters: * "plot_points" -- integer (default: 100); number of points to plot in each direction of the grid * "interpolation" -- string (default: "'catrom'"), the interpolation method to use: "'bilinear'", "'bicubic'", "'spline16'", "'spline36'", "'quadric'", "'gaussian'", "'sinc'", "'bessel'", "'mitchell'", "'lanczos'", "'catrom'", "'hermite'", "'hanning'", "'hamming'", "'kaiser'" EXAMPLES: Here we plot a couple of simple functions: sage: complex_plot(sqrt(x), (-5, 5), (-5, 5)) Graphics object consisting of 1 graphics primitive sage: complex_plot(sin(x), (-5, 5), (-5, 5)) Graphics object consisting of 1 graphics primitive sage: complex_plot(log(x), (-10, 10), (-10, 10)) Graphics object consisting of 1 graphics primitive sage: complex_plot(exp(x), (-10, 10), (-10, 10)) Graphics object consisting of 1 graphics primitive A function with some nice zeros and a pole: sage: f(z) = z^5 + z - 1 + 1/z sage: complex_plot(f, (-3, 3), (-3, 3)) Graphics object consisting of 1 graphics primitive Here is the identity, useful for seeing what values map to what colors: sage: complex_plot(lambda z: z, (-3, 3), (-3, 3)) Graphics object consisting of 1 graphics primitive The Riemann Zeta function: sage: complex_plot(zeta, (-30,30), (-30,30)) Graphics object consisting of 1 graphics primitive Extra options will get passed on to show(), as long as they are valid: sage: complex_plot(lambda z: z, (-3, 3), (-3, 3), figsize=[1,1]) Graphics object consisting of 1 graphics primitive sage: complex_plot(lambda z: z, (-3, 3), (-3, 3)).show(figsize=[1,1]) # These are equivalent TESTS: Test to make sure that using fast_callable functions works: sage: f(x) = x^2 sage: g = fast_callable(f, domain=CC, vars='x') sage: h = fast_callable(f, domain=CDF, vars='x') sage: P = complex_plot(f, (-10, 10), (-10, 10)) sage: Q = complex_plot(g, (-10, 10), (-10, 10)) sage: R = complex_plot(h, (-10, 10), (-10, 10)) sage: S = complex_plot(exp(x)-sin(x), (-10, 10), (-10, 10)) sage: P; Q; R; S Graphics object consisting of 1 graphics primitive Graphics object consisting of 1 graphics primitive Graphics object consisting of 1 graphics primitive Graphics object consisting of 1 graphics primitive Test to make sure symbolic functions still work without declaring a variable. (We don't do this in practice because it doesn't use fast_callable, so it is much slower.) sage: complex_plot(sqrt, (-5, 5), (-5, 5)) Graphics object consisting of 1 graphics primitive
%md Could William modify the plot to have different colors other than the bold red and make the other half less faded? The Cornell image is similar looking to yours but with a grey background (which is a bit dull), but the colors in the other half are brighter. Also the cover image file resolution needs to be 300 dpi at size. bd641047-cf51-48b3-895c-ba83436a432b︠ 300*8
2400
%time B = 50 show(complex_plot(zeta, (-B,B),(-B,B), frame=False, axes=False, plot_points=400), svg=False, figsize=[8,8])
CPU time: 29.53 s, Wall time: 32.14 s
%time B = 50 save(complex_plot(zeta, (-B,B),(-B,B), frame=False, axes=False, plot_points=2400), 'zeta2400.png', figsize=[8,8])
CPU time: 1692.61 s, Wall time: 1697.98 s
1692.61/60.0
28.2101666666667
i = CDF(I) def f(z): return zeta(z)*i complex_plot(f, (-50,50),(-50,50), frame=False, axes=False, aspect_ratio=1)
def f(z): return zeta(z)*(-1) complex_plot(f, (-50,50),(-50,50), frame=False, axes=False, aspect_ratio=1)