Does R have any facilities, or packages, for graphing complex functions?

I find that 'curve' does not do the trick. Example:

> f = function(x) cos(x) + 1i * sin(x)
> curve(f, -pi, pi)
Error in xy.coords(x, y, xlabel, ylabel, log) :
  (converted from warning) imaginary parts discarded in coercion

Enter a frame number, or 0 to exit

1: curve(f, -pi, pi)
2: plot(x = x, y = y, type = type, xlab = xlab, ylab = ylab, xlim = xlim,
log = lg, ...)
3: plot.default(x = x, y = y, type = type, xlab = xlab, ylab = ylab, xlim =
xlim, log = lg, ...)
4: xy.coords(x, y, xlabel, ylabel, log)
5: .signalSimpleWarning("imaginary parts discarded in coercion",
quote(xy.coords(x, y, xlabel, ylabel, log)))
6: withRestarts({
    .Internal(.signalCondition(simpleWarning(msg, call), msg, call))
    .Internal(.dfltWarn(msg, call))
}, muffleWarning = function() NULL)
7: withOneRestart(expr, restarts[[1]])
8: doWithOneRestart(return(expr), restart)
9: (function ()
{
    error()
    utils::recover()
})()

Selection:

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to