[R-SIG-Mac] Is this an approximation I should expect, or a sign of a problem in the Universal Binary?

Simon Urbanek simon.urbanek at r-project.org
Thu Feb 16 07:19:39 CET 2006


James,

I'd say the quick answer is yes.

I'm not familiar enough with the Jenkins-Traub algorithm to run a  
thorough numerical analysis, but when you look at the magnitude of  
the coefficients, the relative error is way below machine eps (which  
is at ca. 1e-16), hence I'd say yes to the first part of your  
question. Interestingly you get exactly the same result on amd64  
running Linux, therefore no on the second part of the question.

Cheers,
Simon

On Feb 15, 2006, at 9:43 PM, James J. Ramsey wrote:

> As a test, I ran a test file in R that was a rewrite
> of a very simple Octave/Matlab problem.
>
> Here's the Octave/Matlab script:
>
> sigma_tf = 60e6; % N/m^2
> sigma_cf = 500e6; % N/m^2
>
> P = -1200e3; % N
> T = 10e3; % N*m
> SF = 3;
>
> diary Prob3Hw2.txt
> format long
>
> r = sqrt(roots([(sigma_cf*sigma_tf/(SF*(sigma_cf -
> sigma_tf)))^2 ...
>                 -P*sigma_cf*sigma_tf/(SF*pi*(sigma_cf
> - sigma_tf)) ...
>                 0 ...
>                 -(2*T/pi)^2]))
>
> format
>
> r_in_mm = r(3)*1e3
>
> diary off
>
> Both Octave and Matlab, as far as I can tell, treat
> r(3) as a real number, not a complex number with a
> really small imaginary part. Octave gave the value of
> r(3) as 0.045170515826988, and Matlab gave it as
> 0.04517051582699. The other two values of R are
> complex.
>
> Here's the R program:
>
> sigma_tf <- 60e6 # N/m^2
> sigma_cf <- 500e6 # N/m^2
>
> P <- -1200e3 # N
> T <- 10e3 # N*m
> SF <- 3
>
> r <- sqrt(polyroot(c(-(2*T/pi)^2, 0,
>          -P*sigma_cf*sigma_tf/(SF*pi*(sigma_cf -
> sigma_tf)),
>          (sigma_cf*sigma_tf/(SF*(sigma_cf -
> sigma_tf)))^2)))
>
> If I type "print(Re(r[1]), digits = 14)", I get what
> Octave gets for r(3), but the imaginary part is small
> but nonzero, -5.457521e-31.
>
> Is this normal or is this a sign that something is
> subtly off?
>
> The Octave calcs were done before I migrated to
> Mac-intel, and were done on a PPC eMac. The Matlab
> calcs were done thru Rosetta, and the R calcs were
> Intel-native.
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list