Displaying 10 results from an estimated 10 matches for "sinpi".
2016 Dec 01
1
Different results for cos,sin,tan and cospi,sinpi,tanpi
...ages:
[1] stats graphics grDevices utils datasets methods base
It's not a very good example...
f0<-function(x,y)exp(complex(real=x,imag=y))
f1<-function(x,y)complex(real=exp(1)^x*cos(y),imag=exp(1)^x*sin(y))
f2<-function(x,y)complex(real=exp(1)^x*cospi(y/pi),imag=exp(1)^x*sinpi(y/pi))
f0(700,1.23)
f1(700,1.23)
f2(700,1.23)
f0(700,1.23e23)
f1(700,1.23e23)
f2(700,1.23e23)
Garbage number is required.
Thank you!
2016-12-01 18:31 GMT+09:00 Prof Brian Ripley <ripley at stats.ox.ac.uk>:
> Please note that you need to report your platforms (as per the posting
> g...
2016 Sep 09
3
Different results for tan(pi/2) and tanpi(1/2)
As the subject line says, we get different results for tan(pi/2) and
tanpi(1/2), though this should not be the case:
> tan(pi/2)
[1] 1.633124e+16
> tanpi(1/2)
[1] NaN
Warning message:
In tanpi(1/2) : NaNs produced
By redefining tanpi with sinpi and cospi, we can get closer:
> tanpi <- function(x) sinpi(x) / cospi(x)
> tanpi(c(0, 1/2, 1, 3/2, 2))
[1] 0 Inf 0 -Inf 0
Hans Werner
2016 Dec 01
2
Different results for cos,sin,tan and cospi,sinpi,tanpi
Hi,
i try sin, cos, and tan.
> sapply(c(cos,sin,tan),function(x,y)x(y),1.23e45*pi)
[1] 0.5444181 0.8388140 1.5407532
However, *pi results the following
> sapply(c(cospi,sinpi,tanpi),function(x,y)x(y),1.23e45)
[1] 1 0 0
Please try whether the following becomes all right.
diff -ruN R-3.3.2.orig/src/nmath/cospi.c R-3.3.2/src/nmath/cospi.c
--- R-3.3.2.orig/src/nmath/cospi.c 2016-09-15 07:15:31.000000000 +0900
+++ R-3.3.2/src/nmath/cospi.c 2016-12-01 13:54:38.863357...
2016 Dec 01
0
Different results for cos,sin,tan and cospi,sinpi,tanpi
...gt;
> >> Hi,
> >> i try sin, cos, and tan.
>
> >>> sapply(c(cos,sin,tan),function(x,y)x(y),1.23e45*pi)
> >> [1] 0.5444181 0.8388140 1.5407532
>
> >> However, *pi results the following
>
> >>> sapply(c(cospi,sinpi,tanpi),function(x,y)x(y),1.23e45)
> >> [1] 1 0 0
>
> >> Please try whether the following becomes all right.
>
> > [..............................]
>
> > Yes, it does -- the fix will be in all future versions of R.
>
> oops.... not so qui...
2016 Dec 01
2
Different results for cos,sin,tan and cospi,sinpi,tanpi
...on Thu, 1 Dec 2016 14:39:55 +0900 writes:
>> Hi,
>> i try sin, cos, and tan.
>>> sapply(c(cos,sin,tan),function(x,y)x(y),1.23e45*pi)
>> [1] 0.5444181 0.8388140 1.5407532
>> However, *pi results the following
>>> sapply(c(cospi,sinpi,tanpi),function(x,y)x(y),1.23e45)
>> [1] 1 0 0
>> Please try whether the following becomes all right.
> [..............................]
> Yes, it does -- the fix will be in all future versions of R.
oops.... not so quickly, Martin!
Of course, the results the...
2016 Sep 09
3
Different results for tan(pi/2) and tanpi(1/2)
...>> tanpi(1/2), though this should not be the case:
>>
>> > tan(pi/2)
>> [1] 1.633124e+16
>>
>> > tanpi(1/2)
>> [1] NaN
>> Warning message:
>> In tanpi(1/2) : NaNs produced
>>
>> By redefining tanpi with sinpi and cospi, we can get closer:
>>
>> > tanpi <- function(x) sinpi(x) / cospi(x)
>>
>> > tanpi(c(0, 1/2, 1, 3/2, 2))
>> [1] 0 Inf 0 -Inf 0
>>
>> Hans Werner
>>
>> ______________________________________________
>&g...
2017 Feb 17
4
Wish List: Extensions to the derivatives table
.... R is faster but less flexible, since that table is programmed in C. It would be useful if R provided a mechanism for extending the derivative table, or barring that, provided a broader table. Currently unsupported mathematical functions of one argument include expm1, log1p, log2, log10, cospi, sinpi, and tanpi.
While manual differentiation of these proposed additions is straight-forward, their absence complicates what otherwise could be much simpler, such as using deriv() or deriv3() to generate functions, for example to use as an nls model.
Thanks,
[[alternative HTML version deleted]]
2017 Feb 17
1
Wish List: Extensions to the derivatives table
...]])),
log2 = make.call("/", make.call("/", D(expr[[2]], name), expr[[2]]), quote(log(2)) ),
log10 = make.call("/", make.call("/", D(expr[[2]], name), expr[[2]]), quote(log(10)) ),
cospi = make.call("*", make.call("*", make.call("sinpi", expr[[2]]), make.call("-", D(expr[[2]], name))), quote(pi)),
sinpi = make.call("*", make.call("*", make.call("cospi", expr[[2]]), D(expr[[2]], name)), quote(pi)),
tanpi = make.call("/", make.call("*", D(expr[[2]], name), quote(p...
2016 Sep 09
0
Different results for tan(pi/2) and tanpi(1/2)
...not be the case:
>>>
>>> > tan(pi/2)
>>> [1] 1.633124e+16
>>>
>>> > tanpi(1/2)
>>> [1] NaN
>>> Warning message:
>>> In tanpi(1/2) : NaNs produced
>>>
>>> By redefining tanpi with sinpi and cospi, we can get closer:
>>>
>>> > tanpi <- function(x) sinpi(x) / cospi(x)
>>>
>>> > tanpi(c(0, 1/2, 1, 3/2, 2))
>>> [1] 0 Inf 0 -Inf 0
>>>
>>> Hans Werner
>>>
>>> _________________...
2017 Feb 17
0
Wish List: Extensions to the derivatives table
...ess
> flexible, since that table is programmed in C. It would be useful if R
> provided a mechanism for extending the derivative table, or barring that,
> provided a broader table. Currently unsupported mathematical functions of
> one argument include expm1, log1p, log2, log10, cospi, sinpi, and tanpi.
>
> While manual differentiation of these proposed additions is
> straight-forward, their absence complicates what otherwise could be much
> simpler, such as using deriv() or deriv3() to generate functions, for
> example to use as an nls model.
>
> Thanks,
>
>...