[[diverted from R-bugs to R-help by the list maintainer]]

Dear Friend and distinguished R gurus,

first of all really thank you very much for the marvellous tool that is R.

I am using R 2.5.0,  windows XP - italian language.

I was perfoming some calculation on fractional exponential and
I found a strange behaviour. I do not know if it is really a bug, but I would 
expect
a different answer from R.

I was trying the following :

x <- seq(-3,3, by =0.1)
n <- 2.2
y <- exp(-x^n)

well, the y vector contains (NaN for all negative value of x)

but if you ask for single value calculation like

y <- exp(-(-3)^2.2) or 

y <- exp(-(-2.9)^2.2)

the answer is correct. 
It seem it does not make the calculation in vector form.

I got the same behaviour (NaN)  in a for loop

> for(i in 1:length(x)) y[i]=exp(x[i]^n)
> y
 [1]           NaN          NaN          NaN          NaN          NaN          
NaN          NaN          NaN          NaN
[10]          NaN          NaN          NaN          NaN          NaN          
NaN          NaN          NaN          NaN
[19]          NaN          NaN          NaN          NaN          NaN          
NaN          NaN          NaN          NaN
[28]          NaN          NaN          NaN     1.000000     1.006330     
1.029416     1.073302     1.142488     1.243137
[37]     1.384082     1.578166     1.844237     2.210260     2.718282     
3.432491     4.452553     5.936068     8.137120
[46]    11.473746    16.648415    24.867680    38.251295    60.611092    
98.967689   166.572985   289.077778   517.425935
[55]   955.487320  1820.793570  3581.521323  7273.674928 15255.446778 
33050.861013 73982.100407
> 

Is it strange or did I miss something ?

Many thanks for the attention.


Very best regards

Giuseppe Pedrazzi
Dept Public Health, Physics Division
University of Parma, Italy
        [[alternative HTML version deleted]]

______________________________________________
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.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to