From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>

Date: Fri 06 May 2005 - 17:27:11 EST

}

stop("not converged")

}

Date: Fri 06 May 2005 - 17:27:11 EST

They have Taylor expansions, but the powers increase as the square of n, as in

1 + z + z^4 + z^9 + z^16 + z^25 + . . .

so they converge very quickly, provided |z|<1

out.old <- 1

for(n in 1:maxiter){

out.new <- out.old + z^(n*n) if(identical(out.new, out.old)){ return(out.new) } out.old <- out.new

}

stop("not converged")

}

[NB this is not a real theta function! Real theta functions are more complicated. f() just shows the issues]

I worry about the use of identical() here, because I am comparing two
floats for equality

as discussed in FAQ 7.31. Perhaps all.equal() would be better:

all.equal(1e99,1e99+1e83, tol=.Machine$double.eps)

Does the List have any comments to make?

-- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Fri May 06 17:32:47 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:37 EST
*