[R] problem with Gauss Hermite ( x and w )

R. Michael Weylandt michael.weylandt at gmail.com
Thu May 10 04:23:20 CEST 2012


Taking negative numbers to fractional powers gives NaNs.... that's
just how it works.

Unless you want to use complex numbers (which R does not by default):

as.complex(cc$x) ^ (2.5)

Michael

On Wed, May 9, 2012 at 7:22 PM, casperyc <casperyc at hotmail.co.uk> wrote:
> Hi all,
>
> I am using the 'gaussHermite' function from the 'pracma' library
>
> ############ CODES ###########
> library(pracma)
> cc=gaussHermite(10)
> cc$x^2
> cc$x^5
> cc$x^4
> ############ CODES ###########
>
> as far so good. However, it does NOT work for any NON integer values, say
>
> ############ CODES ###########
> cc$x^(2.5)
> cc$x^(-2.5)
> ############ CODES ###########
>
> But just think about it numberically, it should work.....
>
> why this is the case?
>
> Is there a reason for getting the "NaN"s?
>
> Thanks!
>
>
>
>
>
>
>
> -----
> ######################
> PhD candidate in Statistics
> Big R Fan
> Big LEGO Fan
> Big sTaTs Fan
> ######################
>
> --
> View this message in context: http://r.789695.n4.nabble.com/problem-with-Gauss-Hermite-x-and-w-tp4622115.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list