[R] Sweave and complex numbers

Robin Hankin r.hankin at noc.soton.ac.uk
Mon Jul 11 13:25:49 CEST 2005


Hi

When using Sweave, most of my functions get called with complex  
arguments.

They get typeset in with additions that I don't want; "1+1i" appears  
as "1 + (0 + 1i)"
and I would rather have plain old "1+1i".

Example follows:




\documentclass[a4paper]{article}

\title{A Test File}
\author{Robin Hankin}

\usepackage{a4wide}

\begin{document}

\maketitle

A simple example:
<<print=TRUE>>=
f <- function(x){
x+c(1,1+1i)}
f(6+7i)
@


Question: why does \verb=c(1,1+1i)= get printed as
\verb=c(1,1 + (0+1i))= ?

And how can I stop it?

\end{document}




can anyone help me here?







--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743




More information about the R-help mailing list