On Sep 3, 11:56 am, Eckhard Kosin <[email protected]>
wrote:
> Am Freitag, den 03.09.2010, 07:58 -0700 schrieb kcrisman:> Yes, complex_plot 
> is similar to a Mathematica function of the same
> > type.
>
> > To plot such a function the way you are indicating, we need to have
> > the fast_float/fast_callable functions which do (very fast, as the
> > name indicates) evaluation of functions to be plotted to work with
> > complex input.  This is largely done, but still needs review and/or
> > work.
>
> > Obviously one could work around this by doing everything in x and y
> > only (without i, even) but this is not a long-term solution.  I have
> > been frustrated by this not working as well in the past.
>
> > Sorry this is not as easily available as it should be.
>
> May I propose a workaround:
>
> sage: var('x,y,z,z0')
> (x, y, z, z0)
> sage: z0 = 1+i
> sage: f(z) = abs(1/(z-z0))
> sage: plot3d(lambda x,y: f(x+i*y), (x,0,2), (y,0,2))
>

Yes, lambda functions often help a lot for workarounds of this type
(see ask.sagemath.org for several example where this does so for
numerical integration.  I am not really comfortable with them, so I
apologize for not pointing this out.

> I don't know why I can't plot f without the use of lambda:
>
> sage: plot3d(f(x+i*y), (x,0,2), (y,0,2))
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /home/ecki/<ipython console> in <module>()
>
> ... <snip> ...
>
> TypeError: float() argument must be a string or a number
>
> Is this bug?

Sort of.  Jason Grout and Mike Hansen understand fast_callable much
better than I do, so I'll defer to them, but I would call this more of
a NotImplementedError than a bug per se, since we don't claim to have
this functionality.

But we should.

- kcrisman

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to