{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module AERN2.Real.Elementary
(
pi
)
where
import MixedTypesNumPrelude
import qualified Prelude as P
import AERN2.MP.Ball
import AERN2.MP.Dyadic
import AERN2.Real.Type
import AERN2.Real.Field ()
pi :: CReal
pi :: CReal
pi = [CN MPBall] -> CReal
forall t. [CN t] -> CSequence t
CSequence ([CN MPBall] -> CReal) -> [CN MPBall] -> CReal
forall a b. (a -> b) -> a -> b
$ (Precision -> CN MPBall) -> [Precision] -> [CN MPBall]
forall a b. (a -> b) -> [a] -> [b]
map (MPBall -> CN MPBall
forall v. v -> CN v
cn (MPBall -> CN MPBall)
-> (Precision -> MPBall) -> Precision -> CN MPBall
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Precision -> MPBall
piBallP) [Precision]
cseqPrecisions
instance CanSinCos CReal where
cos :: CReal -> SinCosType CReal
cos = (CN MPBall -> CN MPBall) -> CReal -> CReal
forall t1 t2. (CN t1 -> CN t2) -> CSequence t1 -> CSequence t2
lift1 CN MPBall -> CN MPBall
forall t. CanSinCos t => t -> SinCosType t
cos
sin :: CReal -> SinCosType CReal
sin = (CN MPBall -> CN MPBall) -> CReal -> CReal
forall t1 t2. (CN t1 -> CN t2) -> CSequence t1 -> CSequence t2
lift1 CN MPBall -> CN MPBall
forall t. CanSinCos t => t -> SinCosType t
sin
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanSinCos $t where
type SinCosType $t = CReal
cos = cos . creal
sin = sin . creal
|]))
instance CanSqrt CReal where
sqrt :: CReal -> SqrtType CReal
sqrt = (CN MPBall -> CN MPBall) -> CReal -> CReal
forall t1 t2. (CN t1 -> CN t2) -> CSequence t1 -> CSequence t2
lift1 CN MPBall -> CN MPBall
forall t. CanSqrt t => t -> SqrtType t
sqrt
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanSqrt $t where
type SqrtType $t = CReal
sqrt = sqrt . creal
|]))
instance CanExp CReal where
exp :: CReal -> ExpType CReal
exp = (CN MPBall -> CN MPBall) -> CReal -> CReal
forall t1 t2. (CN t1 -> CN t2) -> CSequence t1 -> CSequence t2
lift1 CN MPBall -> CN MPBall
forall t. CanExp t => t -> ExpType t
exp
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanExp $t where
type ExpType $t = CReal
exp = exp . creal
|]))
instance CanLog CReal where
log :: CReal -> LogType CReal
log = (CN MPBall -> CN MPBall) -> CReal -> CReal
forall t1 t2. (CN t1 -> CN t2) -> CSequence t1 -> CSequence t2
lift1 CN MPBall -> CN MPBall
forall t. CanLog t => t -> LogType t
log
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanLog $t where
type LogType $t = CReal
log = log . creal
|]))
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanPow $t Dyadic where
type PowType $t Dyadic = CReal
pow b e = pow (creal b) (creal e)
|]))
$(declForTypes
[[t| Integer |], [t| Int |], [t| Rational |], [t| Dyadic |]]
(\ t -> [d|
instance CanPow $t Rational where
type PowType $t Rational = CReal
pow b e = pow (creal b) (creal e)
|]))
instance P.Floating CReal where
pi :: CReal
pi = CReal
pi
sqrt :: CReal -> CReal
sqrt = CReal -> CReal
forall t. CanSqrt t => t -> SqrtType t
sqrt
exp :: CReal -> CReal
exp = CReal -> CReal
forall t. CanExp t => t -> ExpType t
exp
sin :: CReal -> CReal
sin = CReal -> CReal
forall t. CanSinCos t => t -> SinCosType t
sin
cos :: CReal -> CReal
cos = CReal -> CReal
forall t. CanSinCos t => t -> SinCosType t
cos
log :: CReal -> CReal
log = CReal -> CReal
forall t. CanLog t => t -> LogType t
log
atan :: CReal -> CReal
atan = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: atan not implemented yet"
atanh :: CReal -> CReal
atanh = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: atanh not implemented yet"
asin :: CReal -> CReal
asin = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: asin not implemented yet"
acos :: CReal -> CReal
acos = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: acos not implemented yet"
sinh :: CReal -> CReal
sinh = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: sinh not implemented yet"
cosh :: CReal -> CReal
cosh = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: cosh not implemented yet"
asinh :: CReal -> CReal
asinh = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: asinh not implemented yet"
acosh :: CReal -> CReal
acosh = [Char] -> CReal -> CReal
forall a. HasCallStack => [Char] -> a
error [Char]
"CReal: acosh not implemented yet"